🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Creating random maps

Started by
5 comments, last by BennyJensen 24 years, 5 months ago
Hi. I need a way to create random maps for a tile based game. The tiles I''m using are ocean, grasslands, mountain etc. I tried using a simple fractal algorithm that generated a height map, that I converted to a tile array. It looked ok, but I didn''t find any way to generate a map with several larger islands for instance... I also ran into problems when trying to add forests to the map, etc. Any ideas or algorithms would be greatly appriciated. I tried using alta vista to search for some, but didn''t find any.
Advertisement
I''m sorry that i don''t have any ready code to give...
First of all you should set some diffirent themes first i randoms the theme which may be islands&grass, forest&grass, island&forest&grass, then (of course you have code to create solid water) then you make object which tests if there is more than 2 to 4 tiles of water/grass: build island which is 4*4 to 8*8 plus borders(which makes it look like island) (=) water, (") grass, (A) forest, same tactic should work with forest
""======""====""""AA
"======"""""=="""AAA
A""===""4x4""=""""AA
AA""==""area"===""""
A"====="""""====="""
""======"""=======""
I have a random map generator that I wrote for Turbo Pascal 5.5 back in 1989. It works pretty decent. It lets you select a certain number of seed continents and a percent land mass and lets you juggle the percentages of trees, lakes, rivers, deserts, valleys, hills, and mountains. It then creates a map of the size you specified (basically any range you want, within reason of all ocean cells then it picks a random spot on the map for a continent and grows a continent from there using a random movement algorithm that is optimized to create a semi-uniform landmass (it also has an input you can modify to create loose or solid landmasses). Once the landmass has grown to an adequate size to approximate the total land mass specified divided by the number of continents requested, the program then picks another random location on the map and grows another continent there, etc. It then cleans up the map a few iterations by going through the whole map and removing any single cell (or loosely connected) land or water masses. That''s how it creates the land masses. If you want more info (about doing the trees, lakes, deserts, mountains, etc.), I''m open to more questions. The maps generated with this program are currently in use on Artifact (http://www.samugames.com/artifact). I''m going to post the code to the map generating program soon so that maybe someone can learn from it or maybe even clean it up a bit (it''s pretty simplistic in the display department...).
One approach is to use the fractal generator to create a base. Then applying a few random pixel blobs as attractors, and dumping the whole thing into a cellular automata running "brain" or "vote" for a few generations 2-10. The result is usually several well formed land masses with reasonable coast lines. The jaggedness of the coastlines depend on the number of iterations of the cellular automata.

Then you lock in the pixels that form the land masses and then randomly seed the land points with various terrain and run a new cellular automata with "brain" and generally you get a reasonable set of terrain.
Could you perhaps expand on what you mean by "brain", "vote" and "cellular" forms of terrain creation? Where could I find more information about this?
By using cellular automata I mean using the results from the fractal generator to seed an grid-based artificial life type function.

Each generation of artifical life looks at a cell (pixel) and the values of the cells around the cell to generate a new value of the cell for the next generation.

"Brain" and "vote" refer to specific rules to specify the new value.
"Brain" with only two states of cells maps 0-3 or 5 live cells to dead cells and 4 or 6-9 live cells to live cells.
"Vote" is simple majority rules.

If x is a live cell, in the following diagram the middle cell would become live under brain, but stay dead under vote. This has the effect of smoothing out the terrain.

0xx
x00
0x0

You can do a search under Artificial life or Cellular Automata to get more information.
Thanks for the outline -- now I have some new keywords to search for

This topic is closed to new replies.

Advertisement