Communitu_79

Code:
odds = mg.featurePercent
    if plot:IsFreshWater() then
        odds = odds + mg.featureWetVariance
    else
        odds = odds - mg.featureWetVariance
    end

--    Increase chance for features when there are other features nearby already.
    --print("odds before forest", odds)
    for nearPlot in Plot_GetPlotsInCircle(plot, 0, 2) do
        local nearFeatureID = nearPlot:GetFeatureType() 
        --[[     
        if nearFeatureID == FeatureTypes.FEATURE_FOREST then
            odds = odds * math.min(1.2, (1 + 3 * mg.featurePercent / 4.0))
        elseif nearFeatureID == FeatureTypes.FEATURE_JUNGLE or nearFeatureID == FeatureTypes.FEATURE_MARSH then
            odds = odds * math.min(1.3, (1 + 5 * mg.featurePercent / 4.0))
        end     
        --]]
        if nearFeatureID ~= FeatureTypes.NO_FEATURE then
            odds = odds + 0.10
        elseif nearPlot:GetTerrainType() == TerrainTypes.PLOT_HILLS or nearPlot:IsMountain() then
            odds = odds - 0.02
        end
    end
    --print("odds after forest", odds)

This part you added made it so that when map is wet, it has a 100% chance of spawning features near another tile with feature if the tile is near fresh water and 95% if not.

Also, there is code forcing jungle hills into grass and jungle non-hills into plains. No idea why.

"odds + mg.featureWetVariance" this part is not mine. It's in old Communitas. The logic is to increase forest around fresh water. I reduced this effect and allowed more forest without fresh water.
Actually, what I added is this
Code:
        if nearFeatureID ~= FeatureTypes.NO_FEATURE then
            odds = odds + 0.10
        elseif nearPlot:GetTerrainType() == TerrainTypes.PLOT_HILLS or nearPlot:IsMountain() then
            odds = odds - 0.02
        end
It increases 10% the chance of placing a feature for each feature already present, and reduces it 2% for each hill or mountain, in a 2 tiles radious. The result is nice at low values of featurePercent. When this function is called, half the tiles aren't placed yet, so values are not that high as they seem. The proof is that in a normal map (featurePercent= 0.26, featureWetVariance = 0.05), there are patches of unforested grassland.

There's another function that adds forests, using forestRandomPercent:
Code:
function IsGoodExtraForestTile(plot)   
    local x, y        = plot:GetX(), plot:GetY()   
    local odds        = mg.forestRandomPercent
    local terrainID = plot:GetTerrainType()
    local resID        = plot:GetResourceType()
    if not plot:CanHaveFeature(FeatureTypes.FEATURE_FOREST) then
        return false
    end
    
    if terrainID == TerrainTypes.TERRAIN_TUNDRA then
        if resID ~= -1 then
            return true
        end
        if plot:IsFreshWater() then
            odds = odds + mg.featureWetVariance
        end
    end
    
    -- Avoid filling flat holes of tropical areas, which are too dense already
    if not plot:IsHills() and Contains(mg.tropicalPlots, plot) then
        odds = odds - 0.30
    end
    
    for nearPlot in Plot_GetPlotsInCircle(plot, 1, 1) do
        local nearTerrainID = nearPlot:GetTerrainType()
        local nearFeatureID = nearPlot:GetFeatureType()
        
        if nearPlot:IsMountain() then
            -- do nothing
        elseif nearPlot:IsHills() then
            -- Region already has enough production and rough terrain
            odds = odds - 0.10
        elseif nearTerrainID == TerrainTypes.TERRAIN_SNOW then
            -- Help extreme polar regions
            odds = odds + 0.2
        elseif nearTerrainID == TerrainTypes.TERRAIN_TUNDRA then
            odds = odds + 0.1
        elseif terrainID == TerrainTypes.TERRAIN_TUNDRA and Plot_IsWater(nearPlot) then
            odds = odds + 0.1
        end   
        
        -- Avoid tropics
        if Contains(mg.tropicalPlots, nearPlot) then
            odds = odds - 0.10
        end
        
        -- Too dry
        if nearTerrainID == TerrainTypes.TERRAIN_DESERT then
            odds = odds - 0.20
        end
    end
    
    if 100 * mg.featurePercent * math.min(1, odds) >= Map.Rand(100, "Add Extra Forest - Lua") then
        --plot:SetFeatureType(FeatureTypes.FEATURE_FOREST, -1)
        return true
    end
    
    return false
end

Also, there is code forcing jungle hills into grass and jungle non-hills into plains. No idea why.
Me neither. I saw it too, but I don't know if that's intented. Maybe the coder thought that once we chopp the jungle, we'd like it better like that. Remember that in vanilla, flat grassland was disappointing due to low production.
Another thing that bothers me, and I don't know if it is intended either, it's forests on tundra having just 1 food. I'm used to see forest with minimum 2 food in other maps, but I don't know what is the actual standard value.
 
Forests just add 1P to the base terrain, ignoring hills.

Btw, the rainfall option is also used for plains and desert percent, so you can't just remove that. I'll try to tweak all of the odds this weekend.
 
I won't start working until weekend, so I guess you can upload the next version here first before that.
 
Is it true that you can just places map scripts into "/Documents/My Games/Sid Meier's Civilization 5/Maps" regardless of what it is? It seems the modpack versions simply designate how many civs are on each map size which can be done manually. I see different responses to this in the forums.
 
Map mods can also make sure you're using mods the map depends on.

New version sneak peek:

Spoiler Temperature=Cool, otherwise default settings :
4SmdEHy.png

Islands near the poles are much less likely to get blocked off by ice now. Ice also doesn't get randomly placed everywhere in the water. However, it's still possible to have some sea resources trapped by ice blocks. Still thinking of a way to unblock those inner seas surrounded by land and ice.

Spoiler :
kDptLXw.png

Continents are still unbalanced. Sometimes 3 civs share a tiny continent (as above) and sometimes all 8 civs are in the same one.
 
There are 5 ambers on the island, just enough for the monopoly. If they can get rid of Siam, that is.
 
Important question (that I just realized):

Communitas (and Communitu_79) currently overwrites the resource placement logic from AssignStartingPlots.lua, that is already modded by VP. Since Communitas was not built for VP, its resource placement was tuned for the CEP mod, possibly resulting in the abundance of resource on the map.

If we continue modding this part, we're stepping into modmod territory, which could cause balance issues for having too many/too few resources compared to playing on a vanilla map. The ideal way to handle this would be to separate the map building part (terrain etc.) from the resource replacement. Maybe @Gazebo can look into this and either incorporate our changes into VP (AssignStartingPlots.lua hasn't been modified for a looooong time according to GitHub history), or we can make this part a proper modmod.
 
Important question (that I just realized):

Communitas (and Communitu_79) currently overwrites the resource placement logic from AssignStartingPlots.lua, that is already modded by VP. Since Communitas was not built for VP, its resource placement was tuned for the CEP mod, possibly resulting in the abundance of resource on the map.

If we continue modding this part, we're stepping into modmod territory, which could cause balance issues for having too many/too few resources compared to playing on a vanilla map. The ideal way to handle this would be to separate the map building part (terrain etc.) from the resource replacement. Maybe @Gazebo can look into this and either incorporate our changes into VP (AssignStartingPlots.lua hasn't been modified for a looooong time according to GitHub history), or we can make this part a proper modmod.
I knew there were resources spawning that the script didn't put there.
 
Version 1.12 release! Test it out this weekend while we continue modding.

Changes:
- Smoother thresholds and percentages for map settings and feature generation
- Grassland jungles now exist on flat terrain and they have normal yields (3:c5food:)
- To balance dense jungle starts, some flat grassland jungles are converted into plains to add some production
- More rivers than last version. Note that rainfall option affects river generation
- No more ice floating near the equator in wet maps
- Slightly lowered atoll amount
- Amount of strategic resources at major deposits can now vary slightly (3 or 5 horses can appear instead of always 4)
- Major uranium amounts further lowered to 2 (from 3). There are slightly more deposits to balance
- Strategic placement rebalanced (again). As a result, full VP mod is required for the mapscript to work correctly. Custom resource placement will become optional in future versions
- Removed major coal spawns from desert hills and tundra hills. They're only on grassland and plains, more often on hills
- Fish rate depends on nearby land fertility more than before
- Wheat and horses can appear next to oasis without river
- Stone cannot spawn on fresh water plains and grassland, to leave some more room for farm triangles

Spoiler Temperature=Hot, otherwise default settings :
6wzMN3p.png

Hot map pushes ice towards the poles, but tundra and snow still exist in small amounts.

Spoiler Rainfall=Wet, otherwise default settings :
wwJ6ykp.png

Still a lot of trees near the equator, but much less elsewhere. Expect fewer horses if you pick a wet map, though.
 

Attachments

pls don't reduce atols, we like atols!. I don't think there was too much of them.
If I reduce starting number of city states the map will have reduced land tiles or it will be more room for normal civs?
 
Version 1.13 release! I've changed everything I wanted to change. Next versions will probably be bugfixes and number tweaks.

Changes:
- "Resource Placement" map setting added. Pick "As base mod" to use resource placement script of whatever mods you're using (vanilla if none). The "Communitu_79a (rebalanced)" option requires full VP to work properly.
- Most polar seas are now connected to the main ocean by water (not ice).
- Strategics now consistently appear on the correct terrain. You shouldn't be seeing oil on hills now.
- Overall there are fewer minor strategic resource deposits. Tuned major horse deposit amount up to compensate.
- Reworked civ assignment code to reduce chance of starting isolated or very crowded.

Spoiler Polar seas connecting to main ocean :
7ZB629e.png

MrvAhoK.png

M4ceg3U.png

 

Attachments

Version 1.13 release! I've changed everything I wanted to change. Next versions will probably be bugfixes and number tweaks.

Changes:
- "Resource Placement" map setting added. Pick "As base mod" to use resource placement script of whatever mods you're using (vanilla if none). The "Communitu_79a (rebalanced)" option requires full VP to work properly.
- Most polar seas are now connected to the main ocean by water (not ice).
- Strategics now consistently appear on the correct terrain. You shouldn't be seeing oil on hills now.
- Overall there are fewer minor strategic resource deposits. Tuned major horse deposit amount up to compensate.
- Reworked civ assignment code to reduce chance of starting isolated or very crowded.

Spoiler Polar seas connecting to main ocean :
7ZB629e.png

MrvAhoK.png

M4ceg3U.png

Nice pics!
How did you break the ice?
 
Check ConnectPolarSeasToOceans.
Good!
Same code as ConnectSeasToOcean(), but with differently defined areas. I wonder why you made the path first with coast tiles, then turn them into ocean if there's no nearby land. Is it not working well in the same pass?

And I'm wondering too, would it be possible to combine ConnectSeasToOcean() and ConnectPolarSeasToOceans() into the same fuction? Sending both functions to AddFeatures(), after ice placement, using 'oceanButNotIceMatch' area and allowing the path to pass by land.
 
Hotfix!
Fixed vertical rifts excessive slope (it was bugged).

Note:
Atlantic oceans create Greenland type islands and are harder to cross.
Pacific oceans are wider and create more spread out islands.
 

Attachments

Last edited:
Since the path can remove land we shouldn't turn them into ocean tiles before the whole path is done (could make fewer ocean tiles than intended (but maybe not since it's a shortest path? (now I'm not sure anymore))).

Note that you can tweak the hardcoded cost of ice tiles (10) in the GetPathBetween... function to have different shortest paths.

There's probably a reason they did ConnectSeasToOcean using the elevation map instead of terrain. Better not change that.
 
So do you guys recommend the normal 8 players for the standard size for this script? Maybe I misremember but was there some talk about excess land area in the original communitas?
 
Back
Top Bottom