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

MapScriptTools (.. and Associated Maps)

Discussion in 'Civ4 - Map Scripts' started by Temudjin, Jul 15, 2010.

  1. Temudjin

    Temudjin Chieftain

    Joined:
    Oct 16, 2007
    Messages:
    90
    MapScriptTools.py v1.02
    ------------------------------
    AUTHOR:
    Temudjin (2009-11)​
    PURPOSE:
    Provide tools to facilitate map-making and adapting/enhancing existing maps.
    Make maps compatible for 'Normal', 'Fall from Heaven 2', 'Planetfall' and 'Mars Now!' mods.​


    MapScriptTools.py provides functions and classes to:
    - easily adapt maps for Planetfall or Mars Now!
    - produce maps with special features for Fall from Heaven 2
    - 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.

    To show how MapScriptTools are working I've included several adjusted Mapscripts:
    Earth3_163_mst.py
    by jkp1187 --> http://forums.civfanatics.com/showthread.php?t=253927
    Erebus_107c_mst.py
    by Cephalo --> http://forums.civfanatics.com/showthread.php?t=261688
    Inland_Sea_131_mst.py
    by Sirian (Civ4 original)
    Medium_and_Small_111_mst.py
    by Sirian (Civ4 original)
    PerfectMongoose_3101_mst.py
    by LunarMongoose --> http://forums.civfanatics.com/showthread.php?t=402816
    PerfectWorld_206f1_mst.py
    by Cephalo --> http://forums.civfanatics.com/showthread.php?t=310891
    Planetfall_101_mst.py (**NEW**)
    by Maniac --> http://forums.civfanatics.com/showthread.php?t=252829
    Sea_Highlands_121_mst.py
    by Sirian (Civ4 original)
    SmartMap_922_mst.py (changed)
    by surt --> http://forums.civfanatics.com/showthread.php?t=154989
    Tectonics_316a_mst.py
    by Laurent Di Cesare --> http://forums.civfanatics.com/showthread.php?t=149278
    Ringworld3_102_mst.py (changed)
    by Temudjin --> http://forums.civfanatics.com/showthread.php?t=371831
    FracturedWorld_102_mst.py (changed)
    by Temudjin --> http://forums.civfanatics.com/showthread.php?t=371842

    All maps can be used with 'Fall from Heaven', 'Planetfall' or 'Mars Now!'.
    All maps can (and will) produce Marsh terrain, if the mod supports it.
    All maps can (and will) produce Deep Ocean terrain, if the mod supports it.
    All maps allow for at least two more map sizes beyond 'Huge', if the mod supports them.
    All maps support Coastal Waters options. (Allow expanded coast like Civ5)
    All maps may add Map Regions ( BigDent, BigBog (not Mars), ElementalQuarter (FFH only), LostIsle ).
    All maps may add Map Features ( Kelp, HauntedLands, CrystalPlains ), if supported by mod (FFH only).
    All maps may add some rivers on small islands and from lakes.
    All maps support Mars Theme options, if 'Mars Now!' is the active mod.
    All maps support Team Start options.
    All maps support any number of players, depending on the mod.
    All maps produce printed maps in "...\My Documents\My Games\Beyond the Sword\Logs\PythonDbg.log"
    All maps produce printed statistics in "...\My Documents\My Games\Beyond the Sword\Logs\PythonDbg.log"
    If 'Planetfall' is the active mod, usually the planetfall-default starting plot finder will be used.
    If 'Mars Now!' is the active mod, the 'Team Start' option will be suppressed.
    If 'Mars Now!' is the active mod, oceans and lakes are converted to desert (Sands of Mars), except if Terraformed Mars is choosen in the Mars Theme options.
    Most maps use balanced resources, add missing boni and try to move some minerals to nearby hills.
    Most maps give names to their Special Regions.​



    ************************************************
    ** Thanks:
    ** ---------
    ** I've looked into a lot of map-scripts and mod-code and learned much from the authors. I also
    ** stole ideas and sometimes even parts of code, which I found useful. I'm sorry to say that
    ** I don't remember all of my sources - my apologies and thank you all for your efforts.
    ** Specifically I'd like to thank:
    **
    ** Ruff_Hi
    ** - Your 'Ring World' induced me into a deeper investigation of maps.
    **
    ** The CivFanatics Community
    ** - For making all those wonderful maps and mods and
    ** for providing the opportunity to have a look at how it's done.
    **
    ** The Civ4 Design Team
    ** - By opening your game-engine, you really opend the world(s).
    **
    ************************************************​


    Installation:
    Spoiler :

    Put the file MapScriptTools.py into the ...\Beyond the Sword\Assets\Python folder. (NOT CustomAssets!)

    If you don't mind to see it as an option in the map selection of 'Custom Game', you can put it
    into the ...\Beyond the Sword\PublicMaps folder, but that's the second best solution, as it won't work
    if the mod disallows public maps in its ini-file (it may have other quirks - this isn't well tested).

    'Planetfall' uses the PrivateMaps folder, here you whould either have to put it into the Python folder, or change the ini-file to allow 'Planetfall' to use the PublicMaps folder.

    All reports go to the Python log normally at "...\My Documents\My Games\Beyond the Sword\Logs\PythonDbg.log".
    You may have to enable logging by making sure the following option is set to 1 in "...\My Documents\My Games\Beyond the Sword\civilization.ini":
    Code:
    ; Enable the logging system
    LoggingEnabled = 1
    Changelog:
    Spoiler :

    1.02___29.Jul.11
    - Fixed, path identification for MAC in getCivPaths()
    - Fixed ??, MAC compatibility with key parameter in sort() method
    - Fixed, Bonus-list now gives the correct mana-type for FFH type mods
    - Changed, new optional parameter for printList() & sprintList()
    - Changed, new optional parameter for featurePlacer.placeReefs() ! changes parameter order
    - Changed, now two ways to recognize mana types automatically,
    - as defined by the prerequisites for the Towers of Alteration/Divination/Necromancy/Elements; all other mana types are considered mana for meta-magics
    - as defined by the mana type tech, that is the prerequisite of building the appropiate node on the mana boni
    - Changed, in buildTerrainMap(), buildFeatureMap(),buildBonusMap() the showPlots parameter now defaults to False
    - Improved, recognize 'Master of Mana', 'History Rewritten' mods
    - Improved, put addGoodies() into the template
    - Improved, whenever a reef is build in the ocean, there is now a chance that it expands into a somewhat longish chain of reefs
    - Added, world shape to map description log
    - Added, Planetfall_101_mst script

    1.01___15.Mar.11
    - Fixed ??, MAC compatibility with sets and in CivFolders.getCivPaths() - can't test this myself
    - Fixed, incompatibility with 'History in the Making', 'Quod Capita', and possibly some other mods using newer BUG versions
    - Fixed, proper initialization of 'Lost Isle' region upon regeneration of map
    - Fixed, potential problem with region signs falling off the unwrapped map
    - Fixed, now correct coast terrain with special regions
    - Fixed, now Volcanos stand on Land/Hills plots - looks better than floating above peaks
    - Fixed [Planetfall], 'Lost Isle' now produce proper marine boni
    - Fixed [Mars Now!], 'Lost Isle' region now also on Mars
    - Fixed [Mars Now!], no more rivers from 'BigBog' or 'BigDent'
    - Fixed [Mars Now!], printed terrain/feature/bonus maps now show proper resource names
    - Fixed [Mars Now!], no volcanos on marsian deserts anymore, if MST_FeatureGenerator is used
    - Changed, new 'class MST_Terraingenerator_Mars' for use with 'Mars Now!', was split from 'class MST_Terraingenerator' which should be used otherwise
    - Changed, minor changes producing special regions: 'BigDent' and 'BigBog'
    - Changed [Planetfall], normal Trenches and Shelves on biggest ocean and a few more elsewhere
    - Changed [Planetfall], BonusBalancer ignores options for balancing and finding boni
    - Changed [Planetfall], Tundra conversion in planetFallMap.mapPfallTerrain() now: Tundra -> 33% FlatPolar, 16% RockyPolar, 33% FlatMoist, 16% RockyMoist
    - Changed [Planetfall], Highland generation in planetFallMap.buildPfallHighlands() now gives more hills/peaks, which are more clustered together - like Planetfall
    - Changed [Mars Now!], converting ocean to desert: some few hills are created and at higher latitudes tundra or even some ice may be created
    - Changed, some default parameters within various methods - still balancing things
    - Improved, streamlined num...Neighbors() mapping functions
    - check number of plot-neighbors for lists of plots, terrain, features, boni or improvements
    - killed obsolete bWrap parameter
    - Improved, less chance for 'BigBog' and 'BigDent' to start on small island and better chance to start inside bigger continent
    - Improved, print version to log
    - Added, new class variable 'riverMaker.maxRiverLength' to cap length of river
    - Added, feature generator for Mars Now! (included in class MST_FeatureGenerator)
    - Added to 'featurePlacer', methods to place Reefs and Scrub on the map, if allowed by mod
    - Added to 'mapPrettifier', method lumpifyFeature()
    - Added, parameter to getModInfo(), to allow suppression of region-names
    - Added, parameter to mapRegions.buildBigBog() and mapRegions.buildBigDent() to control chances for each special region to exist; slightly lowered default chance (now 66%).
    - Added, parameter to printDict() and printList(), to format floating-point output
    - Added, parameter to mapStats.statPlotCount() to enable use before plots are generated
    - Added [Planetfall], parameter and result to planetFallMap.buildPfallHighlands() to enable use before plots are generated
    - Added [Planetfall], name signs for already known Planetfall regions: 'Mount Planet', 'Garland Crater', 'Manifold Nexus', 'The Great Dunes', 'Pholus Ridge', 'The Ruins', 'Borehole Cluster'
    - Added [Mars Now!], new global variable: bSandsOfMars, denoting a map on Mars, where all surface water is converted to desert.
    - Added Info, included 'How To Guide' and updated the 'MapScriptTools Interface Template' ---> see the end of MapScriptTools.py file!

    1.00___15.Jul.10
    Initial release


    Known Errors:
    -
     

    Attached Files:

  2. Temudjin

    Temudjin Chieftain

    Joined:
    Oct 16, 2007
    Messages:
    90
    MapScriptTools Manual and API Ver.: 1.02

    Introduction:

    If you're a modder working (or playing!) with map-scripts, this is for you!


    Included Mapscripts:
    Spoiler :


    To use the MapScriptTools with existing mapscripts, just put the included template-script
    into them and modify as needed. To demonstarte how it is done I've included several altered
    mapscripts. Some mapscripts required additional changes - sorry, but it's not quite automated (yet)
    and you still need some understanding of what you are doing.


    All maps can be used with 'Fall from Heaven', 'Planetfall' or 'Mars Now!'.
    All maps can (and will) produce Marsh terrain, if the mod supports it.
    All maps can (and will) produce Deep Ocean terrain, if the mod supports it.
    All maps allow for at least two more map sizes beyond 'Huge', if the mod supports them
    All maps may add Map Regions ( BigDent, BigBog (not Mars), ElementalQuarter (FFH only), LostIsle ).
    All maps may add Map Features ( Reef, Scrub, Kelp, HauntedLands, CrystalPlains ), if supported by mod.
    All maps add some rivers on small islands and from lakes
    All maps support Coastal Waters options. (Allow expanded coast like Civ5)
    All maps support Team Start options. (Choose to find your teammate either near or far)
    All maps support Mars Theme options, if 'Mars Now!' is the active mod.
    All maps support any number of players, depending on the mod.
    All maps produce printed maps in "...\My Documents\My Games\Beyond the Sword\Logs\PythonDbg.log"
    All maps produce printed statistics in "...\My Documents\My Games\Beyond the Sword\Logs\PythonDbg.log"
    If 'Planetfall' is the active mod, usually the planetfall-default starting plot finder will be used.
    If 'Mars Now!' is the active mod, the Team Start option will be suppressed.
    If 'Mars Now!' is the active mod, oceans and lakes are converted to desert (Sands of Mars),
    except if Terraformed Mars is choosen in the Mars Theme options.
    Most maps use balanced resources, add missing boni and try to move some minerals to nearby hills.

    Earth3_163_mst.py by jkp1187 --> http://forums.civfanatics.com/showthread.php?t=253927
    - Adjusted starting-plot creation using: 'Temudjins Cool Starting Plots'
    - Added New Zealand, Madagascar and changed Japan a bit.
    - Added Himalayas (single BigDent at special place)

    Erebus_107c_mst.py by Cephalo --> http://forums.civfanatics.com/showthread.php?t=261688
    - Uses default river-system. Wasn't able to insert the new rivers of mapRegions.
    - Opera already introduced placing of Kelp, HauntedLands, CrystalPlains for FFH

    Inland_Sea_131_mst.py by Sirian (Civ4 original)
    - Expanded the template system for starting-plots with generator for more than 18 players.

    Medium_and_Small_11c_mst.py by Sirian (Civ4 original)
    - The minimalistic approach

    PerfectMongoose_3101_mst.py by LunarMongoose --> http://forums.civfanatics.com/showthread.php?t=402816
    - I had to fiddle a bit in generateTerrainTypes() to transform the generated terrainList
    - Uses default river-system. Wasn't able to insert the new rivers of mapRegions.

    PerfectWorld_206f1_mst.py by Cephalo --> http://forums.civfanatics.com/showthread.php?t=310891
    - I had to fiddle a bit in generateTerrainTypes() to transform the generated terrainList
    - Uses default river-system. Wasn't able to insert the new rivers of mapRegions.

    Planetfall_101_mst.py by Maniac --> http://forums.civfanatics.com/showthread.php?t=252829
    - Converted the other way around: from Planetfall to Vanilla BtS, FFH and Mars

    Sea_Highlands_121_mst.py by Sirian (Civ4 original)
    - vbraun already added an option and changed some values; I changed some more to make ships useful.
    - The MapScriptTools template is at the bottom of the file.
    - Shows how to construct a moderatly complex evaluation string for evalLatitude().
    - Eliminate Whale and Pearls boni.
    - Flat map only.

    SmartMap_922_mst.py by surt --> http://forums.civfanatics.com/showthread.php?t=154989
    - Full BtS compatibility.
    - Use both .Civ4WorldBuilderSave and .CivBeyondSwordWBSave files.
    - Adjusted starting-plot creation using: 'Temudjins Cool Starting Plots'
    - Some adjustment of Map Options - partly on the fly for 'Planetfall' and 'Mars Now!'.
    - Lots of small changes in nearly all functions.

    Tectonics_316a_mst.py by Laurent Di Cesare --> http://forums.civfanatics.com/showthread.php?t=149278
    - Adjusted starting-plot creation using: 'Temudjins Cool Starting Plots'

    Ringworld3_102_mst.py by Temudjin --> http://forums.civfanatics.com/showthread.php?t=371831
    - My very own map-script, using lots of MapScriptTools features.

    FracturedWorld_102_mst.py by Temudjin --> http://forums.civfanatics.com/showthread.php?t=371842
    - My very own map-script, using lots of MapScriptTools features.


    How To Guide:
    Spoiler :


    How To Guide to transform a 'normal' map-script for MapScriptTools
    - Make sure MapScriptTools.py is in the appropiate ...\Assets\Python folder: ..\Beyond the Sword\Assets\Python seems to be best as you need it only once.
    - Put the following 'MapScriptTools Interface Template' into your map-script after the import statements.
    - Comment-out / delete what you don't want.
    - Make the necessary adjustments.
    - For Planetfall and Mars use CyPythonMgr().allowDefaultImpl() for the default starting-plot finder.
    - For Planetfall and Mars use mst.MST_FeatureGenerator() to generate features
    - For Planetfall use mst.MST_TerrainGenerator() to generate terrain.
    - For Mars use mst.MST_TerrainGenerator_Mars() to generate terrain.
    - Have a care where (or if at all) you place the CyPythonMgr().allowDefaultImpl() statements. In assignStartingPlots(): CyPythonMgr().allowDefaultImpl() must be the last statement executed!
    - Check for normalize...() functions in the map-script. Use those as a guideline for which normalizations to allow or not.
    - Some map-scripts use the Warlords bonus balancer:
    ---Delete the lines:
    Code:
    from CvMapGeneratorUtil import BonusBalancer
    balancer = BonusBalancer()
    
    ---The balancer is then used within normalizeAddExtras() and addBonusType(). If that's the only thing that's done in these functions, just delete them too.
    ---You may also adjust the mst.bonusBalancer call at the end of beforeGeneration().
    - Some map-scripts use separate lists to manipulate terrain/rivers. See Erebus or PerfectWorld2 for a possible if imperfect way to handle that.
    - You probably have to rename some of your functions too.
    ---If you find functions in the map-script with the same name as the newly inserted ones, check if you can just delete them too, or rename then and call them from within the new functions.
    ---Take some care as some actually return a value, which needs to be returned or assigned somewhere.
    - Rename the new map-script to: yourmapname_mst.py

    NOTES:
    - There are always some adjustments to make.
    - There is always an adjustment that's more complicated than anticipated.
    - There may be a lot adjustments - not usually though.
    - Placing bad code into minStartingDistanceModifier() may crash your computer.
    - Feel free to delete any superfluous comments if they distract too much.


    MapScriptTools Interface Template:
    Spoiler :

    You find the template at the end of the MapScriptTools.py file.
     
  3. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    30,746
    Location:
    Germany / Netherlands
    :wow: that looks massive.

    Now i only have to understand what it does :D. Okay, this is basically an "utility" to transform maps for different mods, right?
    So i can plug one of the mentioned mapscripts in my mod (i feel honoured :)), put mst in my python folder, import mst into the mapscript, and then it will work?


    Bah, i don't have my gaming pc here, so i can't test it :mad:.
     
  4. Temudjin

    Temudjin Chieftain

    Joined:
    Oct 16, 2007
    Messages:
    90
    Somehow it went bigger and bigger with time :rolleyes:.

    Actually what you have to do is:
    1) put MapScriptTools.py into the ...assets\python folder of your mod
    2) put the mapscripts into the ...\PrivateMaps folder of your mod
    that should be all.

    You only need the line
    Code:
    import MapScriptTools as mst
    if you want to write a new mapscript or mess with an existing one.
    In that case you might want to look at the template I've put at the end of the file.
     
  5. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    30,746
    Location:
    Germany / Netherlands
    That's exactly what i understood, and that is...awesome :goodjob:.
    I'll definitly try it out.


    ...wait, we can now use the erebus mapscript with vanilla BtS, right?
     
  6. Maniac

    Maniac Apolyton Sage

    Joined:
    Nov 27, 2004
    Messages:
    5,588
    Location:
    Gent, Belgium
    My jaw is on the floor. Reads awesome at first sight. :eek: I'll need to check this out. :goodjob:
     
  7. Temudjin

    Temudjin Chieftain

    Joined:
    Oct 16, 2007
    Messages:
    90
    Yes,
    Erebus_107b_mst.py should work with vanilla or just about any mod (except Final Frontier mods) :).
     
  8. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    30,746
    Location:
    Germany / Netherlands
    You are definitly great :goodjob:.
     
  9. lordroy

    lordroy God

    Joined:
    Nov 28, 2001
    Messages:
    148
    I am using The Bat mod (that has smartmap)... can I replace the existing smartmap with this one?
     
  10. Temudjin

    Temudjin Chieftain

    Joined:
    Oct 16, 2007
    Messages:
    90
    @lordroy:

    Very probably, as long as you've also put MapScriptTools.py into some appropriate ..\Assets\Python folder.
     
  11. lordroy

    lordroy God

    Joined:
    Nov 28, 2001
    Messages:
    148
    Ya, it does seem to be working correctly. Thank you.

    -=R=-
     
  12. EmperorFool

    EmperorFool Chieftain

    Joined:
    Mar 2, 2007
    Messages:
    9,633
    Location:
    Mountain View, California
    You can fix the sets issue on the Mac with this generic code (works fine on Windows):

    Code:
    try:
    	# test if the 2.4 set class already exists
    	set
    except:
    	# nope, so map it to the classes from the 2.3 sets module
    	import sets
    	set = sets.Set
    	frozenset = sets.ImmutableSet 
    
    Just put this at the top-level of the module, right after the imports. I believe you have code that detects the Civ4 folder, and I haven't checked if it handles Macs or not. You can swipe the code from BUG's BugPath.py for this, too.
     
  13. Afforess

    Afforess The White Wizard

    Joined:
    Jul 31, 2007
    Messages:
    12,239
    Location:
    Austin, Texas
    Wow, Nice. Adding this to my mod. Great Work!
     
  14. Temudjin

    Temudjin Chieftain

    Joined:
    Oct 16, 2007
    Messages:
    90
    @ EmperorFool
    Thanks for the tip :hatsoff:. I may try this with the next patch/update :undecide:.
    Actually I already swiped my path code mostly from BUG :smug: - except I left out the MAC related stuff and some other I didn't understand :rolleyes:. I guess I may have to revisit this :hmm:.
     
  15. Jabarto

    Jabarto Chieftain

    Joined:
    May 15, 2007
    Messages:
    1,025
    Location:
    Colorado, U.S.
    I have only the most basic understanding of how to use these tools, but I can tell that they have serious potential. :)
     
  16. Maniac

    Maniac Apolyton Sage

    Joined:
    Nov 27, 2004
    Messages:
    5,588
    Location:
    Gent, Belgium
    I've looked into the code for MapScriptTools and generated a couple maps with the various mapscipts, and so far have noticed a couple differences with what I would consider maps suitable for my intended Planetfall gameplay. I'm wondering if you are aware of these differences, but they are intentional; or are aware of them but don't see a way to merge the Planetfall requirements with the specifics of the mapscripts; or are unaware of the differences; or are unaware of the intentions I have with the mapscripts; or something else.

    ***

    First thing I noticed was in the code for generation terrain types:

    It says:

    Code:
    elif eTerrain==itTundra: pfallTerrain = choose( 66, etRockyMoist, etFlatPolar )
    In Planetfall's CvMapGeneratorUtil, Tundra gets changed to 33% Flat Polar, 33% Flat Moist, 16% Rocky Moist and 16% Rocky Polar. What is the reason behind this difference?

    Also what does this code do?

    Code:
    if pfallTerrain==etRockyArid and pLatitude<fDesBot: pfallTerrain = choose( 66, etRockyMoist, etRockyArid )
    		elif pfallTerrain==etFlatArid and pLatitude<fDesBot: pfallTerrain = choose( 66, etFlatMoist, etFlatArid )
    		elif pfallTerrain==etRockyArid and pLatitude>fDesTop: pfallTerrain = choose( 66, etRockyMoist, etRockyArid )
    		elif pfallTerrain==etFlatArid and pLatitude>fDesTop: pfallTerrain = choose( 66, etFlatMoist, etFlatArid )
    		elif pfallTerrain==etFlatRainy and pLatitude>fDesBot and pLatitude<fDesTop: pfallTerrain = choose( 80, etFlatRainy, etFlatMoist )
    		elif pfallTerrain==etFlatPolar and pLatitude<fDesTop: pfallTerrain = choose( 80, etRockyMoist, etFlatMoist )
    		elif pfallTerrain==etFlatPolar and pLatitude<fTundra: pfallTerrain = choose( 80, etRockyMoist, etFlatPolar )
    		elif pfallTerrain==etFlatPolar and pLatitude<fSnow: pfallTerrain = choose( 66, etRockyMoist, etFlatPolar )
    		elif pfallTerrain==etRockyPolar and pLatitude<fTundra: pfallTerrain = etRockyMoist
    		elif pfallTerrain==etRockyPolar and pLatitude<fSnow: pfallTerrain = choose( 66, etFlatPolar, etRockyPolar )
    Would my quick glance be correct that this reduce the chance that a certain terrain type occurs outside its normal climate zone? I'm not sure I would like such a reduction in variety. On the other hand, I haven't really noticed such a change in the maps I generated, so perhaps I'm misinterpreting this code.

    ***

    A second big area where Planetfall is different from vanilla is plottype/peak/hills generation. That code wasnt written by me, and I don't understand the code at all. The effect and intention of it however is to create clusters/clumps of highlands/hills at times surrounded by ridges/peaks, to create areas where a Terraforming or anti-Planet ecological strategy is much more viable. This doesn't seem to happen at all in the maps generated with your MSTools. While there are more highlands, they seem to be distributed completely at random. So I have the usual questions: are you aware of the differences, are you aware of what the goal was of Planetfall's original code, etcetera?

    ***

    Trenches: here it may just be my imagination based on limited tests, but I get the impression there are less of them. Could this code be responsible?:

    Code:
    # try to avoid inland trenches or shelves
    				if numWaterNeighbors(x, y, 1) <  5: continue
    				if numWaterNeighbors(x, y, 2) < 13: continue
    ***

    I'm wondering if the various MapPrettifier functions are applied to Planetfall as well. Some shouldn't.

    deIcifyEdges: this isn't necessary. Unlike in vanilla Civ, plots with Ice can provide a yield.

    hillifyCoast: Undesired, Once again, Peak/Ridges provide a yield in Planetfall and can be walked upon, so there's no danger to having Ridges on the coast. Edit: Oh wait, I just noticed this function immediately returns for Planetfall. :)

    lumpifyTerrain: matter of taste I guess. Don't really see the need.

    I do like bulkifyIslands.

    Some/all of the special map regions (except for the Command Center isle I've seen) seem to have names that fit more for the FfH universe. Is it intended those also appear on Planetfall maps?

    ***

    BonusBalancer

    Planetfall placed around 11 of each bonus resource on the map, regardless of map size. So in theory there's about one resource for each faction in the game (original seven + SMAX4). The generic Nutrient/Mineral/Energy Bonus resources are used to balance starting positions, and to randomly dot the map with a resource every x tiles regardless of the amount of players. Using vanilla bonus balancing code or vanilla normalizeAddExtras functions would ruin this goal. So I hope this code isn't used for maps generated for Planetfall.

    In fact, except for Planetfall's own normalizeAddExtras function in the SDK (which only places the three generic nutrient/mineral/energy), none of the normalizestartingposition functions should be used. The idea behind Planetfall's starting positions is to have a much wider variety of starting positions than you encounter in vanilla (where everything is equalized), but to offer more tech strategies to make the most out of your starting position. For instance if you start surrounded with Jungle, you can go Terraformed. If you are surrounded by Fungus, you can go Hybrid. If you are surrounded by arid terrain without a river in sight, Biodomed is the way to go.

    So for all Planetfall mapscripts, the following should be used:

    Code:
    def normalizeAddRiver():
    	return None
    
    def normalizeRemovePeaks():
    	return None
    
    def normalizeAddLakes():
    	return None
    
    def normalizeRemoveBadFeatures():
    	return None
    
    def normalizeRemoveBadTerrain():
    	return None
    
    def normalizeAddFoodBonuses():
    	return None
    
    def normalizeAddGoodTerrain():
    	return None
    Else all Ridges, Jungle, Xenofungus for instance might be removed, because the game thinks those are bad terrain.

    ***

    Another thing I noticed was that on a SmartMap, the starting positions were all over the place, rather than concentrated the Planetfall way.

    That's what I noticed so far. I hope you can answer my questions. I'm looking forward to being able to play with a bigger variety of Planetfall-compatible mapscripts than the single one I currently have. :)
     
  17. Temudjin

    Temudjin Chieftain

    Joined:
    Oct 16, 2007
    Messages:
    90
    Thanks for the detailed analysys, obviously there is more to the planet of 'Planetfall' than I realized.

    I've had to project 6 different land-terrains into 8 and choose a randomizing yet somewhat self-adjusting process.
    First: Desert,Plains,Grass and Snow and had corresponding terrain (Arid Moist,Rainy,Polar) and i gave the flat version a 66% chance. Marsh had also a pretty obvious corresponding terrain (FlatRainy) no variance needed here. Tundra was the odd one out and I gave it a 66% chance for RockyMoist and a 33% chance to be FlatPolar (Somehow I visualize tundra more moist than rainy).
    Second: Depending on the latitude I gave the new terrain a chance to be more or less damp or hot. My coldness sequence is RockyMoist, FlatPolar, RockyPolar.
    Indeed my idea was to give neighboring terrains a slightly bigger chance to be similar and climatically more reasonable, the effect shouldn't be all that big though.

    Actually I noticed this myself and wrote planetFallMap.buildPfallHighlands(), which adds foothills and highlands near already existing hills/peaks, to adjust for the problem. But it seems I have underestimated the prominence of hills/peaks on planetfall. Basically I will have to adjust the chance to convert considerably upwards and may need to lumpify the hills a bit.

    Indeed it is. The problem isn't trivial though as MST is supposed to work for all types of maps, some of them have inland seas which are to small to reasonably have trenches. The above code was a quick fix for that, but you are right that it may be a bit to restrictive. Perhaps I just ignore the retriction on the biggest ocean.

    While not exactly necessary, deIcifyEdges() still seems to be a good idea, as some map-scripts take care to manipulate latitudes to simulate the warmer climate of a restricted region.

    Personally I think it's perfectly reasonable to give a peak a name like 'Wizards Hat' even on an alien world, but I'll probably give an extra parameter to getModInfo() to allow suppression of region-names (May be a good idea for FFH too, if the mod option for using all unique features is activated). You can do this right now by putting
    Code:
    
    mst.mapRegions.initialize( noSigns=True )
    
    right after your call to getModInfo(). Sorry I forgot to mention this in the API.
    Actually I could use some ideas for Planetfall special region names.

    I didn't realize that and will disallow bonus-balancing and missing-boni-giving for Planetfall.

    I didn't realize that either and will change the maps accordingly.

    I've seen this too (now), not only in SmartMap. The first thing I do in assignStartingPlots() is test for Planetfall and then use the default procedure. I'm a bit out of my depth here.
     
  18. Maniac

    Maniac Apolyton Sage

    Joined:
    Nov 27, 2004
    Messages:
    5,588
    Location:
    Gent, Belgium
    But why did you not do Tundra like Planetfall's MapGeneratorUtil does it? Is the difference intentional, or were you not aware of the code in MapGeneratorUtil?

    Would you be willing to tell me the line(s) of code to add to MST to convert Tundra the way Planetfall currently does it?

    Is (virtual) Marsh terrain actually generated for Planetfall maps?

    If your goal is to generate highlands in MST as Planetfall currently does it (is it?), is it not possible to copy Planetfall's code as close as possible to MST?

    Not sure I understand this sentence. Do you mean this code does not have an effect on mapscripts that do not change latitudes?

    SMAC's Map of Planet has many landmark names. IIRC no mountains though except for Mount Planet. Do you own SMAC and/or are familiar with the Map of Planet?

    Some of SMAC's landmarks are added through SDK code. There are some landmarks which I haven't implemented because they'd need to span over multiple plots and I don't really know a good way to do that. You however seem to have the skills.

    Some ideas:

    Geothermal Shallows. In the handdrawn Map of Planet for Planetfall, this sea region is represented by a mix of shelf and coast terrain with some Hydrothermal Vent and Energy Bonus resources on it.

    Fossil Field Ridge: sea area with some Oil and Mineral resources. On Planetfall's Map of Planet, IIRC it's Trench feature and more than one plot wide (instead of the usual single-plot-wide trench line)

    Sargasso Sea: sea region, a concentration of sea fungus with four sea unity pods in the middle.

    Freshwater Sea: a somewhat round inland lake, totally Shelf with some Nutrient bonus resources.
     
  19. Temudjin

    Temudjin Chieftain

    Joined:
    Oct 16, 2007
    Messages:
    90
    I did have a look, but only a cursory one, which apparently didn't extend to figuring out tundra (that was more than a year ago). Do you mean the transformation should be: 50% FlatPolar, 25% RockyPolar, 25% FlatMoist ? I guess I could do that.
    The code is in mapPfallTerrain() lines 2090+ which you already found. Just change:
    Code:
    
       elif eTerrain==itTundra: pfallTerrain = choose( 66, etRockyMoist, etFlatPolar )
    
    to
    
       elif eTerrain==itTundra: pfallTerrain = chooseMore( (50,etFlatPolar), (75,RockyPolar), (100,etFlatMoist) )
    
    But this code is only used by Erebus and PerfectWorld, which themselves produce terrain-lists outside their terrain-generator. The other maps use the Planetfall terrain-generator, mostly via mst.MST_TerrainGenerator().

    Actually no it isn't by MST. But other map-scripts may have generated marshes before the terrain is converted by mst.planetFallMap.mapPfallTerrain().

    Good question :confused:. Upon consideration I guess I want to create those ridges and highlands of Planetfall as they are a vital part of the Planetfall gameplay, but I don't think I'd want to go quite as far with them. Ideally I'd want to retain at least the general theme of the other map-scripts. Which of course means I'm not going to copy Planetfall's code (which I don't quite understand either).

    mst.mapPrettifier.deIcifyEdges( iLat=66, addToroidIce=True ) will only remove ice, if the highest (or lowest) latitude of the map is smaller than iLat. Additionally it may add a girdle of ice on toroid worlds.

    Yes I did own SMAC and probably still do somewhere :lol:. But I've never had the extension and I didn't read manuals much, so I have no idea about the 'Map of Planet'.

    Thanks, I may use one or two of those ideas to make new special regions for Planetfall. Not Sargasso Sea though, as there would be units involved and I'll avoid that (for now).

    Any ideas for additional names for known special regions whould be very welcome indeed:
    - For BigDent I use 5 different names (Volcano isn't needed for Planetfall) depending on the plot in the middle like:
    Code:
    {
    'Volcano': "Hole of the World",
    'Peak':    "The Big Dent",
    'Flat':    "Hammers Rest",
    'Water':   "Hole of the World",
    'Hills':   "Big Dent Highlands"
    }
    
    - For LostIsle I have only
    Code:
    
    lostIsleNames_Pfall = [ "Alien HQ", "Command Center", "City of Light", "Atlantis Command" ]
    
     
  20. Temudjin

    Temudjin Chieftain

    Joined:
    Oct 16, 2007
    Messages:
    90
    @ Maniac:
    I couldn't find a solution for the 'Scattered Pods' problem yet. But having checked on my end, I've snooped a bit on yours and found an oddity:

    bool CvPlayer::startingPlotWithinRange(CvPlot* pPlot, PlayerTypes ePlayer, int iRange, int iPass) const in CvPlayer.cpp always returns false.
    This function is called by findStartingPlot(playerID, validFn = None) in CvMapGeneratorUtil.py
    which in turn is called by void CvGame::assignStartingPlots() in CvGame.cpp
    which is the main function for creating starting-plots.

    I'm not entirely sure if that's the source of the problem, but that may well be the case.
    The MST map-scripts either don't have assignStartingPlots() or call CyPythonMgr().allowDefaultImpl() if the Planetfall mod is active.

    Edit: I've just noticed that Earth3 and SeaHighlands use their own starting-plot finders with Planetfall. I may change that for SeaHighlands, but probably not for Earth3.
     

Share This Page