TerraGenesis Perlin
Posted: 11 Feb 2006 20:14
Here is the TerraGenesis patch with Perlin noise. It creates some really lovely terrains, and is a complete replacement for the current terrain generator. There is a new switch panel in the Configure Patches for "Terrain", letting you switch between the original and new terrain generator.
TerraGenesisP works in the Scenario Editor and the main "New Game" selection. I havent tried starting a new network game with it, but it should work there as well.
The terrain generation works off 4 main variables:
Random seed: TGP terrains are not truly random - but use a random seed between 0..65535. You can enter this directly, or press the "Random" button to get a new one.
Terrain Type: Very Flat - Mountainous. This sets the maximum amplitude permitted. Due to the way the Perlin noise is created, you may have a flat area for your mountainous terrain. If this is the case, try a different random seed.
Sea Level: Very Low - High. This raises or lowers the apparent sea level, and re-scales the land to match. Again, the Perlin noise generator may give you a massive ocean on "Very Low", or a mountainous plateau with no water on "High" (unlikely).
Smoothness: Very Smooth - Very Rough. This sets how much variation you will have from little variation, to many smaller variations.
I also include the Landscape type selection, and the map size dropdowns on the Landscape Generation screen.
The great thing about this in the Scenario Editor, is that you can keep the same random terrain but try it in SubArctic, Tropical, Toyland, etc. When you are happy with the terrain in the Scenario Editor, nip back to the main menu, and start a New Game with those terrain parameters.
Tropical has a special feature to ensure that some areas are desert. Starting at halfway across the map (diagonally), the maximum terrain height is reduced steadily (its actually a COSine wave), until the terrain is lower and flatter. This can have the effect of flattenning the only mountains in the map - I may add a ON/Off button for this feature later.
Also, as the randomness is predictable, you can "share" a map by just giving its seed number. Click on the blue seed, and enter a new number. Try it with the "8918" terrain in the example pictures.
Please Note: this code is still in development, and contains commented sections that will eventually be removed from the final patch.
Have fun with it. Please tell me of some really good terrains you find. (I like 55123 on a large map size - good variety of mountains and sea.)
[edit] Latest update, Mar 14, 2006. Much improved mountains and lakes handling, added map border randomisation. Pretty much there.
[edit] Mar 15, 2006: Further improvements on the coastline, bug fixes.
I have also changed the behaviour of the Desert terrain. It now produces a desert valley between two ranges of mountains (on mountainous/hilly). As usual, desert climate doesnt respond well to "flat" or "very flat", as the whole map tends to go desert.
[edit] further update: Added patch setting for "Max distance from edge for Oil Refineries". With the more indented / uneven map edges, it was finding it difficult to place the oil refineries. This lets you select how far from the edge they can be: range 12-48. (default 16).
Also made New Game pick a random number for the seed, but Scenario Editor keeps last used.
[edit] Mar 28. A few minor edits. Added ability to set random seed in config file. Also, if seed=0, TGP picks a random seed. Ideal for dedicated server.
TerraGenesisP works in the Scenario Editor and the main "New Game" selection. I havent tried starting a new network game with it, but it should work there as well.
The terrain generation works off 4 main variables:
Random seed: TGP terrains are not truly random - but use a random seed between 0..65535. You can enter this directly, or press the "Random" button to get a new one.
Terrain Type: Very Flat - Mountainous. This sets the maximum amplitude permitted. Due to the way the Perlin noise is created, you may have a flat area for your mountainous terrain. If this is the case, try a different random seed.
Sea Level: Very Low - High. This raises or lowers the apparent sea level, and re-scales the land to match. Again, the Perlin noise generator may give you a massive ocean on "Very Low", or a mountainous plateau with no water on "High" (unlikely).
Smoothness: Very Smooth - Very Rough. This sets how much variation you will have from little variation, to many smaller variations.
I also include the Landscape type selection, and the map size dropdowns on the Landscape Generation screen.
The great thing about this in the Scenario Editor, is that you can keep the same random terrain but try it in SubArctic, Tropical, Toyland, etc. When you are happy with the terrain in the Scenario Editor, nip back to the main menu, and start a New Game with those terrain parameters.
Tropical has a special feature to ensure that some areas are desert. Starting at halfway across the map (diagonally), the maximum terrain height is reduced steadily (its actually a COSine wave), until the terrain is lower and flatter. This can have the effect of flattenning the only mountains in the map - I may add a ON/Off button for this feature later.
Also, as the randomness is predictable, you can "share" a map by just giving its seed number. Click on the blue seed, and enter a new number. Try it with the "8918" terrain in the example pictures.
Please Note: this code is still in development, and contains commented sections that will eventually be removed from the final patch.
Have fun with it. Please tell me of some really good terrains you find. (I like 55123 on a large map size - good variety of mountains and sea.)
[edit] Latest update, Mar 14, 2006. Much improved mountains and lakes handling, added map border randomisation. Pretty much there.
[edit] Mar 15, 2006: Further improvements on the coastline, bug fixes.
I have also changed the behaviour of the Desert terrain. It now produces a desert valley between two ranges of mountains (on mountainous/hilly). As usual, desert climate doesnt respond well to "flat" or "very flat", as the whole map tends to go desert.
[edit] further update: Added patch setting for "Max distance from edge for Oil Refineries". With the more indented / uneven map edges, it was finding it difficult to place the oil refineries. This lets you select how far from the edge they can be: range 12-48. (default 16).
Also made New Game pick a random number for the seed, but Scenario Editor keeps last used.
[edit] Mar 28. A few minor edits. Added ability to set random seed in config file. Also, if seed=0, TGP picks a random seed. Ideal for dedicated server.