[WORK IN PROGRESS] Map Generation, Climate

Isabelxxx

Prince
Joined
Sep 26, 2010
Messages
399
This is going to be a long term project I have in mind. I have already added some functionality to DoaNE which should be available in the next version by adjusting feature placement according to some parameters but this will be totally different.

Probably some of you have played with PerfectWorld2 or FairyWeather mapscripts (scripts which will be integrated in DoaNE for future versions):


PerfectWorld2
http://forums.civfanatics.com/showthread.php?t=310891#

There is also an utility I want to mention:

MapScriptTools
http://forums.civfanatics.com/showthread.php?t=371816#


MapScriptTools.py provides functions and classes to:
- easily adapt maps for mods
- add Marsh terrain
- add Deep Ocean terrain
- make the map looking prettier/more realistic
- add special regions to the map
- replace and expand BonusBalancer (from Warlords)
- manipulate river creation: (starting from lakes, on islands)
- handle starting-positions for teams
- print various sorts of maps to the log file for testing
- print stats about mod and map
- find the path for Civ4, Mod or Log files
Also included are several maps using these new features.


The utility that pretty does it all... currently I have been implementing all the code in a way that any mapscript or map which uses standard feature generator will benefit of the new features. As you note this utility does exactly the same so I will probably port some of the functionality to DoaNE.

I especially like the debug features that will allow me to know how the map features are working.

Well, what's my aim? Introduce a dynamic map generation based on climate and realistic parameters to generalize what the previous map scripts have done to ALL maps.



 
Why improve map generation for COL?

  • All Col parameters are hardly bound to map characteristics, but it's not "so obvious".
    The best way to start from scratch a modification of some parameters like feature placement (jungles next to desert???), logical AI city placement, native professions & their resources for trading, etc. would be by assuring that the base is working as it should be.​
  • It looks good, it plays better.
    At 1st it is more pleasant to play a game in any of the previous map scripts that in standard ones. Then you can easily notice that more variety in map generation does not only looks good but is better in game-play terms. Continents (caribe for ex.) seems to be easier to handle for the AI than small isles and tiny land regions...​
  • Better Terrain, Resource and Features placement.
    The worst thing about the current map generation is balancing. You can not really balance a mod for for every map included and therefore you have to put a limit in what you want to do and what is not "really necessary".
    How can I really modify AI city placement to put their colonies in a logical way if there is not any logic in map generation? Maps seems to lack a "continuous logic" in the terrain and features placement.
    Then you have to adjust food and production to make things working. The better the terrain is placed the easiest will be to implement the balancing of these things.​
  • Give alternate solutions to current historical inaccuracies.
    Native placement for ex. would be limited to some regions according to latitude, civilization, terrain, etc.​
  • Expand the limits of Colonization Modding
    Think about the previous features. Then, what would happen if I want to include Asia colonization to the game? It sill be mixed with all the current features and will not look good at all.
    What about breaking that limit and tell the game what to use and when? We could have a possibility to have some civilizations, natives, features, etc. according to the map we have generated and configurable options (!)
    You want to play a world map with REF cities in game, ok. Then the mod will be adjusted to play that way.
    You want to play America maps as you have always do, ok. Then the mod...
 
This is a list of my aims and things open to discussion as well as some type of brief explanation about how I will be working on it.


DoaNE implementation


  • Hybrid implementation: ad-hoc or core?
    Maintain compatibility with all map/map scripts which use the default generator can be tricky but doable. But I have in mind that I could want to expand this...
    I'm not really sure what would be better.

    For ex. I plan to add climate features to maps; the way to do it is easy. Check all the existing plots in the current map and work with all that grid. Then modify the existing map to match the climate map generated in a logical way.

    But it could be done from the start, by modifying the terrain generator to create -while placing the terrain tiles- something according to a climate patron.

    Be aware that the 1st will be slower (it is done after map generation) but ensures I can make it work in all the cases. Changing the vanilla core will be done in some parts but not like the 2nd way. It would be faster, easier (much easier) but then there would not be any reason to do that. Just create a new map script with that...

    I need ideas here.
  • C++ or python (or both) ?
    I'm currently working on python but I still consider port some or all the functionality to the DLL.

    Things to consider:
    -Faster, faster, faster... if I add new features ad-hoc it will be more pleasant to make it as fast as it can be.

    -Would C++ be a benefit? Obviously python is much easier to handle... even porting functionality to the DLL (mostly calculation and iterations) I would want to have most part exposed in python files. Again, some type of hybrid working here...

    -I plan to do things like iterating over all plots, obtain some info, store it in a multidimensional "matrix" 2x3x4 -or something like that-, move some type of operator over that grid, normalize values, etc. It doesn't look good, but it can be greatly simplified...​

  • Climate Maps (grids)
    As already noted, the idea will be to create a realistic map of the climate of the current map. It would take all the necessary info for all the plots, calculate some values according to those plots and create the starting climate map.

    Then: 1) Transform it to user's desires according the options. OR/AND 2) Work with the starting climate map to make a realistic climate map and then apply the new climate map over the old map. In other words, adjust the terrain and features to be compatible with the new map.

    What would be climate maps? How many maps?

    Height maps would be the 1st to consider. It would control Peaks, hills, and land placement.
    Humidity maps. Features placement and indirectly resources.
    Temperature maps. Features placement and terrain. Along with the previous one, they would recreate a continuous placement of forest, jungles, deserts, etc.

    Secondary maps or other variables:
    Rain?
    Lakes placement.
    River placement.

    How would they be implemented?
    Grids, grids and more grids stored in lists.
    I need to consider a "good" way to move over the grid some type of calculation, normalize values, etc.
    Then I would need to consider what would be the size of the grain, and the shape: circular, diamond, variable, etc.

    Imagine the temperature map of the Earth. At 1st approx it can be considered as constant... then you can use some type of variation from that medium value... then you can go further and divide it into regions and calculate medium values for each region.... etc.

    Finally I would want to consider overlapping maps. Smooth transitions between maps requires by definition overlapping maps in the global chart.
  • Climate Maps (grids)
    As already noted, the idea will be to create a realistic map of the climate of the current map. It would take all the necessary info for all the plots, calculate some values according to those plots and create the starting climate map.

    Then: 1) Transform it to user's desires according the options. OR/AND 2) Work with the starting climate map to make a realistic climate map and then apply the new climate map over the old map. In other words, adjust the terrain and features to be compatible with the new map.

    What would be climate maps? How many maps?

    Height maps would be the 1st to consider. It would control Peaks, hills, and land placement.
    Humidity maps. Features placement and indirectly resources.
    Temperature maps. Features placement and terrain. Along with the previous one, they would recreate a continuous placement of forest, jungles, deserts, etc.

    Secondary maps or other variables:
    Rain?
    Lakes placement.
    River placement.​
  • Future uses apart from map generation

    Imagine we add storms, hurricanes or features that work in a similar way. There is no need to complicate things if you only add that but what If we have this climate system already working?

    Many features in game could be related in a direct way to these climate maps.

    For ex. resource plantations, storms, events, etc.

    Note that the most important thing is that I want to create the base which should help the AI and the player in understanding how the map is created. Some additional features could need AI programming, these are the future possible applications and I really don't mind about the problems because I'm only discussing the base. Then in can be made as complex as we want.


    [REALLY INCOMPLETE LIST OF HOW THIS SHOULD WORK, I WILL EXPLAIN MORE AFTER VACATIONS]
 
Working on a new system which allows to override the default Europe Tile Placement. (in DLL)

This is done via python (mapscript), something which a new map called earth31 in next release of Doane will show.
(Europe tiles will be in the poles instead of the east/west).
 
Implemented DOANE Set Map Python functions:

Allow map scripts (or any other python file) to set some hardcoded map options as default
setWorldSize, setClimate, setSeaLevel

You can now force a map script to use a preferred worldsize type by default, and not only the map size. So if for some reason your map can only be player with sizes over huge, for ex., you can avoid any size below that minimum!

Note previously it was not possible because a map script only let you handle the map size, but not the worldsize type (which contains other variables as immigration or num players) which would be what the user selected in the menu.

That allowed to play with a worldsize type like "tiny" and generate the map with totally different map size like "huge", which obviously is wrong because the num of players would be adapted for "tiny" and not for "huge". Now that can be solved.

Again, this will be present in the new map earth31.
 
I just discovered how to create any call to python functions and check if they say "do the default implementation in the DLL" or they just don't exist (and therefore preserve compatibility).

So that will be the key for many things I will implement in python for map scripts. Now I can do anything!
 
Your idea with the climate maps sounds very interesting! :goodjob:
 
Looking forward to seeing what you do.
So far, I have considered to use that for storms, and other features already as you can see in RaR but using a climate system instead of a totally random mechanism.
That's just a though anyway. Because if we have a climate map, there would not be any performane issue doing that. The main calculation would have been done once at the start of the map.
 
Top Bottom