Tag Info

Hot answers tagged

46

To say "Python is slow compared to C++" is a generalization that ignores a lot of real-world practicalities and is usually a poor kind of judgement to rely on. What you really want to do is look at what a particular language or technology can bring to the table in terms of your needs and, similarly, evaluate any potential downfalls of that technology against ...


17

Would a noSQL database be suitable for a web-based game? Absolutely! Generally speaking, non-relational databases (such as MongoDB) are much better for games, as they are more flexible in how they model data, while being more performant than relational databases (such as SQL) - making them a "win-win" choice. What are the issues that might arise using a ...


16

Couple of words do defend SQL databases. 1 - If you have SQL database you can work with your data not only by primary key. Most of queries in MMO goes by PK but when you need to find all users with level > 30 what will you do in NoSQL world? 2 - If you have SQL language you may create "hotfixes" to repair broken data. For example: "update player_items ...


15

I've recently implemented an algorithm for a procedural city layout. It's still very much a work in progress, but seems promising to me. Take a look: The algorithm used to create this layout is loosely based on L-Systems. I have a base Element class, that has a rectangle marking its place on map and a method Grow, which creates other Elements inside the ...


15

You want a data-driven approach almost certainly unless your game is going to be completely un-expected and/or procedural generated to the core. Essentially, this involves storing information about your weapons in a markup language or file format of your choice. XML and JSON are both good, readable choices that can be used to make editing fairly simple ...


13

To your first point, you'll just need to build a prototype and see. Even if you told us all the details that wouldn't really change things. As for the other two points, I kinda feel like you're putting the cart before the horse. From your question it seems like you are new to game development, in which case you really just need to pick a tool and go with ...


13

To briefly answer your main question first, the main advantages of a procedurally generated game world are that: The world can be huge, much larger than any manually designed game world could possibly be. The world (or at least parts of it) can be regenerated for each game, potentially increasing replay value, since the player will always have something ...


12

Python is pretty portable in itself (runs on many platforms), but you have to take into account the following: What are the limitations of the platform you're targeting? Do you want to sell through a mobile store? For instance, the WP7 marketplace only allows to sell apps written in managed code (.NET). The AppStore is pretty locked down too and only ...


11

I'm not really sure what card game you're trying to create, but here are the general steps I would go through: Write the rules down on paper - Write the rules down in bullet format. This will get your brain thinking about the logic, and will provide you with a handy reference to use later on. Rewrite the rules to follow the programmatic flow - Keep the ...


10

Imagine the following setup: 1 1 1 1 1 1 1 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 0 1 1 1 1 1 1 1 As a side note, I refer to squares in the matrix like this: (row, column). I've represented mines with "1" and empty spaces with "0". Assume the user clicks on the empty space at (2, 2) (the corner at the top-left is (0, 0)). This is what would happen: ...


9

Edited to add: this isn't important for now as it will still work just fine and makes learning OpenGL easier but do note that the whole matrix stack system is deprecated in OpenGL 3.x and beyond. One possible replacement is GLM. The code in your pastebin fails to even run for me. In particular, your list indices in the display function are out of range ...


9

Some Options for Python: Multiplatform (Win/Linux/Mac): PyInstaller Multiplatform (Win/Linux/Max): cx-freeze Windows: py2exe Mac: py2app The bad news is that, as far as I can tell, you can't create binaries for a platform from another platform. The reason seems to be dependencies on platform-specific libraries. Edit: By the way, you might be interested ...


9

Whoever's general consensus you have, is wrong. There is nothing special needed to implement collision detection in an isometric game. It is no different from implementing collision detection in Robotron or even Pitfall. This is a common misconception, and one that often leads to a lot of struggling. On contract recently I met a senior developer who couldn't ...


9

A very basic formula would be: damageAfterArmorCalc = damageAmt*(1-armorReductionPercent) damageAmt Is the original amount of damage to be done. armorReductionPercent is the percent of damage the armor negates, this percentage should be a value from 0 to 1, so the 20% in your example would be .2. If we're doing 100 damage initially, we can look at some ...


9

You only need the textures bound when you'd need to refer to them during the rendering of an object. You do not need every texture you will ever use bound to the pipeline at once. Thus, to render the floor, you bind only the textures you need for the floor; then you render the floor. Then you bind only the textures you need for the NPCs, and render all the ...


9

A* gives you the shortest path in the graph. When using a grid as your graph there are often multiple shortest paths. In your first diagram, that is one of the shortest paths. It puts all the axial movements first and all the diagonal movements afterwards. But that's the same length path as if you put all the diagonals first, or if you mixed axial and ...


8

Both, in general. Your scripts should talk to an abstracted -- or at least intermediate -- layer of functionality and not the engine itself. First, this provides you an extra measure of control and security. It allows you to easily, cleanly define the interface a script is allowed to have with your game and thus what it can muck about with, as well as ...


8

At the request of commenters... Warning to Pyglet professionals: There may be a nice Pyglet way to do this, and this isn't it. It's a nice OpenGL way. You have been warned! You can do this in OpenGL by first binding the texture, then calling glTexParameteri or similar varients. You can do this in Pyglet by importing OpenGL: from pyglet.gl import * You ...


8

You want to use a weighted choice algorithm. Here's some code. (I modified my own working code to fit your case, but it should work): Ignoring the definition of WeightedChoice() for the moment, using WeightedChoice() is simple: # The weighted list of monsters. Each item is a tuple: (VALUE, WEIGHT) monsterlist = ( ('snake', 60), ('wolf', 80), ...


8

You might want to divide your world into segments/ a grid so that you only check collision for agents that are relevant. Agent A thats on the other side of the screen will NOT collide with B on te opposite side. So why check collision? Google for Spatial partitioning / quadtrees /spatial hashing. I googled some for you: Quadtrees Grid Also your second ...


8

You're checking each agent against every other agent more than once. For example, consider a simple list of 3 agents, there should only 3 checks, you're checking 9 times, and that gets much worse with larger numbers. At 100 you're checking 10,000 times instead of 5,050. When you iterate like you're doing, the comparison happens like this: A1->A1 ...


7

If you go to the Downloads section, under Snapshot Builds, you can find the documentation bundled as a zipfile or as chm, ready for downloading: Snapshot Builds page Python Doc Cxx Doc


7

Well, as it seems, you are not seeding the random number generator. In python, it can be easily done with just a random.seed(). And I can see too you're generating a number between 1 and 500000 and making it be between 0 and 1. It's a functional method, but it is capped to just 500000 possibilities. You're better with just using random.random() it already ...


7

This isn't answering your specific programming question, but consider that creating lakes and rivers isn't about randomly placing blobs of water and strips of water between them. It's about terrain height - about depressions (basins) that turn into lakes, and water that flows from higher to lower spots. If you want a great example of creating lakes and ...


7

What you experience right now is a typical consequence of keeping a complex global state. Global states, and complex global states in particular, make side effects hard to track and your code impossible to test. Which is why, whenever something goes wrong, you have to debug your system the hard way. Your program has "only" 1.000 LOC, so not everything is ...


7

Do python games use Lua? Generally? No. Is it a resonable thing or I should just stick to pure python? Define "reasonable"? Python has been used in many game development scenarios. While Lua may be well known among some game mod circles (like WoW GUIs, Garry's Mod, and so forth), Python was the language of choice for Civilization IV modding. So ...


7

Advantages of Procedural Generation Can easily scale your maps / designs to truly large sizes, much larger than you could create by hand. By creating a system where chunks of terrain are created on the fly, you can avoid having to write pieces of code to load in chunks from permanent memory. Over the long term, you may be able to discover more viable ...



Only top voted, non community-wiki answers of a minimum length are eligible