Tag Info

Hot answers tagged

46

Among the many other related questions on the site, there's an often linked article for map generation: Polygonal Map Generation for Games you can glean some good strategies from that article, but it can't really be used as is. While not a tutorial, there's an article on how Dwarf fortress world maps are generated. Basically you generate multiple layers of ...


41

"Staggered" refers to the jagged edges of isometric maps that have an overall rectangular shape. These maps emphasize the north/south and west/east axes, and often have North up (example: Civilization 2). Diamond maps on the other hand emphasize the diagonal orientation and movement. North is often at the top right (example: Simcity 2000). Also notice the ...


26

One of the best, and most used, algorithms I've seen out there is generating dungeons using Binary Space Partitioning. The best general explanation I've read is the one found in The Chronicles of Doryen (attached at the end for backup purposes) because explains the procedure without getting into the code, thus leaving the implementation to the reader. Two ...


25

Your question leads you into the field of procedural content generation. Tile-based world generation derived from continuous/analog methods By continuous, I means something that is not tiles, something that is analog, an example being a vectorised map. You can use any continuous technique for generation, and then quantise it. For example generate a high ...


19

While the other answers here are really good for generating the kinds of static landscapes that would work for this specific need. There are other methods that people coming across this question might be looking for if they want to create landscapes that change over time or appear much more realistic you can follow this technique. Unlike the other answers ...


18

Yes, they use tilemaps (more precisely : small 8x8 hardware tiles). The main reason is that background scrolling and sprites display on most 16-bit consoles are hardware accelerated (there is a dedicated hardware chip for that, VDP in case of genesis). The only way to use that feature on genesis is to divide the background and sprites into small 8x8 tiles ...


17

You could use perlin noise, which is normaly used for heightmap generation. Perlin noise in games Then you could use the heights as an adviser, how high the chance of grass/dirt occuring in one region of the map is. Example (Perlin noise values from 0-256): If the value is over 200 the chance that grass is placed is 80% (dirt 20%). If the value is between ...


15

You can generate the optimal path using A*, then distort it with midpoint displacement. This will ensure your endpoints are met and allow you to control the randomness to a great degree. For example, I would not randomize roads as much as rivers. Whatever intelligence is building roads typically attempts to be optimal about it. Take care to ensure that ...


14

Maybe this is how it's typically done. You have your list of different tiles that represent a road tiles in all their possible orientations. Left to right, all four corners, top to bottom, whatever. Now you'll index all those tiles with a byte each. 8 bits, one for each direction. This could be in a hashmap or by file name... however you want to do this. So ...


12

You can use Perlin Noise for the generation of the terrain, here is how the biomes in Minecraft work. As you can see he uses a heatmap in combination with a rainmap to create the biomes.


12

What you could do is randomly generate a Voronoi map like this: Picking random center points (see the black dots) and randomly decide if they are grass or dirt. Then for over all tiles, check if it's closest to a center point of dirt or a grass. Done! If what you did previously is "flip a coin" for each tile (noise), generating a Voronoi diagram will ...


12

Yay I found a research paper! In terms of computational cost Shadow Mapping seems pretty clear winner. Algorithm used can be found here and a C# implementation can be found here, relevant bit below. #region FOV algorithm // Octant data // // \ 1 | 2 / // 8 \ | / 3 // -----+----- // 7 / | \ 4 // / 6 | 5 \ ...


11

Hopefully you have solved this yourself by now, if not here is some help to get you there. Debugger That program you're using to type all your code in to? It's not just for typing code in and pressing "play". It's an IDE (Integrated Development Environment). This means it contains many tools to help you develop, one of those tools is the debugger. I ...


10

First of all and to clarify, do you require it to be completely top-down or do you consider something like this as being top-down too. In that example you can tell that the house is much taller than the barrel simply by the amount of tiles that they both span vertically. Also, allowing the character to move behind the objects is another good way to let the ...


8

If your argument against an array is "The world will be huge", then it's not about the data-structure, but rather about memory constraints. If your world is so large, that it doesn't fit into memory with a 2D array, then it won't fit into any other data-structure. Instead you would have to implement a (file-)format, that allows loading chunks (or sectors) ...


8

TiledMap tiledMap = new TmxMapLoader().load("path/to/tiled/map.tmx"); MapProperties prop = tiledMap.getProperties(); int mapWidth = prop.get("width", Integer.class); int mapHeight = prop.get("height", Integer.class); int tilePixelWidth = prop.get("tilewidth", Integer.class); int tilePixelHeight = prop.get("tileheight", Integer.class); int mapPixelWidth ...


8

An alternatve would be to not place the power-ups near the players but at positions which involve taking some risks to get there. This way you would encourage players to stop hiding which can increase the fun-factor and would reward them for their "courage". On top of that no one could complain that someone was just lucky to pick up a powerful power-up ...


7

Like Byte56 suggested, rather than fix the collision, you simply doesn't allow the collision to happen in the first place. Here's a snippet of how my engine handles it // Reset flags just like you do. this.IsPushingLeft = false; this.IsPushingRight = false; // verticalWall is just a struct containing all the common data for whatever wall of tiles the ...


7

Here are a few strategies you could try: Precalculate scaled-down versions of your tiles. When you use the full-scale tiles as source and let your engine scale them down everytime it draws them, it needs to perform the interpolation algorithm again and again. But when you precalculate a version of each tile in each zoom-level when you load it, blitting the ...


7

Complete vs. incomplete information What you are looking to do is path finding without complete information. The conceptually sound way to do this would require you to keep track of all of your non-playing character's information state (i.e., the parts of the map they already have discovered). Local information A more workable solution in your case might ...


6

Procedural generation is an immense topic. How deep are you willing to go? Nick Wiggill's answers are top-notch. I'd add to that by suggesting that you look at some mathematical methods of creating coherent random terrain. Perlin noise offers a great way to create smoothed randomness, and works great for all sorts of terrain. Simulating erosion can give a ...


6

It sounds like most of your cells are unoccupied. You can dramatically reduce memory if you store only occupied cells; this is termed "sparse" and is straightforward using a simple run-length-encoding (RLE) scheme (the runs of occupied and unoccupied cells are length-encoded). For example, you could have an array of block instances: Block[] blocks; // ...


6

Take a look at Tiled. It has support for Isometric maps and stores them as XML.


6

I implemented an entity component framework (similar to Artemis) after I'd already been in development for a while, but I don't think I would have done things differently if starting from a blank slate. I have my world totally separate from the entity framework. It just didn't make sense to me to convert the world into some sort of entity or collection of ...


6

A map editor of some sort is what you are going to need (and want!) when your game moves more to the level design phase from the initial engine/coding phase. If you are using any kind of map/level editor, you will need to code a class (or set of classes) that can: Read/Input the Data Translate the data into actual objects (and sets of objects). Your tiles ...


6

First of your problem is that you're not looking in a further perspective. The ball blocks itself on a wall - just move it 0.5 pixels away. Why not try to unblock it instead? Later you treat a corner like a circle (do you mean a point? If not, I don't understand the idea and it makes me dizzy when I try). It's OK to do quick, dirty fixes and try if they ...


6

At this time, you'd have to create an int array of the layer indexes you do want to draw, and then use the render method which takes a camera and the layer indexes. So, if you have three layers and the last one is the collision layer you do not wish to draw, you'd do: int[] layers = new int[] {0, 1}; // preferably outside of the render loop, to avoid gc ...


6

I would go for the pseudo-3d approach and visualize the height with a vertical offset. To avoid the problem that parts of the map are concealed by cliffs, I would only use a few pixels per height level and avoid having differences of more than 4 or 5 levels. As you can see from this mockup, this is good for visualizing that the tile to the north is higher ...


6

Games of that age had to make use of very constrained memory. The Sega Genesis had only 64kb of video ram and only a few MB of ROM per game cartridge. They simply hadn't got the resources for large bitmaps. So they used tilemaps whenever possible and reserved large images for special occasions (boss fights or other memorable key areas of the game).



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