Advanced Procedural Terrain

Ok, actually this project doesn’t really have a title. I want to improve on my earlier procedural terrain (a.k.a. Claudia in Photoland) generator. The earlier version worked just fine, but I didn’t think that the results looked like naturally occurring terrain. The earlier version used simple math to distribute tiles on the map with a correlation to the x and y coordinates; meaning that certain zones would tend to have a higher probability of lakes, or grass or forests or whatever. Then I used cellular automata to clump the terrain together and finally developed a set of scripts to correct for certain “troublesome” geometric patterns, and assign a nice rounded tileset to the binary terrain values.

To create more natural terrain, I decided to play around with fractals to create a topographic height-map. I developed a set of scripts in Gamemaker to use the Diamond-square algorithm to generate height-maps. This then allowed me to generate tilemaps using certain elevation thresholds with the height-map. The result was a much more natural looking tilemap, however it could also create maps that would be unplayable, since the player could be blocked from entering certain parts of the map. This required me to develop a set of scripts to handle map analytics – basically to evaluate each complete map, see if there was a valid place for the player to start, that the player could reach map exits (I had envisioned an “exit” on the north, south, east, and west edges of the map). In evaluating each map, one of the key parameters was to see how many tiles would be contiguous to a certain type of tile, so I developed a flood-fill algorithm to do this. This, combined with the cellular automata scripts should be able to produce all “good” maps, although I have yet to set the exact parameters. Nevertheless the system works, and is modular enough to allow you to set the specific parameters to use when generating maps.


Speak your mind - here:

This site uses Akismet to reduce spam. Learn how your comment data is processed.