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] LandMasses

Discussion in 'Civ4 - Map Scripts' started by Thedrin, Mar 24, 2007.

  1. Thedrin

    Thedrin Chieftain

    Joined:
    Jan 24, 2002
    Messages:
    2,649
    Location:
    London
    LandMasses Version 3

    A new BtS compatable (at least it hasn't crashed on me yet) version of LandMasses is now available.

    LandMasses has been broken down into 5 lesser map scripts. Each one gives you full control over one area of the map generation previously performed by LandMasses - map size, land placement, terrain placement, features placement, and bonus placement (start placement is gone - I was never happy with it) - but the generated map will be very basic in all other respects.

    By running the master Modules script you can make use of all 5 LandMasses scripts at once, or less if you prefer. Modules does not give you direct access to the options available with each of the lesser LandMasses scripts, but it is designed to run any given LandMasses script according to the parameters selected when the LandMasses script was last used.

    So, for example, if you generate a 4 land mass map with Modules, using LandMasses Lands, but want to play a 3 land mass map:
    1) Select LandMasses Lands script in the Custom Game Setup menu, and choose 3 land masses (and whatever other options you want).
    2) Set map size to Duel (not necessary but much faster) and generate the LandMass Lands map.
    3) Return to the Custom Game Setup menu and select Modules. Select LandMasses under the Lands option (and whatever other options you want).
    4) Set the appropriate map size and generate the Modules map. The resulting map will be generated using the LandMass Lands script, with the no. of land masses variable set to 3.

    This script is in its early days. I'm thinking about expanding the Modules options so that aspects of other maps, such as Terra, Highlands, and a few others, can be mixed and matched, and may shortly open up a new thread for that.

    Any problems, questions, or issues; feel free to raise them here.

    --------------------------------------------------------------------------

    To make use of the customisable resources options you'll need a Python editor. I use the one found in the below link. Note that when this link was last updated Python version 2.5.2 was available. This link will take you to a page that contains multiple versions depending on what system you're using.

    Python

    --------------------------------------------------------------------------
    Original Post:

    This is a script I've been working on. My aim was to put together an alternative continents-style map generator.

    As well as factors such as width, height, ocean size, no. of hills and peaks, the script allows the user to select the number of land masses, the number of continents (which form the land masses), the seperation between land masses and whether or not colliding continents produce mountain ranges.

    Having had no experience of Python before I used SmartMap as a guide to the language. This script uses CivIV's standard functions for generating rivers, lakes, features, huts and starting positions. Map size and land/hill/peak placement began life as the SmartMap code but have been altered quite a lot since then. An alternative resource generator has been implemented but the user may still choose to use 'standard' resources placement.
     
  2. Thedrin

    Thedrin Chieftain

    Joined:
    Jan 24, 2002
    Messages:
    2,649
    Location:
    London
    # History.
    #-----------------------------------------------------------------------------------------------#
    # 1.0:
    # Original version
    #-----------------------------------------------------------------------------------------------#
    # 1.1:
    # Removed variables which weren't doing anything unique. This has resulted in slowdown in map generation - particularly
    # for larger maps.
    # Adjusted the percentage of land tiles that are hills and peaks.
    # Increased the amount of hills and peaks possible through more options.
    # fixed an error in the lake removal code which caused some lakes to be left behind. Note that lakes are added back in
    # later.
    # Fixed an error in the 'reduced desert' terrain option.
    #-----------------------------------------------------------------------------------------------#
    # 1.2:
    # New way of choosing random numbers of land masses and continents implemented to allow greater flexibility.
    #-----------------------------------------------------------------------------------------------#
    # 2.0:
    # Alternative resource generator.
    # - Oil can be generated anywhere.
    # - Aquatic resources can be generated anywhere within reach of land.
    # - Minerals (aluminium, coal, copper, gems, gold, iron, marble, silver, stone, uranium) and incense can be generated on any land tiles (except peaks and oases).
    # - Other resources can be generated on the following terrain types.
    # - Ice: fur.
    # - Tundra: game, fur, ivory, sheep.
    # - Tundra hills: game, fur, sheep.
    # - Tundra forests: game, fur, ivory.
    # - Tundra forested hills: game, fur.
    # - Grassland: corn, cow, dye, horse, ivory, pig, rice, sheep, spices, sugar, wheat, wine.
    # - Grassland hills: dye, pig, sheep, spices, wine.
    # - Grassland forest or jungle: dye, fruit, ivory, pig, silk, spices, sugar, wine.
    # - Grassland forested hills or jungle hills: dye, fruit, pig, silk, spices, sugar, wine.
    # - Plains: Same as grassland but may also yield game and fur.
    # Some resources are unique to their landmasses. These are corn, cow, pig, rice, sheep, wheat, ivory, silk, sugar, and wine.
    # The option 'LandMasses: isolate horses' will include horses in this list.
    # The option 'LandMasses: no isolated resources' will allow all resources to be placed on multiple land masses.
    # LandMasses resource generator may override a mod which alters the placement of the standard resources.
    # When using a mod with extra resources (salt, say) the LandMasses resource generator should (hopefully) place the additional resources according to the mods standard placement rules for that resource.
    # Note that the options for isolating resources - 'LandMasses' and 'LandMasses: isolate horses' - do not completely isolate all resources selected for isolation. This is most prominently, but not completely, due to resources being placed within a civs starting place.
    # Resources are placed randomly taking no account of the local resource density. This can lead to some serious clumping.
    #
    # Other changes:
    # Increased the number of possible land masses to 10.
    # Increased the possible width and height to 240 tiles (from 160).
    # Increased the number of ocean percentages that can be chosen. The minimum is now 5% (was 40%) and the maximum is now 95% (was 80%).
    # Added min. and max. options (previously included in the land masses and continents options) to the following options:
    # - Width
    # - Height
    # - Ocean
    # - Land Mass Seperation
    # One affect of this change is that the 'Sealevel' option no longer has any effect on map generation. To obtain its affects:
    # - Low: set Land Mass Seperation to between 0 and 4.
    # - Medium: set Land Mass Seperation to between 5 and 8.
    # - High: set Land Mass Seperation to between 9 and 12.
    # Note the setting Land Mass Seperation at 0 or 1 will still cause only 1 continent per landmass to be generated.
    #-----------------------------------------------------------------------------------------------#
    # 2.1
    #
    # Terrain changes:
    #
    # Selecting Rocky climate no longer affects the terrain.
    # Introduced three new hill and peaks setting; Highlands few, Highlands normal, and Highlands many. I've only used estimates to determine the appropriate percentages in these cases. If someone has the actual figures I'd appreciate them.
    #
    # Resource changes:
    #
    # Created a master resource option, 'Resources'.
    # - Standard will use the standard CivIV recourse placement code. The Resource Land Mass, Resource Tiles, and
    # Resource Quantities options are rendered ineffective.
    # - Custom activates the Resource Land Mass, Resource Tiles, and Resource Quantities options.
    #
    # Divided resources options into two:
    # - Resource Land Mass
    # - Resource Tiles
    # Resource Land Mass determines which resources are assigned to specific land masses.
    # - 'Standard' assigns health and luxury resources to specific land masses.
    # - 'LandMasses' assigns the same resources to specific land masses as it did previously.
    # - 'LandMasses, isolate horses' is the same as 'LandMasses' but it also assigns horses to a specific land mass.
    # - 'No isolated resources' allows all resources to be placed on all land masses.
    # Resource Tiles determines which tiles a resource can be assigned to.
    # - 'Standard' assigns resources to normal CivIV locations.
    # - 'LandMasses' assigns the same resources to the same tile types as it did previously.
    # - 'Crazy' assigns a resource to any tile which can be improved to take advantage of the resource.
    # Setting both options to 'Standard' will cause LandMasses to use the default resource placement code.
    # Setting only one option to 'Standard' will cause LandMasses to attempt to mimic the effects of the default resource placement code.
    #
    # Added the option 'Resource Quantities'. This allows the number of resources to be altered.
    # - 'Normal resources': the no. of resources is between half the no. of players and one short of the no. of players.
    # - 'Few resources': Only half as much of each resource are generated.
    # - 'Many resources': Twice as much of each resources are generated.
    # Further notes on this option:
    # - if 'Standard' has been set for both Resource Land Mass and Resource Tiles then Resource Quantities is ignored.
    # - The script may not place all of the resources that it sets out to.
    # - The fewer resources generated, the more likely that the civ starting placement code may add in resources. This will noticably reduce the effects of some of the choices for Resource Land Mass, 'LandMasses', 'LandMasses, isolate horses', and, if 'Standard' has not been selected for Resource Tiles, 'Standard'.
    #
    # The odds of a resource being placed on any given tile reduce as the number of that resource in the fat cross centred around that tile increase.
    # The odds of a resource being placed on any given tile reduce as the number of all resources in the fat cross centred around that tile increase.
    #-----------------------------------------------------------------------------------------------#
    # 2.2:
    #
    # Beginning work on terrain options. Since my previous undocumented attempt at this (a few months ago) was a spectacular failure, I'll be going very slowly. For now only a few, unlikely-to-be-used, options are included.
    #
    # Terrain:
    # - Standard: uses normal terrain generation. Deactivates all terrain options.
    # - Custom: Activates all terrain options.
    # Terrain Type:
    # - all grass, all plains, all desert, all tundra, and all snow.
    # - fantasy - randomly placed terrrain tiles.
    #
    # Resources:
    # Aquatic resources will no longer be generated beneath ice.
    #-----------------------------------------------------------------------------------------------#
    # 2.3:
    #
    # Lands:
    #
    # Added 'Coastlines' option. A rugged coastline increses the number of islands and archipelagos.
    # - Standard: Prior to the introduction of the coastlines option, this was the usual implementation.
    # - Rugged: Lots of coastal islands. Lands that were narrow under the standard setting may be broken up into archipelagos.
    # Notes:
    # - the effectiveness of this option depends a great deal on how much space is designated towards land, ocean, and seperation between landmasses. Selecting a low ocean percentage and a high seperation between land masses will reduce the effects of the coastline option to irrelevance.
    # - it is possible for large pieces of land which previously formed a single landmass to be seperated from each other. If these lands become seperated by ocean (and not just coastal tiles) then they should be treated as seperate land masses by the resource generator. In short, you may get more land masses than you intended. The odds of this happening are much more likely with coastlines set to rugged but still possible (I've never seen it) under standard coatlines.
    #
    # The Ocean and Distance between land masses have been swapped around on the custom menu screen. This is so that the options related to the ratio of ocean tiles to land tiles are placed in order of importance:
    # 1) Seperation Between Land Masses - land will only be placed if it doesn't go to close to other land masses. If the minimum seperation is sufficiently large enough there may not be enough space to reach the ocean percentage. For example, if the minimum seperation between land masses is set to 12 and the ocean percentage is set to 20%, the code will stop placing land tiles long before 80% of the map has been assigned a land tile. This does not include Pangaeas since the land mass seperation only affects the placement of tiles from different land masses.
    # 2) Ocean: If the land mass seperation leaves enough space for the ocean/land ratio to be met then it should happen.
    # 3) Coasts: The ruggedness of the coast depends on how much extra space there is for land after the ocean/land ratio set by the ocean option has been met. If there is no more space the land masses will be smooth. Selecting rugged will only have a noticeable affect beyond that of standard if there is plenty of room for extra land.
    #
    # Resources:
    #
    # Added options to give control over the quantities of strategic, health, and luxury resources. Ivory, spices, sugar, and wine are classified as luxuries.
    # Improved land mass placement of isolated resources. Resources selected for isolation are far less likely to appear on multiple land masses. The placement of resources on multiple land masses due to the civ placement code is unaffected.
    # Aquatic resources should no longer appear on lakes.
    #-----------------------------------------------------------------------------------------------#
    # 2.4:
    #
    # Lands:
    #
    # Added a third choice to the Coastlines option. Rougher' produces more rugged coasts than standard but smoother coasts than rugged. Like the other two choices available, the effectiveness of the option is based on the choices selected for Land Mass Seperation and Ocean.
    #
    # Resources:
    #
    # Added 'custom' choice to all resource options which allows a Python user to much more easily edit how resources are placed. The code which needs to be edited can be found under the heading CUSTOMISING RESOURCE PLACEMENT at the top of the LandMasses.py map script. Instructions can be found there explaining how to edit the resource placement.
    # Custom 'Resource LandMasses' allows the user to select the resources which will be limited to one continent. By default, custom produces the same results as LandMasses.
    # Custom 'Resource Tiles' allows the user to select the tiles a resource can be placed on. By default, custom produces the same results as LandMasses.
    # Custom 'Strategic Quantities' allows the user to select the number of each strategic resource. By default, custom produces the same results as normal strategic resources.
    # Custom 'Health Resources' and custom 'Luxury Resources' options work in the same way as custom 'Strategic Resources.
    #-----------------------------------------------------------------------------------------------#
    # 2.5:
    #
    # Resources:
    #
    # Customising 'ResourceTiles' now allows the user to distinguish between coastal and ocean tiles.
    # Customising 'Resource Land Masses' now allows water based resources to be assigned to particular land masses. Previously,
    # customising the options so that water based resources were isolated to single land masses was ineffective.
    # Introduced two new options: 'How many Land Masses' and 'Let Resources Clump'.
    #
    # 'How Many Land Masses':
    # If a resource is selected to be isolated - not placed on all land masses - this options allows the user to determine how many the resource will be placed on.
    # - Assigned to x land masses: Isolated resources are placed on x of the land masses. If x exceeds the number of land masses generated then no resources will be isolated; all resources selected for isolation may be generated on all land masses. Note that x only goes as far as 8. An alternative choice (listed below) exists if the user wants to place a resource on 9 out of 10 land masses.
    # - Assigned to half the land masses: Isolated resources are placed on half of the generated land masses.
    # - Assigned to all but one land mass: But for one land mass, an isolated resource may be placed anywhere.
    # - Custom: Like all resource options, the ability to customise the effects of this option are available to users willing to edit this script with Python. Custom allows different resources to be isolated to different numbers of land masses (though the user must also make sure to set the appropriate resources to be isolated in the first place). Left unedited, this choice will assign isolated resources to just one land mass.
    # Note that the map script is not guaranteed to generate the predefined number of landmasses so setting this option to 'assigned to x land masses' where x is a larger number may simply allow isolated resource to be generated everywhere.
    #
    # 'Let Resources Clump':
    # This determines whether or not two of any one resource are allowed to be placed near each other.
    # If clumping is disabled for a resource then a city's fat cross may only contain two of the resource in the following situations:
    # 1) .......
    # ..rYY..
    # .YYYYY.
    # .YYcYY.
    # .YYYYY.
    # ..YYYr.
    # .......
    #
    # 2) .......
    # ..YYY..
    # .rYYYY.
    # .YYcYY.
    # .YYYYY.
    # ..YYYr.
    # .......
    # where 'r' marks a resource, 'Y' marks a tile inside the city's fat cross, and 'c' marks the city tile.
    # Options:
    # - Standard: Attempts to approximate standard resource placement. Only luxury resources may be placed near each other.
    # - Strategic: Only strategic resources may be placed near each other.
    # - Health: Only health resources may be placed near each other.
    # - Luxury: Only luxury resources may be placed near each other.
    # - Strategic/Health: Only strategic and health resources may be placed near each other.
    # - Strategic/Luxury: Only strategic and luxury resources may be placed near each other.
    # - Health/Luxury: Only health and luxury resources may be placed near each other.
    # - Strategic/Health/Luxury: All resources may be placed near each other.
    # - Custom: The map script can be easily edited (as with other resource options) so that the user can decide which resources may be clumped. 'Custom' uses the user-edited clumped resources instead of one of the predefined options. If no editing has taken place, 'custom' uses the 'standard' option.
    #-----------------------------------------------------------------------------------------------#
    # 2.6
    #
    # Lands:
    #
    # Reduced the options 'Mountain Ranges:' and 'Changes in Altitude' down to a single option. There is no longer a range of options for choosing the degree to which hills and peaks congregate together, just the choice as to whether or not they should clump together.
    #
    # Terrain:
    #
    # Reworked terrain options. Fantasy option excluded, all terrain types use the standard terrain generator but apply different values to certain variables.
    # Options:
    # - Cool, Temperate, Warm: These determine how far from the equator ice and tundra are generated. Temperate generates both terrains at the normal latitudes. Cool generates both terrains closer to the equator. Warm generates both terrains further from the equator.
    # - More desert, normal desert, less desert: How many desert tiles are generated. More desert generates roughly 50% more than usual. Less desert generates roughly 50% less than usual.
    # - More plains, normal plains, less plains: How many plains tiles are generated. More plains generates roughly 50% more than usual. Less plains generates roughly 50% less than usual.
    # - Fantasy: Places all land terrains randomly. Water terrain - coast or ocean - remain unchanged.
    #
    # Terrain Homogeneity determines how clumped each terrain type is. This option is ignored if Fantasy has been chosen.
    #
    # Features:
    #
    # An option, "Woodlands:", is now available to control the amount of forest and jungle features generated. Similar to the newly added terrain options, this works by giving the standard feature generator different values to work with.
    # - More jungle, normal jungle, less juugle: More jungle generates more jungle than normal. Less jungle generates less jungle than normal.
    # - More forest, normal forest, less forest: More forest generates more forests than normal. Less forest generates less forests than normal.
    #
    # An option, "Flood Plains:", is now available to give some control over placement of flood plains.
    # - 'Normal flood plains placement' only places on flat, riverside desert tiles.
    # - 'Extra flood plains' also places flood plains on flat, riverside grassland, plains, and tundra tiles.
    #
    # Resources:
    #
    # Setting both 'Resource Land Masses' and 'Resource Tiles' to 'Standard' will no longer deactivate all other resource options. Setting 'Resources' to 'Standard - ignore resource options' is now the only way to do this.
    #-----------------------------------------------------------------------------------------------#
    # 2.7
    #
    # Lands:
    #
    # Corrected an error which resulted in more than the selected percentage of ocean being generated. Previously, the amount of land generated was a fraction of (width - 4)*(height - 4). Now the amount of land generated is a fraction of width*height. This can lead to a lot more land being generated than previously. Since the amount of hills and peaks generated is also determined by the amount of land generated, more of these will be generated, though the percentage should be unchanged. The user may prefer to switch the ocean setting to a higher percentage.
    #
    # Reworked the code placing the initial tile of each continent. Alterations:
    # - generating a small number of continents on a larger map size may take longer than previously.
    # - generating a large number of continents should take a lot quicker than previously.
    # - it is more likely that all requested continents are placed.
    # - land masses should be more varied in shape.
    #
    # Added a new option, "Continent Placement:":
    # - 'Normal continent placement' will place the initial tile of each continent randomly.
    # - 'More rounded land masses' will generate land masses which tend to be more circular.
    # - 'More snaky land masses' will generate land masses which tend to be longer and more stretched.
    # Notes:
    # 1) This option only affects land masses which contain 3 continents or more:
    # - Selecting 2 land masses, 4 continents, and evenly distributed continents will leave the land mass shape unaffected by the Continent Placement options 'more rounded land masses' and 'more snaky land masses'.
    # - Selecting 2 land masses, 6 continents, and evenly distributed continents will mean that the placement of the first tile of the last continent on each land mass will be affected by the Continent Placement options 'more rounded land masses' and 'more snake land masses'.
    # - Selecting 2 land masses, 5 continents, and evenly distributed continents will mean that the placement of the first tile of the last continent on one land mass will be affected by the Continent Placement options 'more rounded land masses' and 'more snake land masses'.
    # 2) The more continents placed on a land mass, the more noticeable the affects of the options 'more rounded land masses' and 'more snaky land masses'.
    # - Selecting 2 land masses, 20 continents, and evenly distributed continents will make the affects of 'more rounded land masses' and 'more snaky land masses' more obvious than if 2 land masses, 8 continents, and evenly distributed continents, or 5 land masses, 20 continents, and evenly distributed continents had been selected.
    #-----------------------------------------------------------------------------------------------#
    # 2.71
    #
    # Lands:
    #
    # Since pre-2.7 LandMasses rarely produced more than 7 continents on huge maps but LandMasses 2.7 can easily generate 20 continents on a standard size map, mountain ranges in maps generated with a large numbers of continents for every land mass aren't as well defined as they were previously (which, I think, removes any point in including that feature). A new option has been added to the Mountain Ranges option called 'ranges' (what was previously called ranges has been renamed 'all ranges').
    # - ranges will select between 3 and 5 continents which will increase the altitude of land plots already created by other continents.
    # - all ranges will, as before, cause all continents to increase the altitude of any land plot already created by other continents.
    # Note:
    # 1) using ranges, a mountain range produced between two continents may not be as clearly defined as one produced in pre-2.7 LandMasses since the extra altitude may only be generated by one of the two continents.
    #-----------------------------------------------------------------------------------------------#
    # 2.72:
    #
    # Lands:
    #
    # Increased the likelihood of Indonesia-like continent-to-archipelago formations being generated under certain settings More specifically, when Coastlines is set to 'rougher' there is an increased chance of such formations being generated and when Coastlines is set to rugged there is a further increased chance of such formations being generated.
    #-----------------------------------------------------------------------------------------------#
    # 2.73:
    #
    # Map Size:
    #
    # Introduced new "Min. Height" choice; 'Normal ratio of width to height'. This allows the user to select a width and an apporpriate height will be chosen so that the ratio of the map's width and height are similar to that generated in the Continent map script.
    # The height chosen will be between 3/5 (0.6) and 5/8 (0.625) of the width - the minimum and maximum ratios used by the Continent map script (the ratio changes with different sizes).
    #
    # Increased the maximum value for the map width to 308 (from 240). This won't generate maps with a height of 240 using the 'Normal ratio of width to height' option but it allows that option to generate maps with an area equal to that of a 240x240 map.
    #
    # Lands:
    #
    # Reworked how continent-to-archipelago formations are generated.
    #
    # General Map Options:
    #
    # Removed Sealevel option (the one that's standard with most maps) since it wasn't doing anything.
    #
    # Removed standard 'Random' choice from all options. Introduced an alternative set of random options:
    # - Continent Distribution: 'Random' will select from all available choices.
    # - Continent Placement: 'Random' will select from all available choices.
    # - Coastlines: 'Random' will select from all available choices.
    # - Hills: 2 random options
    # 1) 'Random' chooses between 12.5% and 34.5% of land to be hills.
    # 2) 'Random highlands' chooses between 40% and 50% of land to be hills.
    # - Peaks: 2 random options
    # 1) 'Random' chooses between 0% and 14% of land to be peaks.
    # 2) 'Random highlands' chooses between 20% and 30% of land to be peaks.
    # - Mountain Ranges: 'Random' will select from all available choices.
    # - Terrain: 'Random' will select from all available options except 'fantasy'.
    # - Terrain Homogeneity: 'Random' will seleect from all available options.
    # - Woodlands: 'Random' will select from all available options.
    # - Resource Land Masses: 'Random' will select from all available options except 'custom'
    # - How Many Land Masses: 'Random' will isolate resources to between 1 and (actual number of land masses - 1) land masses.
    # - Strategic Quantities: 'Random' will select between 'few strategic resources', 'normal strategic resources', and 'many strategic resources'.
    # - Health Quantities: 'Random' will select between 'few health resources', 'normal health resources', and 'many health resources'.
    # - Luxury Quantities: 'Random' will select between 'few luxury resources', 'normal luxury resources', and 'many luxury resources'.
    #
    # Some options - usually because they are structured so that a random option is pointless or because the user is much more likely to have a definite idea on what they want from the option - do not recieve a random option. These options are:
    # - Min./Max. Width
    # - Min./Max. Height
    # - Min./Max. Land Masses
    # - Min./Max. Continents
    # - Min./Max. Land Mass Buffer
    # - Min./Max. Ocean
    # - Flood Plains
    # - Resources
    # - Resource Tiles
    # - Let Resources Clump
    # - Print Map Details
    #
    # New option 'Print Map Details' so that option choices (including random selections) may be printed.
    # - No: Selected options are not printed.
    # - Yes: Details about the generated map are printed to C:\Program Files\Firaxis Games\Map Options. This file can be opened with Notepad. This file is overwritten everytime a new map is generated.
    # Note that the selected option for 'Let Resources Clump:' is not listed.
    #-----------------------------------------------------------------------------------------------#
    # 2.74:
    #
    # Lands:
    #
    # Fixed an error that arose when the number of continents selected for generating mountain ranges (using 'ranges') was one less than the number of continents generated.
    #-----------------------------------------------------------------------------------------------#
    # 2.75:
    #
    # Lands:
    #
    # Fixed an error that arose when only one continent was to be generated.
    #
    # Resources:
    #
    # Fixed an error that arose when 'Resources' was set to 'standard - ignore resource options'.
     
  3. Thedrin

    Thedrin Chieftain

    Joined:
    Jan 24, 2002
    Messages:
    2,649
    Location:
    London
    Screenshots:

    Standard size.
    2-4 landmasses.
    5-8 continents.
    Randomly ditributed continents.
    60-70% ocean.
    No overseas trade before astronomy.
    Normal hills and peaks.
    Mountain ranges.
    Normal changes in altitude.





    -----------------------------------------------

    Standard size.
    3-6 landmasses.
    6-10 continents.
    Randomly ditributed continents.
    40-80% ocean.
    4 tiles of seperating land masses - No overseas trade before astronomy.
    Normal hills and peaks.
    Mountain ranges.
    Normal changes in altitude.



     
  4. Thedrin

    Thedrin Chieftain

    Joined:
    Jan 24, 2002
    Messages:
    2,649
    Location:
    London
    New version available at the top of the page.

    Changes:

    # Terrain changes:
    #
    # Selecting Rocky climate no longer affects the terrain.
    # Introduced three new hill and peaks setting; Highlands few, Highlands normal, and Highlands many. I've only used estimates to determine the appropriate percentages in these cases. If someone has the actual figures I'd appreciate them.
    #
    # Resource changes:
    #
    # Created a master resource option, 'Resources'.
    # - Standard will use the standard CivIV recourse placement code. The Resource Land Mass, Resource Tiles, and
    # Resource Quantities options are rendered ineffective.
    # - Custom activates the Resource Land Mass, Resource Tiles, and Resource Quantities options.
    #
    # Divided resources options into two:
    # - Resource Land Mass
    # - Resource Tiles
    # Resource Land Mass determines which resources are assigned to specific land masses.
    # - 'Standard' assigns health and luxury resources to specific land masses.
    # - 'LandMasses' assigns the same resources to specific land masses as it did previously.
    # - 'LandMasses, isolate horses' is the same as 'LandMasses' but it also assigns horses to a specific land mass.
    # - 'No isolated resources' allows all resources to be placed on all land masses.
    # Resource Tiles determines which tiles a resource can be assigned to.
    # - 'Standard' assigns resources to normal CivIV locations.
    # - 'LandMasses' assigns the same resources to the same tile types as it did previously.
    # - 'Crazy' assigns a resource to any tile which can be improved to take advantage of the resource.
    # Setting both options to 'Standard' will cause LandMasses to use the default resource placement code.
    # Setting only one option to 'Standard' will cause LandMasses to attempt to mimic the effects of the default resource placement code.
    #
    # Added the option 'Resource Quantities'. This allows the number of resources to be altered.
    # - 'Normal resources': the no. of resources is between half the no. of players and one short of the no. of players.
    # - 'Few resources': Only half as much of each resource are generated.
    # - 'Many resources': Twice as much of each resources are generated.
    # Further notes on this option:
    # - if 'Standard' has been set for both Resource Land Mass and Resource Tiles then Resource Quantities is ignored.
    # - The script may not place all of the resources that it sets out to.
    # - The fewer resources generated, the more likely that the civ starting placement code may add in resources. This will noticably reduce the effects of some of the choices for Resource Land Mass, 'LandMasses', 'LandMasses, isolate horses', and, if 'Standard' has not been selected for Resource Tiles, 'Standard'.
    #
    # The odds of a resource being placed on any given tile reduce as the number of that resource in the fat cross centred around that tile increase.
    # The odds of a resource being placed on any given tile reduce as the number of all resources in the fat cross centred around that tile increase.
     
  5. Thedrin

    Thedrin Chieftain

    Joined:
    Jan 24, 2002
    Messages:
    2,649
    Location:
    London
    The code posted earlier today contained an error which affected the distance between land masses. The corrected map script has now been uploaded.
     
  6. Thedrin

    Thedrin Chieftain

    Joined:
    Jan 24, 2002
    Messages:
    2,649
    Location:
    London
    New version uploaded and available at the top of the page.

    Changes:

    # Beginning work on terrain options. Since my previous undocumented attempt at this (a few months ago) was a spectacular failure, I'll be going very slowly. For now only a few, unlikely-to-be-used, options are included.
    #
    # Terrain:
    # - Standard: uses normal terrain generation. Deactivates all terrain options.
    # - Custom: Activates all terrain options.
    # Terrain Type:
    # - all grass, all plains, all desert, all tundra, and all snow.
    # - fantasy - randomly placed terrrain tiles.
    #
    # Resources:
    # Aquatic resources will no longer be generated beneath ice.
     
  7. Good Sauce

    Good Sauce (TM)

    Joined:
    Jan 1, 2006
    Messages:
    284
    Location:
    Athens, GA
    I like where you're going with this, but I've tried various options and I either CTD or get a single tile island with all the civs crammed onto it.
     
  8. Thedrin

    Thedrin Chieftain

    Joined:
    Jan 24, 2002
    Messages:
    2,649
    Location:
    London
    Edit: newly uploaded code available at the top of the thread which may fix your problem, Good Sauce. The next post after this one details the change made. If it doesn't work the problem may be listed in this post.

    #-----------------------------------------------------------------------------------------------#

    What options are you selecting? Is it the result of a specific set of option choices or does it always occur?

    The problem seems to be in the land generation code. Going by the problems you have it could be any of the following:

    1) Corrupted download.
    2) I checked the generation of Pangaeas (since you said all civs were generated on a single one tile island rather than multiple single tile islands). I had problems with it as well. Pangaeas are generated using different code to multiple land mass maps. It did used to work but I haven't deliberately made an alteration to it since December. Maybe I accidently changed something in the last fortnight. Edit: More specifically the problem occurs when only 1 continent is to be generated. Generating 1 land mass with multiple continents should work fine.
    3) You're selecting two of the following: too many land masses, too large a seperation between land masses, or too small a map size. Selecting a duel sized map (40x24), 10 landmasses, and 12 tiles of seperation will never work but the combinations of each of these options that can be combined succesfully are untested. It is probably never worth selecting a landmass seperation value greater than 'no overseas trade before astronomy'.
    4) You're trying to create a really massive map. It's a couple of months since I last looked at the land generating code in detail but as I recall, the generation of very large maps could stand to be a lot more efficient, where very large would be (in my experience) huge (128x80) and above.

    I'll look into the generation of Pangaea maps further but, as a test, would you be able to try the following please?

    Size: Duel (2 civs)
    Min Width: 64 - Continents Small
    Max Width: no variation
    Min Height: 40 - Continents Small
    Max Height: no variation
    Min LandMasses: 2 landmasses
    Max LandMasses: no variation
    Min Continents: 5 continents
    Max Continents: no variation
    Continent Distribution: evenly ...
    Min. LandMass Buffer: No overseas trade before astronomy
    Max. LandMass Buffer: no variation
    Hills: normal
    Peaks: normal
    Mountain Ranges: Yes
    Terrain: standard - ignore terrain options
    Resources: standard - ignore resource options

    A further question. If you generate a map with only single tile islands again could you tell me both how many landmasses and continents you had selected and how many single tile islands were generated.

    Thanks.
     
  9. Thedrin

    Thedrin Chieftain

    Joined:
    Jan 24, 2002
    Messages:
    2,649
    Location:
    London
    Corrected a [really really] dumb mistake preventing the generation of single land mass, single continent pangaeas.

    At no point in map generation should the code attempt to generate just one single tile island unless the user has tried to generate a single land mass, single continent pangaea. The problem you have with the code may lie elsewhere but I'm hoping the newly uploaded code fixes your problem.
     
  10. Thedrin

    Thedrin Chieftain

    Joined:
    Jan 24, 2002
    Messages:
    2,649
    Location:
    London
    New version uploaded and available at the top of the page.

    Changes:

    # Lands:
    #
    # Added 'Coastlines' option. A rugged coastline increses the number of islands and archipelagos.
    # - Standard: Prior to the introduction of the coastlines option, this was the usual implementation.
    # - Rugged: Lots of coastal islands. Lands that were narrow under the standard setting may be broken up into archipelagos.
    # Notes:
    # - the effectiveness of this option depends a great deal on how much space is designated towards land, ocean, and seperation between landmasses. Selecting a low ocean percentage and a high seperation between land masses will reduce the effects of the coastline option to irrelevance.
    # - it is possible for large pieces of land which previously formed a single landmass to be seperated from each other. If these lands become seperated by ocean (and not just coastal tiles) then they should be treated as seperate land masses by the resource generator. In short, you may get more land masses than you intended. The odds of this happening are much more likely with coastlines set to rugged but still possible (I've never seen it) under standard coatlines.
    #
    # The Ocean and Distance between land masses have been swapped around on the custom menu screen. This is so that the options related to the ratio of ocean tiles to land tiles are placed in order of importance:
    # 1) Seperation Between Land Masses - land will only be placed if it doesn't go to close to other land masses. If the minimum seperation is sufficiently large enough there may not be enough space to reach the ocean percentage. For example, if the minimum seperation between land masses is set to 12 and the ocean percentage is set to 20%, the code will stop placing land tiles long before 80% of the map has been assigned a land tile. This does not include Pangaeas since the land mass seperation only affects the placement of tiles from different land masses.
    # 2) Ocean: If the land mass seperation leaves enough space for the ocean/land ratio to be met then it should happen.
    # 3) Coasts: The ruggedness of the coast depends on how much extra space there is for land after the ocean/land ratio set by the ocean option has been met. If there is no more space the land masses will be smooth. Selecting rugged will only have a noticeable affect beyond that of standard if there is plenty of room for extra land.
    #
    # Resources:
    #
    # Added options to give control over the quantities of strategic, health, and luxury resources. Ivory, spices, sugar, and wine are classified as luxuries.
    # Improved land mass placement of isolated resources. Resources selected for isolation are far less likely to appear on multiple land masses. The placement of resources on multiple land masses due to the civ placement code is unaffected.
    # Aquatic resources should no longer appear on lakes.

    #-----------------------------------------------------------------------------------------------#

    Screenshots to demonstrate how the effect of the coastline option changes with ocean and land mass seperation:

    All of the following images are of maps with the following settings:

    Standard size
    3 land masses
    7 continents
    Evenly distributed continents


    12 tiles of seperation between land masses, 50% ocean, standard coastline on the left, rugged coastline on the right.


    12 tiles of seperation between land masses, 70% ocean, standard coastline on the left, rugged coastline on the right.


    7 tiles of seperation between land masses, 70% ocean, standard coastline on the left, rugged coastline on the right.
     
  11. Seth145

    Seth145 Chieftain

    Joined:
    Nov 19, 2006
    Messages:
    26
    Location:
    Australia
    Hi

    Tried your map script through custom game and no matter what combination of continents, every start has every one starting next to each other.
     
  12. Thedrin

    Thedrin Chieftain

    Joined:
    Jan 24, 2002
    Messages:
    2,649
    Location:
    London
    Ok, thanks for letting me know.

    Are no continents being generated causing all civs to be generated on a single tile or are the continents being formed with civs being placed very closely to each other?

    The only two responses in this thread report a problem (which may be the same problem). Is this universal or has anyone gotten this script working? The script works fine for me so I really don't know what's going on and, for now, don't know how to go about fixing it.

    Also, I did recieve positive reports on version 1.2 (at the top of the thread) back in December (at another site). But for the lack of resource options it's almost identical.
     
  13. SGDave

    SGDave Chieftain

    Joined:
    Dec 13, 2005
    Messages:
    6
    The new version script is working fine for me, thanks for your hard work Thedrin! :goodjob:

    A couple of requests though, is it possible to have an option where the distance between different landmasses is random (in a certain range), rather than the current fixed separation distance between all landmasses when the map is generated? Also how about a middle option for the rugged coastline, e.g not so rugged as the rugged option now? Thanks!
     
  14. Thedrin

    Thedrin Chieftain

    Joined:
    Jan 24, 2002
    Messages:
    2,649
    Location:
    London
    Thank you.

    Land mass seperation:

    This would be possible. Hadn't thought of that before. It would be especially useful for high land/low ocean content maps which tend to feature highly parallel coastlines. It should also allow for more rugged coastlines without requiring the use of the 'rugged' option.

    Coastlines:

    Rugged is only a recently concieved idea so I'm not yet sure how far I can go with that it - I think it's range is limited. It may be possible (and I will be looking into it) but for the moment the best advice I can give is to experiment with the different ocean settings. But, as I said above, adding new range choices to the land mass seperation option should increase coast line ruggedness.
     
  15. Thorn

    Thorn Chieftain

    Joined:
    Jan 5, 2002
    Messages:
    811
    Location:
    Project Tic-Toc
    Hey Thedrin,

    This has become my favorite map script! Awesome job! :goodjob:

    Another option I think would be cool is if you could have even more control over the resource placement, especially the strategic ones. Would there be a way to specify the exact number of resources to place? For instance, set Uranium = 5 to randomly place 5 Uraniums on the map. Oil = 7, Iron = n, etc. etc. Another option would be to restrict the placement of those resources even further. Example: Of the 5 Uraniums, only put them on x of n continents. That is, Uranium = 5, then randomly place the 5 Uraniums only on 2 (of the 6) continents.

    The random distance between landmasses mentioned below sounds interesting as well.

    :thanx:
     
  16. Thedrin

    Thedrin Chieftain

    Joined:
    Jan 24, 2002
    Messages:
    2,649
    Location:
    London
    On resources:

    I've thought about how to do these kind of thing previously and, without adding huge (really - loads and loads of options) quantities of extra options to the custom game menu, I don't think it's possible. I'm not sure I want to put in so many options but I would certainly consider adding an easy-to-find-and-edit piece of code to the beginning of the script. This would require a Python editor (I use IDLE). It's probably possible to include a Word file in the zip file. This would be much easier for the usr to take advantage of.

    This applies both to setting the number of a specific resource and the continent distribution of resources. It can also apply to what type of tiles a resource can be placed upon.
     
  17. Thorn

    Thorn Chieftain

    Joined:
    Jan 5, 2002
    Messages:
    811
    Location:
    Project Tic-Toc
    Yes, if you could point me in the right direction I will try to customize your original .py file to add the Resource option I described above. ;)
     
  18. Thedrin

    Thedrin Chieftain

    Joined:
    Jan 24, 2002
    Messages:
    2,649
    Location:
    London
    Land Mass Seperation:

    I didn't alter the way this works. I tested out the change and realised that it produced coastlines that were effectively the same.

    Detailed reason. LandMasses places the required percentage of land and then fills in all lakes (but not inland seas) that have formed. This increases the amount of land above the required level so land tiles are removed from the coast. Say the change had been made and you asked the script to produce a map where continents are seperated by between 7 and 9 tiles of ocean. This would effectively be the same as asking the current script to produce a map where continents are seperated by 7 tiles of ocean. The difference would be that occasional tiles wouldn't be placed (due to some requiring a 9 tile seperation) so that there would be less land tiles to remove from the coast later on.
     
  19. Thedrin

    Thedrin Chieftain

    Joined:
    Jan 24, 2002
    Messages:
    2,649
    Location:
    London
    New version uploaded and available at the top of the page.

    Changes:

    # Lands:
    #
    # Added a third choice to the Coastlines option. Rougher' produces more rugged coasts than standard but smoother coasts than rugged. Like the other two choices available, the effectiveness of the option is based on the choices selected for Land Mass Seperation and Ocean.
    #
    # Resources:
    #
    # Added 'custom' choice to all resource options which allows a Python user to much more easily edit how resources are placed. The code which needs to be edited can be found under the heading CUSTOMISING RESOURCE PLACEMENT at the top of the LandMasses.py map script. Instructions can be found there explaining how to edit the resource placement.
    # Custom 'Resource LandMasses' allows the user to select the resources which will be limited to one continent. By default, custom produces the same results as LandMasses.
    # Custom 'Resource Tiles' allows the user to select the tiles a resource can be placed on. By default, custom produces the same results as LandMasses.
    # Custom 'Strategic Quantities' allows the user to select the number of each strategic resource. By default, custom produces the same results as normal strategic resources.
    # Custom 'Health Resources' and custom 'Luxury Resources' options work in the same way as custom 'Strategic Resources.

    To make use of the customisable resource options you'll need a Python editor. I use the one found here:

    Python

    1) Download python from the above link.
    2) Go to
    C:\Program Files\Firaxis Games\Sid Meier's Civilization 4\Public Maps
    or
    C:\Program Files\Firaxis Games\Sid Meier's Civilization 4\Warlords\Public Maps
    depending on which version of CivIV you are using. LandMasses.py should be in the folder you go to.
    3) Right click LandMasses.py. Select 'Edit with IDLE'.
    4) The heading CUSTOMISING RESOURCE PLACEMENT (line 18) marks the beginning of the instructions for customising resource placement.
     
  20. Thorn

    Thorn Chieftain

    Joined:
    Jan 5, 2002
    Messages:
    811
    Location:
    Project Tic-Toc
    Wow, thanks again! Excellent job of commenting.:bowdown:
    I'll try playing around with this after work to see if I can distribute the resources the way I want.

    [Thorn goes back to watching the clock...]:(
     

Share This Page