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

Communitu_79

Discussion in 'Civ5 - Map Scripts' started by tu_79, Aug 12, 2019.

  1. ridjack

    ridjack King

    Joined:
    Mar 12, 2017
    Messages:
    684
    Is the number of available religions map-dependent? I've just noticed my Huge games on this map with 12 AIs have seven available religions; that seems high? I don't remember what it's supposed to be, though, honestly, so for all I know that might be the correct number.
     
  2. tu_79

    tu_79 Deity

    Joined:
    Feb 11, 2016
    Messages:
    6,965
    Location:
    Malaga (Spain)
    I don't think so. I didn't see anything in the script related to religions.
    Edit. I remember it used to be half the players plus one, then we were playing half the players minus one, and now we're back to more than half founders.
     
  3. ridjack

    ridjack King

    Joined:
    Mar 12, 2017
    Messages:
    684
    So I have no idea what happened, but I just realized on turn 182 that this map I'm on generated with almost literally no strategic resources of any kind. I found a single 2-horse tile and a single 2-iron tile, both on the same continent. Literally *zero* of any other strategic, as far as I can see scanning it manually.
    Spoiler :




    Obviously, this game is dead. This is the first time I've seen this issue, so hopefully just a one-off fluke. But ouch.

    EDIT: I did reveal the late-game strategics, and I can't find any at all. They don't show up in the Corporations screen, either.
     
    Last edited: Sep 3, 2019
  4. tu_79

    tu_79 Deity

    Joined:
    Feb 11, 2016
    Messages:
    6,965
    Location:
    Malaga (Spain)
    It happened to me in the development phase, when the code broke just before the resources placement. Shouldn't happen, but it happened...
    Which were your settings? I'll try to replicate it.
     
  5. ridjack

    ridjack King

    Joined:
    Mar 12, 2017
    Messages:
    684
    Just had this happen, too:

    Spoiler :


    Luckily this time I realized it immediately, when my capital's spawn was completely bare of resources.

    I'll edit this post with map settings momentarily; I basically never change them, so they're constant.

    EDIT: Pretty sure these are the default settings, even:

    Spoiler :


    EDIT2: I do also have the 'Change VP Options' mod set to reveal all bonus resources immediately; no idea if that's relevant:

    Code:
    -- check "Transparent Diplomacy" by default
    UPDATE GameOptions SET "Default" = 1 WHERE Type = 'GAMEOPTION_ADVANCED_DIPLOMACY';
    
    -- uncheck "Enable Events System" by default
    UPDATE GameOptions SET "Default" = 0 WHERE Type = 'GAMEOPTION_EVENTS';
    
    -- check "No Good Events" by default
    UPDATE GameOptions SET "Default" = 1 WHERE Type = 'GAMEOPTION_GOOD_EVENTS_OFF';
    
    -- check "No Neutral Events" by default
    UPDATE GameOptions SET "Default" = 1 WHERE Type = 'GAMEOPTION_NEUTRAL_EVENTS_OFF';
    
    -- check "No Bad Events" by default
    UPDATE GameOptions SET "Default" = 1 WHERE Type = 'GAMEOPTION_BAD_EVENTS_OFF';
    
    -- check "No Trade Events" by default
    UPDATE GameOptions SET "Default" = 1 WHERE Type = 'GAMEOPTION_TRADE_EVENTS_OFF';
    
    -- check "No Civ-Specific Events" by default
    UPDATE GameOptions SET "Default" = 1 WHERE Type = 'GAMEOPTION_CIV_SPECIFIC_EVENTS_OFF';
    
    UPDATE GameOptions SET "Default" = 1 WHERE Type = 'GAMEOPTION_RESEARCH_AGREEMENTS';
    
    UPDATE GameOptions SET "Default" = 1 WHERE Type = 'GAMEOPTION_NO_TECH_BROKERING';
    
    -- Reveal Bonus resources on the first turn.
    UPDATE Resources SET TechReveal = NULL WHERE ResourceClassType = 'RESOURCECLASS_BONUS';
    
     
    Last edited: Sep 4, 2019
  6. tu_79

    tu_79 Deity

    Joined:
    Feb 11, 2016
    Messages:
    6,965
    Location:
    Malaga (Spain)
    Clearly the script crashed before placing resources. Strategics are placed before luxuries, so it makes sense that these are not placed either.

    I've just generated one huge map with all your settings, except the reveal bonus on first turn, and it works well. I'll try again with Change VP options.
     
  7. ridjack

    ridjack King

    Joined:
    Mar 12, 2017
    Messages:
    684
    Hasn't been consistent, FWIW. Sometimes it happens, sometimes not.
     
  8. tu_79

    tu_79 Deity

    Joined:
    Feb 11, 2016
    Messages:
    6,965
    Location:
    Malaga (Spain)
    I don't know what it's causing that. Maybe if I see a couple of maps with that problem, I can realize where the problem is.
     
  9. ridjack

    ridjack King

    Joined:
    Mar 12, 2017
    Messages:
    684
    I'll generate a few later tonight or tomorrow sometime. Of course, then it won't happen a single time.

    What do you need to see? Screenshots, saves, files?
     
  10. tu_79

    tu_79 Deity

    Joined:
    Feb 11, 2016
    Messages:
    6,965
    Location:
    Malaga (Spain)
    I guess screenshots will do. I confess I don't know what I'm looking for.

    EDIT
    You said that you found some 2 quantity horses. Did you select "Strategic start"?
    I see you didn't.
     
    Last edited: Sep 4, 2019
  11. azum4roll

    azum4roll King

    Joined:
    Jul 17, 2018
    Messages:
    708
    Gender:
    Male
    Spoiler :
    Map's probably wet, but don't you think there are a bit too many trees?

    Spoiler :
    Poor Wittenberg is going to create 2 extra work boats that will never reach their destination.

    Spoiler :

    The land shapes are really good in this version if we ignore the very small amount of tiny unreachable islands (and resources).

    I'm also tweaking the resource distribution to make early game strategics more common but in smaller amounts and late game strategics less common but in larger amounts.

    Also something about jungles: seems the only types of jungles are jungle plains and jungle grassland hills. There are no flat jungle grassland or jungle plains hill that I can find. Jungle grassland hills only have 2F yields. Based on this, I'm adding a bit of Uranium to jungle hills since they can be found there according to the civilopedia.

    EDIT: There's a weird bug in PlaceSmallQuantitiesOfStrategics. It's using the vanilla amounts of strategics (2, 2, 3, 2, 3, 3) rather than the ones defined in the mapscript (1, 2, 2, 2, 2, 2) for some reason. AddModernMinorStrategicsToCityStates, however, works as intended and uses the values defined in the script.
     
    Last edited: Sep 7, 2019
  12. ridjack

    ridjack King

    Joined:
    Mar 12, 2017
    Messages:
    684
    As predicted, couldn't get the bug to happen when I was trying.
     
  13. azum4roll

    azum4roll King

    Joined:
    Jul 17, 2018
    Messages:
    708
    Gender:
    Male
    My tweaked version is out!

    Changes:
    - Major deposit amount now (3, 4, 6, 4, 7, 7) and minor deposit amount now (1, 2, 2, 2, 2, 2) for Uranium, Horses, (land) Oil, Iron, Coal, Aluminum respectively.
    - Sea oil can be found in amounts of 2 and 3. Overall amount is not changed.
    - Minor deposits of strategic resources are now distributed based on number of major civs. More civs, more minor deposits.
    - Resources can spawn everywhere now, except snow hills and ocean tiles, all according to Civilopedia. (maybe we can get oil to spawn in ocean too?)
    - Notable new spawnpoints: stone on bare hills, uranium on jungled hills, tiny amount of uranium and iron in tundra forest, bananas in marsh.
    - Sheep is back from near extinction. Don't worry, they aren't everywhere like they were before.
    - Overall, there are more horses and iron tiles in small amounts, fewer coal, oil, aluminum tiles in larger amounts, and uranium tiles are more scattered in tiny amounts.

    Functions modified (for @tu_79):
    - GetMajorStrategicResourceQuantityValues
    - GetSmallStrategicResourceQuantityValues
    - PlaceOilInTheSea
    - PlaceStrategicAndBonusResources
    - PlaceBonusResources

    EDIT: Any reason why luxuries seem to tend to stick together?


    EDIT 2: Hope Maria won't try to build her whole fleet here. At least Boudicca to the west has a bigger inner sea to use her navy.
    Spoiler :
     

    Attached Files:

    Last edited: Sep 7, 2019
  14. Asterix Rage

    Asterix Rage Warlord

    Joined:
    Jun 6, 2010
    Messages:
    1,187
  15. azum4roll

    azum4roll King

    Joined:
    Jul 17, 2018
    Messages:
    708
    Gender:
    Male
    Because @ridjack specifically wanted fewer rivers.
     
  16. tu_79

    tu_79 Deity

    Joined:
    Feb 11, 2016
    Messages:
    6,965
    Location:
    Malaga (Spain)
    Thanks, you saved me a lot of trial and error on resources. Now they can complain on you if they dislike the amounts ;)

    About those inner seas, and tiny islands that get isolated, maybe there's a way to force an exit. Communitas already do this for inner seas not blocked by ice, so maybe the answer is there.
    I think this change can work:
    Code:
    function ConnectSeasToOceans()
        local areaMap = PWAreaMap:New(elevationMap.width,elevationMap.height,elevationMap.wrapX,elevationMap.wrapY)
        areaMap:DefineAreas(waterMatch)
        local oceanArea, oceanSize = GetLargestArea(areaMap)
      
        if not oceanArea then
            print("ConnectSeasToOceans: No ocean!")
            return
        end
      
        local plotFunc = function(plot)
            return not (Plot_IsWater(plot, true) and plot:GetFeatureType() ~= FeatureTypes.FEATURE_ICE)
        end
    
    EDIT Nope, it does not work. This function in the piece that makes the plot terrain, while the ice is the piece that makes features, coming later.
    EDIT 2. Yep. I made it work. It just a matter of changing that AND for an OR.

    About the luxuries, I don't know what happened. I guess it's because of how settlers are placed. If we force more civs to go on a small continent, as Txurce suggested, then there's less room for accomodating luxuries for these players. Maybe we could work on the fertility required for spawning.
     
    Last edited: Sep 7, 2019
  17. tu_79

    tu_79 Deity

    Joined:
    Feb 11, 2016
    Messages:
    6,965
    Location:
    Malaga (Spain)
    Something weird. I changed the rainfall wet option to change nothing as shown here:
    Code:
        local oRainfall = Map.GetCustomOption(3)
        if oRainfall == 4 then oRainfall = 1 + Map.Rand(3, "Communitas random rain - Lua") end
        if oRainfall == 1 then
            print("Map Rain: Arid")
            mglobal.riverPercent        = mglobal.riverPercent        / 1.5
            mglobal.featurePercent        = mglobal.featurePercent    / 1.5
            mglobal.marshPercent        = mglobal.marshPercent        / 1.5
            mglobal.junglePercent        = 1 - (1 - mglobal.junglePercent) / 1.5
            mglobal.zeroTreesPercent    = mglobal.zeroTreesPercent     * 1.5
            mglobal.plainsPercent        = mglobal.plainsPercent        * 1.25
            mglobal.desertPercent        = mglobal.desertPercent        * 1.25
        elseif oRainfall == 3 then
            print("Map Rain: Wet")
            --mglobal.featurePercent        = math.min(0.9, mglobal.featurePercent * 1.2) -- should not go above 90%
            --mglobal.riverPercent        = mglobal.riverPercent        * 1.5
            --mglobal.marshPercent        = mglobal.marshPercent        * 1.1
            --mglobal.junglePercent        = mglobal.junglePercent     * 1.1
            --mglobal.zeroTreesPercent    = mglobal.zeroTreesPercent     / 1.2
            --mglobal.plainsPercent        = mglobal.plainsPercent        / 1.2
            --mglobal.desertPercent        = mglobal.desertPercent        / 1.2
        else
            print("Map Rain: Normal")
        end
        
    But when I pick Wet map it still makes a gazillion forests.
     
  18. azum4roll

    azum4roll King

    Joined:
    Jul 17, 2018
    Messages:
    708
    Gender:
    Male
    I think using multipliers on percentage thresholds is a bad idea. We need better formulas to uniformly add/reduce features/terrain for temperature and rainfall options. So there's still a little tundra/snow in warm maps, for example.

    EDIT: Since some people want more rivers and some want fewer, can't we make an option for that? Also add a random option for this and rift width.
     
  19. tu_79

    tu_79 Deity

    Joined:
    Feb 11, 2016
    Messages:
    6,965
    Location:
    Malaga (Spain)
    That's irrelevant. Even when we modify the wet map to change nothing from the normal map, it still fills every tile with features. Every code that places features works with the initial values, and the choice of wet map is only considered once, where it usually changes those initial values. So that massive forestation should not be happening at all.

    Since wet map is not working, and the cause is unknown, we could use that option for asking about desired amount of rivers, and forget about wet and dry maps, which I'm uncertain that anyone ever uses.

    About the blocked by ice inner seas, the code shown in the post above looks like it's working, but maybe it's just real inner seas.
    To make it work well, I need to define every ice tile as land, so seas and ocean and lakes get formed the proper way, and then functions like connectseastoocean() would do what they should do.
    Hopefully. I didn't have the time to test this.
     
  20. azum4roll

    azum4roll King

    Joined:
    Jul 17, 2018
    Messages:
    708
    Gender:
    Male
    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.
     
    Last edited: Sep 9, 2019

Share This Page