1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

[Map Script] Planet Generator

Discussion in 'Civ4 - Map Scripts' started by Nercury, Aug 5, 2006.

  1. Nercury

    Nercury Warlord

    Aug 5, 2006
    This map generator is capable of producing very unpredictable map shapes, while keeping continent count, separation, size in control and somewhat balanced.

    New version 0.68 released!

    - continents should no longer break in several parts
    - islands!
    - custom map size, continent scattering
    - works with Warlords, Beyond the Sword
    - mac support

    Installation: extract archive to:
    My Documents -> My Games -> Sid Meier's Civilization 4 -> PublicMaps
    My Documents -> My Games -> Warlords -> PublicMaps
    My Documents -> My Games -> Beyond the Sword -> PublicMaps

    Map options:

    Map size override
    - No override: use standard selection (duel, tiny, huge, etc.)
    - Otherwise use specified size up to 256 x 160. All sizes have aspect ratio of 1.6.

    From one huge Pangaea to 18 continents. If continent distribution is set to "Smart Selection" it will make best choice to make those 18 continents fit even into duel map. However, it is not like archipelago, but if you want something close to that, decrease continent separation to 1 square.

    Size of every continent depends on how many players will be in it.

    Continent separation
    How many water tiles should separate continents. 3 is default. Select 4 for late civilization contact.

    Continent distribution
    New setting. Currently you can:
    - force each continent to have at least one square on equator (if thats not possible, maps size is increased to make them fit)
    - make continents to be aligned in two or three rows
    - make continents to be aligned to center (this is especially cool with 3 - 5 continents)
    - use Smart Selection to make algorithm choose predefined way of distribution for selected amount of continents and map size

    Continent shape
    From "Snaky" which spreads across the map to almost round one.

    Continent scattering (new)
    Controls continent scattering, and coastal line smoothness.
    - solid, no islands around: this is the same as was default behavior before version 0.50, solid continents
    - rare small islands: less round edges, more lakes, maybe some island near continent
    - common islands: this option ensures evenly distributed islands around every continent.
    - many islands: more scattering
    - archipelago continents: this is option for fun (or pain) - i suggest disabling one-tile islands before starting :)

    Percentage of ocean
    - From 30% to 70%.
    - Minimize ocean size: algorithm tries to grow continents as long as possible.
    If you select very low percentage of ocean, generation time increases dramatically.

    Land near pole ice (new)
    Before, it was always possible to sail around any continent, because continents could not reach pole ice. Now, this can be changed with this option.

    Lonely islands (new)
    Controls how many islands are created in empty ocean space. This option is affected by Ocean percentage: the higher it is, the more space for lonely islands.
    - Use every empty area in ocean: this option means that algorithm will do it's best to fill empty space with islands.
    - One island somewhere: creates one island somewhere, if there is space for it (usually there is, except maybe for duel maps with big islands selected)
    - No islands

    Lonely island size (new)
    Controls size of islands. Size is computed the same way for any map size.
    - Small: useful if there is some resource
    - Medium: for one grown up city
    - Big: varies from 1 to 3 cities

    Allow one tile islands (new)
    When "No" is chosen, all one-tile islands are removed. Select "Yes" if they do not annoy you

    Mountains (peaks)
    Controls peak distribution and grouping. Peaks should not block any terrain sections, except maybe for "extreme" setting.

    Same distribution options as for peaks.

    Climate variation
    Climate variation controls how different climate is near poles from equator.

    It controls amount of forests, jungles, and flood plains.

    Equator temperature.
    - If you want almost same climate for all map, select such temperature for equator and set climate variation to "soft".
    - It is possible to generate very cold map, which would be real challenge to play :). Well, if you want to try that, increase amount of flood plains, that should help :)

    Flood plains
    Controls amount and distribution of flood plains. Now there is "standard placement" setting, which is meant to make flood plains like in standard generators. There are additional flood plain modes with more of them on snow, desert and tundra, or near oceans.


    Override map size: 160×100
    Climate variation: Soft
    Humidity: Normal
    Equator temperature: Cool (light jungle, no deserts)
    Continents: 9
    Continent distribution: Around center
    Continent shape: Unpredictable
    Continent scattering: 3 - 6 (common islands)
    Lonely islands: Use every empty area in ocean
    Percentage of ocean: 70%

    Size: Standard
    Climate variation: Soft
    Humidity: Normal
    Equator temperature: Cool (light jungle, no deserts)
    Continents: 7
    Continent distribution: Two rows
    Continent shape: Unpredictable
    Continent scattering: 1 - 3 (rare small islands) (default)
    Percentage of ocean: 60%

    Size: Huge
    Climate variation: Soft
    Humidity: Wet
    Equator temperature: Normal
    Continent shape: Unpredictable
    Continents: 2 continents
    Ocean: 70%
    Continent islands: 1 - 3 (rare small islands)
    Lonely islands: 50% of empty area

    Known issues:

    - If you select random continent amount, that random amount does not change if you regenerate map. Same thing happens for continent separation, climate variation, and temperature. This is called "First Time (FT) Random" in options.
    - Generator so far uses standard methods for adding resources and bonuses.
    - Generator uses heavy optimizations (heavy for RAM), but generation can still take long for huge maps / many continent maps / low percentage of water maps.

    Versions (for both mac and windows):
    Latest version: 0.68

    Download version 0.68 from file database
    Download attached file:

    Attached Files:

  2. Nercury

    Nercury Warlord

    Aug 5, 2006
    v. 0.68
    - Coordinate system changed to circular for continent growth calculation (faster, not so blocky shapes)
    - Continents should no longer break in several big parts (except with "archipelago continents")
    - Bug fix: the lonely islands are all devoid of hills or mountains

    v. 0.67
    - Further improvements for mod map size support: now can understand completely customized sizes

    v. 0.66
    - Mod map size support

    v. 0.65
    - Many feature generation tweaks
    - More forests or jungle (jungle depends on temperature)
    - More flood plains on deserts
    - More oases, better oasis placement
    - Flood plain "Standard" generation options reduced to one
    - Desert maps should be more interesting now
    - Forests and jungle can start growing not only near water, but also near peaks which do not have many features around

    v. 0.64
    - Random float number bug fix

    v. 0.63
    - Bug fix: generation failure with high continent scattering and distribution around center

    v. 0.62
    - Resource normalization fix (it was disabled all the time!)

    v. 0.61
    - 4,5 island option bug fix

    v. 0.60
    - Continent scattering improved, all options thoroughly tested to produce good-looking maps.
    - TileBuilder code improved, to avoid continent jams.
    - Generation failure bug fixed. Hopefully, it will no longer stops at start.
    - Random (Standard:Rare/Common) flood option fixed.
    - New option: Map size. It is now possible to specify custom map size, up to 256×160. Because of this change, following options are modified:
    - Continent separation options expanded up to 10 tiles.
    - Distance from poles no longer depends on continent separation, and is always constant (3).
    - From now on, area for continent separation is excluded from ocean area when calculating ocean percentage. It means that selecting higher continent separation now will produce less land. This helps against continent jams.
    - Lonely island selection options improved, now it is possible to specify exact amount of islands (1-5), but they will be placed only if there is enough empty area in ocean.
    - Default lonely island option changed to 3 islands.
    - Default option of removing one-tile islands changed to "yes".
    - Humidity options tweaked, now "normal" is a little bit more wet.
    - Land near pole ice default value is now "sometimes" (i think that looks better)
    - Fixed typo in options

    v. 0.53
    - Desert tile changing into plains (if jungle nearby) chance reduced from 100% to 60%.
    - Rewritten continent scattering algorithm. Changed name from "Continent Islands" to "Continent Scattering", because, well, it's what it does.
    - Island separation now is the same as continent separation.

    v. 0.51
    - Continent islands option fix.

    v. 0.50
    - New options added: Land near pole ice, Continent islands, Lonely islands, Lonely island size, One tile islands allowed.

    v. 0.47
    - Smoother transition from jungle to desert/tundra.

    v. 0.46
    - Both Mac and Windows support in one file. Thanks AlanH for writing code for mac!

    v. 0.45
    - Oasis.

    v. 0.44
    - Fixed continent distribution bug for high continent count and huge map.
    - Added more ways how continents can be distributed: you can choose old rule with square on equator, two or three rows, circle. Even more, i added option Smart Selection, which will choose the best distribution method for selected continent count and map size.
    - Flood plains now have default "Standard" distribution, which makes them appear only on desert, some on tundra and only near fresh water.
    - Redefined what "natural" continent means. Now it is much more concentrated landmass with possible peninsulas or inland seas, not snake starting in the middle and ending near poles :)
    - New landmass generation templates added - Natural, Crab-like, Smooth sides, old natural renamed to Traveling Natural (because it travels a lot from starting square).
    - New "Smart Random for each continent" shape selection which almost ensures that you will have playable and unpredictable maps with different continent and map size selections
    - Added a lot of comments to script code
    Things to try out:
    - New Crab-like continent shape for Pangaea map

    v. 0.43
    - Tested with Warlords: works
    - Emergency fix: Grid size function was rewritten incorrectly, making map height higher than width ;)

    v. 0.42
    - Last user choices are now remembered
    - Tested with Total Realism 2.0, Fall From Heavens 2.014, SevoMod 3.1
    - Modified hill intersection function (produces more hills close together)
    - Grid size function is now written correctly (compatible with "very huge" map size mode (if there is such in some mod))

    v. 0.41
    - Some adjustments for humidity
    - Fixed some mistakes in options
  3. fenceman

    fenceman Chieftain

    Jan 27, 2006
    Nice work! I'm gona try this out
  4. Nercury

    Nercury Warlord

    Aug 5, 2006
    LOL, you probably have downloaded broken version and now are playing in narrow map :D. I should not leave such bugs...
  5. fenceman

    fenceman Chieftain

    Jan 27, 2006
    I started one game with it in warlords, looked at the map, then went back and started another one with different settings and got a popup

    Fatal Error
    Memory Allocation failure - exiting program.
    Reason: bad allocation

    I'll try downloading the new version
  6. Nercury

    Nercury Warlord

    Aug 5, 2006
    This means that program ran out of memory.

    How many continents, what continent separation, and map size was selected?

    Edit: yes, that could be because of enormous grid height in bad version...
  7. fenceman

    fenceman Chieftain

    Jan 27, 2006
    Civs: 18
    Size: Huge
    Continent shape: Random for each continent
    Climate variation: Normal
    Temperature: Normal
    Humidity: Normal
    Continents: 4

    I restarted the game and downloaded the new version, now its working fine
  8. GarretSidzaka

    GarretSidzaka Deity

    Dec 17, 2002
    whoa! this has some truly amazing potential. Im keeping my eye on this one
  9. Lars_Domus

    Lars_Domus Say No 2 Net Validations

    Dec 30, 2005
    This is some really promising stuff! I'm not crazy about the way floodplains are generated in all kinds of terrain (but that might just be me using the wrong settings), but I love the unpredictable shape of the continents. Also the climate variation and humidity settings are great ideas. If you make this script a little more customizable, SmartMap will have a worthy competitor on its hands.

  10. Nercury

    Nercury Warlord

    Aug 5, 2006
    Now i am remaking climate generation, i am going to make forest and jungle amount controlled the same way as flood plains, and will leave humidity control mostly for terrain type.
  11. Jasconius

    Jasconius Chieftain

    Jan 4, 2004
    Albuquerque, NM, USA
    I think this script has some good potential as well! There are a couple of things I'd like to suggest to improve it.

    First, there needs to be an option where you will only find flood plains on deserts next to rivers, just like in the normal map generators. Any other setting is just ridiculous IMO and it makes it so I can't actually play on these maps yet. Getting squares like plains/hills/flood plains with silver on it next to your starting city is an automatic ticket to win.

    Second, although I reallly like the idea of all of the continents having to have a square on the equator, I think it makes the shapes of the continents very extreme in a lot of cases. I think you should expand the zone in which that square has to be, so a continent just has to have a square in the tropics somewhere, guaranteeing that it will at least have a little bit of tropics and definitely some temperate climate somewhere on it.

    Keep up the good work!
  12. mcguffin

    mcguffin Chieftain

    Aug 15, 2006
    Very nice script.
    I really love the maps generated. and its really fast, comparing to other script around.

    Anyway, are you planning to add some bonus distribution options?

    There is a thing i would like to find: the possibility to say if a continent (or little island maybe for later) will not be populated at start.

    For example, lets say 9 civ, 4 continents, but spawn only occurs on 3 continents.

    sorry for my frenchy english ;)
  13. ollj

    ollj Warlord

    Nov 21, 2006
    You make circumnavigating the world really a challenge.
  14. taltho

    taltho The Essoteric Copious

    May 24, 2003
    This is a realy awesome map script, Nercurey.
    I tried it out and I realy like it, but I cant seem to have 18 or even 10 continents with a smaller map size.
    I was going for a heavy Argapalego type map on the small setting.
    this script only alows 2 or 3 continents for a small map. Is this somthing you did on purpose?
    I like the way you added flood planes I live in the desert now and we have them here in places due to ground watter saturation. Thanks for this script I'll use it allot.
  15. Nercury

    Nercury Warlord

    Aug 5, 2006
    It's nice to see that this script was usefull for someone :)

    Sorry, i have not played civ4 for soo long, so there were no updates and no replies from me... Now i am installing the game again, just to see if my script still works :)

    Thats easy to do, i will look into it. I just have to remember what i wrote in that script :D

    And the main case is when continent count is big.

    Look at this this way: 18 continents, each has square on equator, continent separation - 3 squares (default), that is 18 * 1 + 18 * 3 = 72 square width. Also, the more continents, the more additional space is added to required map width.

    EDIT: heh, i found possible cause of this - i am increasing map size if i find that there are too many continents. Also, map size is increased when:
    if ((continentSeparation * 2) + 1) * continentCount > MapWidth:
    thats (3 * 2 + 1) * 18 = 126 squares required. Maybe thats too much...

    However, since i can choose starting squares as i wish (keeping right separation), i can use some other method for it. Maybe placing them in two rows which are near equator would do...

    LOL, even "Natural" continent shape in my script is quite drastic compared to standart generators, also i gave smaller chance of "snaky" continent when you choose "random for each continent" shape.

    I noticed that "snaky" continent setting is better for smaller maps and "Natural" is better for huge ones. Thats because snaky can become longer when there is more room for it to show all that snakyness.

    Algorythm is quite simple: when continent is growing, there are "builder" tiles near continent edges, and new tiles can be added only near them. For "snaky" continent type there are lower maximum of "builder" tiles, therefore less tiles near edges which can generate new tiles.

    There are also additional parameters of how many tiles "builder" tile can generate before becoming normal (GrowCount). All new generated tiles become "active" tiles and new "builders" are chosen from them randomly. There is maximum number of "active" tiles too.

    So, after my "TileBuilder" class was finished, i just played with those three parameters (builder tiles, active tiles, grow count) alot to find best look/performance combination for different map sizes. For example, when you choose to generate "Natural" continent shapes, actual shape is chosen from two templates randomly, because i could not decide which is better and added them both. Snaky continent type has low active tile count, and one builder tile can add only 2 new tiles (in natural mode - 4), and "snaky thin" - only 1.

    I was able to get very veird shapes by choosing interesting numbers of builder tiles or active tiles, but tried to keep only best of them in script. For anyone interested, there is "TileBuilder" class in my script, which can be used to grow any amount of continents starting at any location simultaniuosly.

    I just felt like posting that info :)
  16. Nercury

    Nercury Warlord

    Aug 5, 2006
    So far spawn is controlled by default code, and changing that requires some research ;). however, what i especially want to change is the way player distribution is handled - especially human player. When continent count is, lets say - 5 and players - 6, human player will always start with AI in the same continent.

    Well, the reason why i have not touched it yet - i am not "hardcore" civilization player and i dont want to screw balance because of lack of knowledge about resources and how player start position relates to them. Damn, i haven't even spent enough time to figure out on what tile type flood plains should appear, and instead "invented" something... ;)
  17. Nercury

    Nercury Warlord

    Aug 5, 2006
    New version released - see changelog and first post for details.

    New things:

    Crab-like continent shape for interesting pangaea maps:

    Now you can align continents around center:

    Improved continent distribution: now it is easy to fit 18 continents to any map :)
    Standart map with distribution around center, 40% water, 1 square separation:

    Small map with Smart distribution, 60% water, 1 square separation
  18. Sine Nomen

    Sine Nomen Chieftain

    Dec 22, 2004
    You've done great work with generating continents - varying landmasses that look as if they were formed by millions of years of tectonic shifting. However, the script seems to suffer from the same problem as most in that it generates inconsistent splotches of desert right next to grassland and jungle at the same latitudes. This does not happen in nature, and takes away from an otherwise great script. I would suggest that you at least add the option to have solid Sahara (or at least Kalahari)-like deserts, i.e. not broken up every few tiles by plains and grassland (or even worse, jungle!). Amazon-style jungles would be great as well. Attention to where these are placed on the map would also set the script apart - that is, have deserts fall more on the western side of continents, as in Africa and South America, with jungles in the east. This may be beyond the capacity of map scripting for Civ4, but please give it a shot if you can! It would be wonderful to have a script that can generate something unpredictable but still passably-earthlike in its features. Good work so far
  19. Nercury

    Nercury Warlord

    Aug 5, 2006
    There was great deal of thinking and tweaking when I was making this script, and I also had similar thoughts. However, there are not too many plot tile types for Civ4 and no high terrain detail, only squares. So there is lots of balancing between playable map and realistic map.

    Also, questions. Does certain latitude means that there should be jungle in this tile? No. Does certain temperature means that? No. Maybe humidity? Well, its product of all of these factors, and I have spend lots of time trying to make sure that most maps are fun to play. However, if you choose some setting far from one marked "recommended", you may get cool, but not necessarily playable map.

    Ok, I will try to remember the way the map is generated, so you would see what settings could produce better maps.

    First pass - continent shape generation. Finding best positions to place them, choosing generation algorithms, ensuring ocean percentage, continent separation, stuff like that.

    Next, land surface is created for each tile based on Equator Temperature and Climate Variation. Softer Climate variation makes temperature near poles closer to equator. So, after this step, land surface is laid out as: Desert, Plains, Grass, Tundra, Snow. There is no jungle in this step.

    Third step - features are added. Features are: Ice, Jungle, Oasis, Flood, Forest. Every feature has different possibilities to appear on different tile types. Possibility is measured by "luck points", features have "luck points" to appear on different tile types, all of that is based on settings. Those "luck points" are taken into account when choosing what particular feature place on certain tile. Lets see jungle as example:
    - If plot tile type is desert, +1 point for jungle
    - If plot type is grass, and tile temperature > 20, +2 jungle points
    - If terrain is not tundra and not snow, then,
    -- If tile temperature > 19, +2 jungle points
    -- If humidity > 0.8, +2 jungle points
    Now every feature has similar list, and they compete against each other for every plot. Winner is chosen randomly, based on their chances. Also, sometimes feature modifies plot type when placed, for example, jungle changes desert plot to plain or grass (again, based on chances).
    Also, I have not mentioned, but this step does not generate features for all tiles, only for some of them. So result of this step: some lonely features placed randomly on map.

    Finally, making features to spread to tiles nearby, and when they do, they can spread even further. The further away feature travels, the smaller it's chance to travel becomes. Let's see how jungle does that:
    - Generally, features are stopped by mountain peaks and ocean.
    - +1 "luck point" is added if tile nearby is flat.
    - +1 point if tile is plains and it is not on the other side of the river.
    - +2 point if tile is grass and it is not on the other side of the river.
    Again, jungle competes here against other tile types, usually forest.

    From this point, generator switches to default Civ4 generator, which does the rest.

    Well, I hope this is enough explanation why I can't simply "fix" it. But if you don't mind peaks, you can increase amount of mountains and see if they do group certain features together more often.
  20. Nercury

    Nercury Warlord

    Aug 5, 2006
    After reading your post again after replying ( :rolleyes: ), i see that my reply does not help much... Of course i can add more chance to spread on lower latitude, but well, at cost of some balance (if two continents start on equator, one goes up and other down, one player ends up with desert, another with jungle). Well, I will see what I can do, haven't played civ for a while.

    And, by the way, I think that sometimes the most "unrealistic" creatures and places already exist in real world, but we are just used to them :)

Share This Page