Hot answers tagged

68

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 ...


57

I made a picture to sum it up. Basically, the difference between both types of maps has mostly to do with the angle formed between each axis which results in one appearing to be seen from a topdown point of view, while the other appears to be seen from an angle: It is also worth noticing the visual difference between an isometric projection and perspective ...


49

Here's a rough idea using image processing transformations to isolate the features of interest: Apply a flood fill from an ocean cell to make a mask of all ocean cells. Depending on how your rivers are set up, you might need an extra elevation or clearance criterion to keep the ocean mask from flowing inland. ;) Apply a local smoothing to the edge of this ...


41

For the most part, no, art assets of any kind aren't routinely sent across the network. Generally all clients will have the same content assets locally. There may be code to ensure this is the case via checksumming the content, or similar. If you are worried about users tampering with some of their content client-side, you can implement a similar system. ...


39

Amit Patel, a user of this site, has created a wonderful resource of information about random world generation that will certainly be of use to you. Further there are some great questions/answers about procedural generation on this site. Road / river generation on 2d grid map Procedural world generation oriented on gameplay features How can I generate ...


37

Most games place the map origin in a corner. The main reason for this is that tilemaps are often internally stored in two-dimensional arrays, and most programming languages don't allow negative array indexes. There are a lot of discussions about which corner should be the origin, but I don't consider any of the arguments particularly strong. In the end it's ...


35

Back when I experimented with this type of thing (late 1990s), I read some papers and books to learn about water flow, but I didn't keep a record of which ones I looked at. I ended up doing my own thing because I wanted to handle erosion. I wanted rivers to produce canyons and floodplains. I wanted dam reservoirs to fill up with sediment. I wanted rivers to ...


34

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 ...


32

Removing Islands I've done this sort of thing before in one of my games. To get rid of outer islands, the process was basically: First there must be a guarantee the center of the map will always belong to the main land, and each pixel starts out either as "Land" or "Water" (i.e. different colors). Then do a four direction flood fill starting from the ...


32

I have been able to come up with a few reasons myself, but I'd really like to hear more. Horizontal layout matches the layout of the keyboard. You could use WEADZX for movement, similar to WASD on square grids. On the other hand, I have also found suggestions that QWEASD is a natural fit for vertical hexes. Horizontal hexes seem to be better suited for 3D/...


29

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 ...


29

The way Dragons Abound identifies bays is to walk along the coastline and find two spots on the coastline where the straight-line distance between the spots is less than the distance along the coastline between the spots. This is the sinuosity of the coastline between the two spots. By selecting a sinuosity limit and limits for the straight-line distance ...


21

Amitp suggests using watersheds to define various regions, as explained in his post on polygonal map generation. The watersheds are best seen by generating a map using his demo. The advantage of using watersheds to help subdivide continents is that it provides boundaries perpendicular to the shoreline, while mountains usually provide parallel boundaries. If ...


21

I would go with vertical layout if you are using any sort of bird's eye perspective, as in the image above. Why? Because all walls will be visible. If you use horizontal layout, and you have walls that run along the vertical lines, you will not be able to make out details on them very well (such as doors or gates). Furthermore, if you are using the ...


19

There are two standard ways of doing this. Break up your non-standard tile sizes into standard tile sizes. So those strips of walls become a "stack" of square tiles that you just know to place together in your level editor. Games like the early Final Fantasy games worked this way. Let any tile piece be taller than your standard tile height. Align tiles ...


19

By playing it! Whether a game world is too big or small depends on a countless number of factors, including: How big the player is How fast the player moves How many other characters there are Whether the game is multiplayer The hardware capabilities of the target platform Your target audience How the save mechanism works (can I pick up where I left off, ...


19

You should use the D* algorithm, which is designed for this exact scenario. Specifically, the D* Lite implementation is the most efficient and simple variant.


18

First off, let me say that 2D RPGs are near and dear to my heart and working with old DX7 VB6 MORPG engines (don't laugh, it was 8 years ago, now :-) ) is what first got me interested in game development. More recently, I started converting a game I worked on in one of those engines to use XNA. That said, my recommendation is that you use a tile-based ...


18

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 if ...


17

You could use an algorithm that checks near blocks, and varies the probability depending on what is there - but I think it's largely the wrong approach. What you want to be looking at is fractal noise types - in this case, perlin or simplex noise. If you generate noise, you'll get values from -1 to 1. http://en.wikipedia.org/wiki/Perlin_noise You can then ...


16

I travelled in a lot of "hot" countries in the 10 last years and each time I went to elevated areas it was cold or very cold even when I was close to the equator. In fact elevated areas are semi-arid to arid. Vegetation is small (except some special species like cactus) and burned (by sun and cold). Most of the time, there is very little snow except at ...


16

Sounds like you're leaning toward horizontal as having more advantage. For what it's worth, bees agree with you when they build their honeycombs: The axes of honeycomb cells are always quasi-horizontal, and the nonangled rows of honeycomb cells are always horizontally (not vertically) aligned. Thus, each cell has two vertical walls, with "floors" ...


16

Layers are needed not only the most basic use of a tile map, but also allow more artistic expression and play features. Layers define the draw order of the sprites used in your world. They're simply a way to say, "Draw sprite X after sprite Y, so that sprite X will appear on top of sprite Y". They're typically generalized into layers so you don't need to ...


16

Requirements You want multiple paths from A to B. You want to work in grid space, presumably this is tile space for your side-scroller. You don't want paths to cross, or it will spoil game progression. You want the paths to look reasonably organic. Voronoi Diagrams Voronoi Diagrams are space-filling, planar graphs: One nice thing about them is how you ...


16

I think the Voronoi idea is a good one. Each star becomes a seed point for Voronoi, and then the Voronoi regions show the areas owned by each faction. However, there are some changes that will make it work better: As you mentioned, there are empty areas that shouldn't be assigned to a faction. Voronoi will create large polygons that extend out to areas ...


15

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.


14

Let's start with the array. Don't think about it as tridimensional. Indeed, if you want to have stackable units there, it makes sense at first sight: first dimension is collumns of rows of tiles second dimension is rows of tiles third dimensions is tiles, i.e. arrays of units. But this third dimension won't be consistent, as you will store there not only ...


13

To add to Dan Rasmussen's answer: One of the main reasons I switched from Perlin Noise (this project) to using polygons (this project) is that polygons provide some nice structure for assigning larger areas (political regions, forests, deserts, named areas, boundaries, etc.). Starting with the structure and then generating the map is similar to polygon ...


13

Some intuition: Step1: Randomize points-each time taking a step forward on the x-axis Step2: Imagine segments(lines) between these points, add new points in the middle of each one This is how it looks now without the segments: Step3: Draw bezier from red point to red point, using the original point as control. Step 4: Randomize new control point ...


13

If you are building a strategy game, the game requirements and design itself should dictate which orientation you choose. Note that defensive lines are more easily held with the grain than against it, so your choice of grid orientation relative to map orientation will affect game play. To emphasize defence, such as in WWI, align the hex grid with the natural ...


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