Terra Map

My bad, I've updated the OP, I didn't manage to write the random option for "multiple scripts", that choice is available for the "two scripts" option only.
Thanks for the fast response. Will the random option for multiple scripts be added in the future?
 
maybe, but not anytime soon I'm afraid.
 
Good news!
Ynamp 6.2 maps (including my favourite - Terra at ludicrous size) can be made to
work with the Linux release of the Fall Update using the same tricks as used
before, i.e. lowercase naming of include files, and deleting the Override
subdirectory.

Better News!
It will require a lot of "testing".
 
As I said before, I love your terra map! I really hope you'll allow the new archipelago mapscript in R&F as base for the old (and possibly new) world.
It's beautiful and realistic, but it would need larger oceans to allow interaction between all civs, especially at the map borders. In the unmodded game, the bodies of water are to small overall and not always connected.
 
It seems to me that using the Terra Map script, I am getting noticeably fewer hills across the map compared with vanilla scripts and Detailed Worlds (even if the world age is set to New). Could you look into this, Gedemon?
 
It seems to me that using the Terra Map script, I am getting noticeably fewer hills across the map compared with vanilla scripts and Detailed Worlds (even if the world age is set to New). Could you look into this, Gedemon?
I'll have a look, but unsure of the cause. I'll do some stats first.
 
It seems to me that using the Terra Map script, I am getting noticeably fewer hills across the map compared with vanilla scripts and Detailed Worlds (even if the world age is set to New). Could you look into this, Gedemon?
I've looked into the Terra map script and think I've found the problem. The script switches old world age to new world age and vice versa, meaning that if you set world age to new for more hills, you'll actually get an old world with less hills.

EDIT: this is the piece of code in TerraMap.lua that I was talking about.

Code:
function GeneratePlotTypes()
    print("Generating Plot Types");
    local plotTypes = {};
    local world_age_new = 3;
    local world_age_normal = 2;
    local world_age_old = 1;

    local water_percent_modifier = 0;

    --    local sea_level
    local sea_level = MapConfiguration.GetValue("sea_level");
    if sea_level == 1 then -- Low Sea Level
        water_percent_modifier = -4
    elseif sea_level == 2 then -- Normal Sea Level
        water_percent_modifier = 0;
    elseif sea_level == 3 then -- High Sea Level
        water_percent_modifier = 4;
    else
        water_percent_modifier = TerrainBuilder.GetRandomNumber(9, "Random Sea Level - Lua") - 4;
    end

    --    local world_age
    local world_age = MapConfiguration.GetValue("world_age");
    if (world_age == 1) then
        world_age = world_age_new;
    elseif (world_age == 2) then
        world_age = world_age_normal;
    elseif (world_age == 3) then
        world_age = world_age_old;
    else
        world_age = 1 + TerrainBuilder.GetRandomNumber(3, "Random World Age - Lua");
    end
    print("world_age = ", world_age);
 
Last edited:
Interesting find! However, if you choose regular world age and compare Terra with another script with the same setting, it feels like hills are a lot less frequent...
 
Interesting find! However, if you choose regular world age and compare Terra with another script with the same setting, it feels like hills are a lot less frequent...

I agree.

Do you reckon the same goes for mountains? because I do. If this map script would generate mountain ranges like PerfectWorld or Got Lakes? does, it would pretty much be perfect for me. I wish I could mod that in but unfortunately I have no modding experience.
 
I've looked into the Terra map script and think I've found the problem. The script switches old world age to new world age and vice versa, meaning that if you set world age to new for more hills, you'll actually get an old world with less hills.

EDIT: this is the piece of code in TerraMap.lua that I was talking about.

Code:
function GeneratePlotTypes()
    print("Generating Plot Types");
    local plotTypes = {};
    local world_age_new = 3;
    local world_age_normal = 2;
    local world_age_old = 1;

    local water_percent_modifier = 0;

    --    local sea_level
    local sea_level = MapConfiguration.GetValue("sea_level");
    if sea_level == 1 then -- Low Sea Level
        water_percent_modifier = -4
    elseif sea_level == 2 then -- Normal Sea Level
        water_percent_modifier = 0;
    elseif sea_level == 3 then -- High Sea Level
        water_percent_modifier = 4;
    else
        water_percent_modifier = TerrainBuilder.GetRandomNumber(9, "Random Sea Level - Lua") - 4;
    end

    --    local world_age
    local world_age = MapConfiguration.GetValue("world_age");
    if (world_age == 1) then
        world_age = world_age_new;
    elseif (world_age == 2) then
        world_age = world_age_normal;
    elseif (world_age == 3) then
        world_age = world_age_old;
    else
        world_age = 1 + TerrainBuilder.GetRandomNumber(3, "Random World Age - Lua");
    end
    print("world_age = ", world_age);
no, I know it's a bit odd, but AFAIK I used the same order than the standard mapscripts, see Continent.lua

I've lowered some values a bit, because there was too many mountains in some region (I love to have some mountain range, but I don't like when it's 2-3 tiles wide), maybe because of the way I call some of the map function to use on regions of the map instead of the full grid (the ratio is maybe applied based on the grid size, IDK, I do want to do a new pass on that script sometime in the future, it needs it)

You can have a look at the vanilla continent script and restore the original values and see how it goes for you (search for "world_age")
 
First of all I wanted to say that this is a great map script and I enjoyed it very much!
Wanted to ask the other players: Does the AI in your games settle the new world?
In my current game (marathon): third to caravels more than 50 turns after the first one, but my swordsman was the first to meet the new world city states, and now in modern era I'm still the only one with cities in America.
 
Hey Gedemon, is there a print function I can throw into map scripts so I can see (1) the total number of land tiles a map script generates and (2) the number of hill tiles a map script generates?

I want to use it and test a variety of map scripts and see if my observation about Terra having fewer hills is just my imagination or real :D

Also, is there a function I can add into the Terra lua to increase hills or something?
 
Code:
    local iPlotCount = Map.GetPlotCount()
    local water    = 0
    local land    = 0
    local hills = 0
    for iPlotLoop = 0, iPlotCount-1, 1 do
        local plot = Map.GetPlotByIndex(iPlotLoop)
        if plot then
            if plot:IsHills() then
                hills = hills + 1
            end
            if plot:IsWater() then
                water = water + 1
            else
                land = land + 1
            end
        end
    end
    print("Water plots     = ", water)
    print("Land plots     = ", land)
    print("Hills plots     = ", hills)

A simple function ?
no.

Or maybe copy/paste/adapt/call the AddLonelyMountains function from MountainsCliffs.lua in "Steam\steamapps\common\Sid Meier's Civilization VI\Base\Assets\Maps\Utility\"
 
Thanks so much Gedemon! I really appreciate your help :) I will report back what I find - maybe I am imagining everything...
 
Okay, so I wasn't able to get that function working properly but I hand-counted 2 random YNAMP Terra maps (default settings except Natural Wonders set to Generator, not import) and 3 random Continents maps. I used Small (2:1) for both.

Terra definitely produces fewer hills relative to the amount of land plots. For each Continents map, hills made up about 22% of land tiles (ranging from 21.6 to 22.9%). For Terra, hills made up only about 14-15% of land tiles. Interestingly, the amount of mountain tiles seemed consistent.

Here's a screenshot of what I'm talking about. I circled the only two hills I could see on that vast swath of land.

hills.png

Is there any chance you can revisit this script for this issue? I don't know if this is helpful at all, but Detailed Worlds has a function that adds more hills:


Code:
-- 705: Found a good map, now we can loop through every tile and add additional details
    print("-");
    local plotDataIsCoastal = GenerateCoastalLandDataTable();
    local hillsAdded = 0;
    local mountainsAdded = 0;
    local mountainsFilled = 0;
 
    for x = 0, g_iW - 1 do
        for y = 0, g_iH - 1 do
            local i = y * g_iW + x;
            -- 705: First, clean up the rare case of a non mountain plot surrounded by mountains
            if(plotTypes == g_PLOT_TYPE_LAND or plotTypes == g_PLOT_TYPE_HILLS) then
                local mountainCount = 0;
                for direction = 0, DirectionTypes.NUM_DIRECTION_TYPES - 1, 1 do
                    local adjacentPlot = Map.GetAdjacentPlot(x, y, direction);
                    if adjacentPlot ~= nil then
                        local newIndex = adjacentPlot:GetIndex();
                        if(plotTypes[newIndex] == g_PLOT_TYPE_MOUNTAIN) then
                            mountainCount = mountainCount + 1;
                        end
                    end
                end
            
                if(mountainCount == 6) then -- surrounded by mountains
                    plotTypes = g_PLOT_TYPE_MOUNTAIN;
                    mountainsFilled = mountainsFilled + 1;
                end
            end
        
            -- 705: Detailed hills and mountains pass
            -- Add extra hills in vast flatlands
            -- Change hills into mountains or flat land in vast hilly areas
        
            local rChance = 1 + TerrainBuilder.GetRandomNumber(3, "Add hills - LUA Mixed Continents");
        
            if(plotDataIsCoastal == false) then
                local hillCount = 0;
                for direction = 0, DirectionTypes.NUM_DIRECTION_TYPES - 1, 1 do
                    local adjacentPlot = Map.GetAdjacentPlot(x, y, direction);
                    if adjacentPlot ~= nil then
                        local newIndex = adjacentPlot:GetIndex();
                        if(plotTypes[newIndex] == g_PLOT_TYPE_HILLS) then
                            hillCount = hillCount + 1;
                        end
                    end
                end
            
                -- Add hill to flatland areas
                if(hillCount < 3 - rChance and plotTypes == g_PLOT_TYPE_LAND) then
                    plotTypes = g_PLOT_TYPE_HILLS;
                    hillsAdded = hillsAdded + 1;
                end
            
                -- Add mountain or remove hill in hilly areas
                if(hillCount > 3 + rChance and mountainsAdded < world_age * 10) then
                    plotTypes = g_PLOT_TYPE_MOUNTAIN;
                    mountainsAdded = mountainsAdded + 1;
                elseif(hillCount > 3 + rChance) then
                    plotTypes = g_PLOT_TYPE_LAND;
                end
        
            end
        end
    end
 
    print("-");
    print("--- Details pass");
    print("-    Mountain Holes Filled:", mountainsFilled);
    print("-              Hills added:", hillsAdded);
    print("-          Mountains added:", mountainsAdded);

EDIT: I managed to add this code TerraMap.lua and it made a huge difference :)
 
Last edited:
@Gedemon

The release of the Maori civ would be an excellent opportunity to test any improvements made to the Terra map.

The Maori could very easily have entire landmasses to themselves! In the Ancient Era!
 
I have been testing the resource placement for Terra Map on Giant size using default landmasses and Earth-shaped continents. I have seen a lot of people saying that resource placement is really off on the earth-maps and I wanted to check and see what it looks like. I ran about 8 total starts... 4 on earth-shaped and 4 on default landmasses. I've attached two LUAs that show basically how all of them ended up. Earth-shaped continents has a huge over-abundance of bonus resources and very few luxuries mostly except for random large numbers of one or two, but all of them are clumped in a couple of areas. Strategic resources are almost non existent. Default has a more even spread. I tried with resource exclusion zones both on and off.
 

Attachments

Hi there
Very strong script for map generation.
But I have some issues with resources. Pearls / Whales / Turtles - only 2 of them appears on the map. 1 of 10 cases when you may have all 3

Btw, I cannot see Pearls / Whales / Turtles in diagnostics log in statistics even 2 of 3 are on the map
 
Last edited:
Hi
Great mod, though had a problem starting a Terra map on Enormous. Let number of civs be the default, and changed only the setting for map script to "earth like continents". Get a dialogue box saying to try removing some mods and checking the lua.log file for error. Stack trace seems tell me it fails trying to place the new ocean-civ (forget name) on the map. Could it be because number of civs mess up the map script to contain only land? Could it be that some mod is indeed the culprit (played a game on huge terra map without the issues though.

Though lua log is attached... the error seems to be in the following lines:

Runtime Error: E:\SteamLibrary - Other Games\steamapps\workshop\content\289070\871861883\Override\AssignStartingPlots.lua:5487: attempt to index a nil value
stack traceback:
E:\SteamLibrary - Other Games\steamapps\workshop\content\289070\871861883\Override\AssignStartingPlots.lua:5487: in function 'SetOceanStartingLocation'
E:\SteamLibrary - Other Games\steamapps\workshop\content\289070\871861883\Override\AssignStartingPlots.lua:5516: in function 'YnAMP_StartPositions'
E:\SteamLibrary - Other Games\steamapps\workshop\content\289070\871861883\Override\AssignStartingPlots.lua:251: in function 'AssignStartingPlots.Create'
E:\SteamLibrary - Other Games\steamapps\workshop\content\289070\871861883\Maps\TerraMap\TerraMap.lua:656: in function 'GenerateMap'
[C]: in function '(anonymous)'
Lua callstack:
Runtime Error: Call to GenerateMap() had errors
stack traceback:
[C]: in function '(anonymous)'
LoadScreen: OnLoadGameViewStateDone
Mods: Failed to create mods browser search context!

EDIT: Note that the "default" number of civs is whatever number it changes to when i change map size to enormous.
EDIT EDIT: Sry about the formatting. How do I place a section in a "code" box?
 

Attachments

Last edited:
Hi
Great mod, though had a problem starting a Terra map on Enormous. Let number of civs be the default, and changed only the setting for map script to "earth like continents". Get a dialogue box saying to try removing some mods and checking the lua.log file for error. Stack trace seems tell me it fails trying to place the new ocean-civ (forget name) on the map. Could it be because number of civs mess up the map script to contain only land? Could it be that some mod is indeed the culprit (played a game on huge terra map without the issues though.

Though lua log is attached... the error seems to be in the following lines:

Runtime Error: E:\SteamLibrary - Other Games\steamapps\workshop\content\289070\871861883\Override\AssignStartingPlots.lua:5487: attempt to index a nil value
stack traceback:
E:\SteamLibrary - Other Games\steamapps\workshop\content\289070\871861883\Override\AssignStartingPlots.lua:5487: in function 'SetOceanStartingLocation'
E:\SteamLibrary - Other Games\steamapps\workshop\content\289070\871861883\Override\AssignStartingPlots.lua:5516: in function 'YnAMP_StartPositions'
E:\SteamLibrary - Other Games\steamapps\workshop\content\289070\871861883\Override\AssignStartingPlots.lua:251: in function 'AssignStartingPlots.Create'
E:\SteamLibrary - Other Games\steamapps\workshop\content\289070\871861883\Maps\TerraMap\TerraMap.lua:656: in function 'GenerateMap'
[C]: in function '(anonymous)'
Lua callstack:
Runtime Error: Call to GenerateMap() had errors
stack traceback:
[C]: in function '(anonymous)'
LoadScreen: OnLoadGameViewStateDone
Mods: Failed to create mods browser search context!

EDIT: Note that the "default" number of civs is whatever number it changes to when i change map size to enormous.
EDIT EDIT: Sry about the formatting. How do I place a section in a "code" box?
try to change the line 5487 in the file "E:\SteamLibrary - Other Games\steamapps\workshop\content\289070\871861883\Override\AssignStartingPlots.lua" (you can use any text editor, I use Notepad++) from
Code:
        if (GameInfo.Leaders_XP2 and GameInfo.Leaders_XP2[LeaderTypeName] ~= nil and GameInfo.Leaders_XP2[LeaderTypeName].OceanStart == true) then
to
Code:
        if (LeaderTypeName and GameInfo.Leaders_XP2 and GameInfo.Leaders_XP2[LeaderTypeName] and GameInfo.Leaders_XP2[LeaderTypeName].OceanStart == true) then
 
Back
Top Bottom