#### Archived

This topic is now archived and is closed to further replies.

# Civ, Civ2 Style Land Generation

This topic is 5587 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hey all, I''m interested in something like Civ and Civ2 land generation. (When you choose "Random Land"). Basically, something that resembles a planet, and has blotches of water, rivers, mountains, desert, snowy plains, grass plains, etc. Anyone know of articles discussing how they did it or a similar method of doing it? Thanks a bunch.

##### Share on other sites
Guess theres a reason I haven''t been able to find anything. *chuckles*

##### Share on other sites
There is information about what your looking for in isometric game programming with directx 7. Other then that I dont know where to look on the net.

##### Share on other sites
There are really many, many ways to do it.

I''ve played around with a few, and the method you use can depend on a number of variables. The one that I found worked best was using a number of randomly generated maps, each with a specific purpose.

If I remember correctly they layers I used were Elevation, Water Table and Temperature. The Elevation map and Water table map were generated using a fractal-based pattern. (Actually I don''t think it was fractal based, I think I used a Fourier transformation, because it ensured that the map was tile-able (the bottom and top edges matched, same with the left and right))

The temperature was determined by taking a base distribution (hot at the equator, cold at the poles) and combining it with the elevation map so it got colder at higher elevations.

Each of the above tables would range from -1 to 1. The final map, which contained terrain info was generated by combining all three of the above maps. For example:

If a given tile had an elevation < 0 or a water table value > 0.8 it would be a water tile.
If the temperature was < 0 and the water was > 0.5 it would be an ice tile.
If the tile had temperature > 0.5 and water > 0.3 it would be a jungle tile.
etc.

This allowed me to tweak the settings easily by storing terrain information in a simple format. The end result generated some okay looking worlds, and was very flexable for adding new terrain types.

##### Share on other sites
There are two approaches that are worth trying that I can think of (even at 2:30 AM).

1. Simulate plate tectonics. Start with a huge Pangaea continent (just make some sort of big contiguous continent). Then make some lines, and have the plates formed by the lines move in different directions. Where two lines approach each other, mountains form. Where two plates move away from each other, seas form. If what used to be sea raises in elevation, it becomes a desert. Stuff like that. (pretty sure Civ *doesn''t* do that, but if you just want to be able to do something like Civ, it should be okay)

2. Just generate the features you''re looking for. You want continents? Make a random closed loop, and fill in with land. You want archipeligos? Use a dotted line and add some randomness and make islands wherever the lines fill in. You want rain on the west side of a mountain to be greater than on the east side? Just detect each mountain and increment the rainfall on the west and decrement on the east side. If plains tend to be large stretches, just make sure that contiguous flatland is all one type. Snow happens on the north and south. If you''re feeling particularly ambitious, you can simulate the oceanic currents, and determine the temperature from that.

##### Share on other sites
I did that a while ago for a vb game. I tried many different ways but the simplest way to generate continents is (I think) the following way:

Begin with every tile water (say value 0). Then set an x number of tiles to land (x being roughly the nr of continents you want). Now you loop through your map array and when you find a tile with a land tile next to it give it a certain chance to become land or water (not looking if its land or water). Ofcourse, give it a bigger chance value for becoming land. Also give it a small chance to become water (makes the terrain rougher and forms lakes and small islands. Dont set the chance value for water too high or your land will become filled with water gaps).

This is just a really simple method but it worked for me

##### Share on other sites
For my RTS engine I''m using a simple terrain generation system which uses a height map and rectangular regions.

It creates large continent sized blocks of land using simple rectangles then with a smaller block size it smooths the edges, adds islands and creates peaks. Theres varying colour relative to the sea depth, varying colour for the height depth with snow above a certain height.

I''ve included a link to the example so you can check it out (EXE & source). Its written in Visual Basic as its only a testbed.

Hope it helps

Terrain Testbed

##### Share on other sites
There''s an open source civ clone called freeciv that you could check out for ideas. I wouldn''t recommend just ripping their code wholesale but it''s a place to start and get some ideas.

1. 1
2. 2
3. 3
4. 4
5. 5
Rutin
18

• 11
• 12
• 9
• 12
• 37
• ### Forum Statistics

• Total Topics
631420
• Total Posts
2999990
×