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

Advanced Civ

Discussion in 'Civ4 - Modpacks' started by f1rpo, Apr 16, 2017.

  1. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,560
    Location:
    israel
    In my game,
    Muktiplayer,
    Advc 096, we lost to ghandi, on space victory... So i hadnt notice that.

    Projects data is stored on civ4projectinfo
    Under assets/gameinfo/
    Check out mod wiki link on this site for more info.



    edit:

    f1rpo :

    is this a proper merge to the pplot.cpp?

    Code:
    //105 - keldath from advc 097 -Bugfix: Don't verify city production after border expansion
    void CvPlot::updatePlotGroup(/* advc.064d: */ bool bVerifyProduction)
    {
        PROFILE_FUNC();
       for (int iI = 0; iI < MAX_PLAYERS; ++iI)
        {
            CvPlayer& kPlayer = GET_PLAYER((PlayerTypes)iI);
            updatePlotGroup(kPlayer.getID(), /* <advc.064d> */ false);
            /*  When recalculation of plot groups starts with updatePlotGroup, then
                bVerifyProduction sometimes interrupts city production prematurely;
                not sure why exactly. Will have to verify all cities instead. */
            if (bVerifyProduction && kPlayer.isHuman() && getOwner() == kPlayer.getID())
                kPlayer.verifyCityProduction(); // </advc.064d>
        }
    }
    
     
    Last edited: Dec 3, 2019
  2. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    597
    Location:
    Germany
    I'm not aware of a fundamental AI issue with Space victories. (Of course it wouldn't be the first glaring problem to escape me.) In Debug mode, Alt-hover on the scoreboard shows the current AI victory strategies. Under the Space-3 strategy, the AI should definitely create Space projects once it has the prereq. tech.
    I don't think the WorldBuilder can create projects. I've noticed that only recently when I wanted to test if the Internet project still works. I resorted to gifting myself the required tech, queuing the Internet in a city and immediately finishing production through the plus key cheat (Ctrl+Z for Debug mode, select the city bar, press "+"). That should also work for other players by taking control through Alt+Z.

    Obviously, there's PlatyBuilder, but that seems like a big liability to maintain. As a testing tool, I've managed to arrange myself with the BtS WB for the most part.
    Thanks. Well, if you still play the mod, I assume that you're getting something out of it, so that says enough as far as I'm concerned.

    Before I changed the loop header to
    for (PlayerIter<ALIVE> it; it.hasNext(); ++it)
    (which v0.96 doesn't support yet), the code was
    Code:
    for (int iI = 0; iI < MAX_PLAYERS; ++iI)
    {
       if (GET_PLAYER((PlayerTypes)iI).isAlive())
       {
          updatePlotGroup((PlayerTypes)iI);
       }
    }
    So I think you're missing the isAlive check.
     
  3. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    597
    Location:
    Germany
    Starting with the small items:
    Interesting. Indeed, I see the frame rate drop to 14 FPS while the scoreboard is expanded (through Ctrl+Shift+F in Debug mode). That causes animations to stutter slightly. (I normally have animations frozen, so I had never noticed this.) Is it worse than that on your end? Well, anyway, it's not a good sign and I'll look into it.
    There are some pending reports about such problems and I intend to make some changes. I realize that the current behavior is at times irksome.
    No can do. :(
    When hovering over the "Join City" button? Works for me when I hold down the Alt key. It seems that there is no option on the AdvCiv BUG menu to show that help text always, also not for the add-specialist buttons on the city screen. I guess I should either add a checkbox for that under "Building Actual Effects" or change the meaning of one of the existing boxes. Maybe I'll check how BUG/BULL/BAT handle that.
    There's an option in Assets\XML\GlobalDefines_advc.xml: "MINIMAP_WATER_MODE"
    I'll add it to my list of options that should be on the BUG menu.
    Vertical space isn't abundant even on HD. Something like a 20% enlargement might work well. The unit pane on the lower left should then also be enlarged. I'm not sure if that's possible; I remember once trying, in vain, to make the box for help text above the unit pane wider. Well, perhaps a larger unit pane would actually have that effect.
    After poking around a bit, I've found out that there is a GlobalDefine "MINIMAP_RENDER_SIZE" for that. The BtS value is 512. 1080 looks pretty good on my (just recently acquired) 1920x1200 display. The delay upon opening the replay screen gets a bit longer, but I think it's worth it. However, changing MINIMAP_RENDER_SIZE breaks compatibility with older replays. I hope I can work around that.
    Maybe not – the EXE gets the minimap terrain data from the replay object only once at the start of the replay. So the first problem to solve would be how to get the EXE to reload the data. Neither setMinimapMap, updateMinimapSection nor setMinimapMode seem to do the trick; there might be a few other candidates to try in the Python API. If that can be worked out, it's still a non-trivial task to implement. Using the terrain from the start of the game would be easier, but would still require the (raw) minimap data (obtained from the EXE through CvDLLInterfaceIFaceBase:: getMinimapBaseTexture) to be stored on turn 0 – also in savegames because the replay file doesn't exist yet – and to be loaded into the replay object at the end of the game. I'm also not sure if using the initial terrain would really be an improvement.
    You mean that the game shouldn't go into Globe view when the world map is centered by Calendar/ Stonehenge? Or do you want to zoom out farther without entering Globe view? Does the field-of-view slider help, say, at a value of 75?
    Sounds sensible, but I doubt that I'll get around to something like this in any foreseeable future. The worker option would be a pretty easy task for what it's worth. Splitting stacks would require an algorithm that partitions the stack according to various criteria; a bit of a can of worms maybe.
     
  4. Cruiser76

    Cruiser76 Chieftain

    Joined:
    Feb 4, 2018
    Messages:
    61
    Gender:
    Male
    I haven’t noticed any Apollo Project issues with the AI. In fact, they usually keep building the spaceship even after losing. :lol:
     
  5. Elkad

    Elkad Emperor

    Joined:
    Mar 26, 2007
    Messages:
    1,011
    Automated railroad construction could use help as well. It's far more useful to team up on rail builds. And they should prefer railroading tiles that get a bonus (mines) first. Then connect all cities by rail. Only after that should they be putting rails on random tiles. (If I need the city connections first, I'm probably micromanaging my workers anyway)

    And while you are adding checkboxes, one to "Replace Forts with resource-specific Improvement when available" would be nice.

    Automated Workboats could use a look as well. When I have 3 boat on Auto in 3 separate cities, it should be sending the nearest boat to a new sea resource, not whichever one it gets too first.
     
  6. VDNKh

    VDNKh Chieftain

    Joined:
    Sep 26, 2018
    Messages:
    18
    Gender:
    Male
    Depends on how cluttered the map is, but mine will jump down from 144fps to 36fps with almost nothing to look at on the map. Seems to be a spike in CPU usage. Attached a screenshot of task manager.
    That's a damn shame. Maybe Civ VII will be better... Haha.
    Wasn't holding the Atl key, that was it.
    Missed that, awesome!
    Yes, so it's just flat and not curved. On big maps, maxing out the FOV slider doesn't cut it. Speaking of the FOV slider, have you noticed that small BUG bug where it will jump up or down 1 degree after releasing the slider?
     

    Attached Files:

  7. Cruiser76

    Cruiser76 Chieftain

    Joined:
    Feb 4, 2018
    Messages:
    61
    Gender:
    Male
    f1rpo, have you ever considered implementing an optional mechanism to slow down runaway AIs or players? I’ve noticed that even when playing on a “fair” level for myself (emperor for me), that occasionally I will get far ahead or an AI will get far ahead. Sometimes the snowball becomes insurmountable by as early as the renaissance era. This usually occurs due to land and resource inequities. I use 100% tech diffusion in the BBAI xml file and that helps the issue somewhat but I wish there was a way to “throttle” a player who gets way ahead. This has been a long standing issue with Civ.
     
  8. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    597
    Location:
    Germany
    Upon further consideration, terrain changes in replays are probably infeasible. Since the entire texture needs to be replaced, I expect that there would be a noticeable delay. At best, one could do it e.g. once per era (rather than each time a forest is chopped or a road built). And I still haven't figured out how to get the EXE to reload the texture. So I've settled for the following two options in XML (both disabled by default):
    Spoiler :
    Code:
       <!-- advc.106m: Resolution of the terrain texture on the minimap,
            more specifically, it's the number of pixels along the
            horizontal axis. The value is used for the minimap on the
            main screen, Military Advisor and Replay screen.
            Recommended: 512 as in BtS. A higher value (e.g. 1024) looks
            better on the (maximized) replay screen, but is incompatible
            with HOF_STORE_REPLAYS_AS_BTS=1. Higher values also increase
            the size of replay files.
            AdvCiv 0.97 (and later) should be able to read replays with
            arbitrary MINIMAP_RENDER_SIZE values, but BtS can only read
            size 512. -->
       <Define>
           <DefineName>MINIMAP_RENDER_SIZE</DefineName>
           <iDefineIntVal>512</iDefineIntVal>
       </Define>
       <!-- advc.106n: When to store the terrain texture for the replay file.
            0 (Ancient era) means that the map at game start is used,
            4 (Industrial era) would yield a pre-industrial map with roads,
            most of the Forests gone, but no railroads or Global Warming effects.
            Recommended: A value greater than any era number, which means that the
            map at game end is used (as in BtS). That has the advantage that
            no texture data gets stored in savegame files. The texture has a size
            of 128 KB if MINIMAP_RENDER_SIZE is 512. (Savegame compression in the
            EXE might reduce that size a bit.)
            If an era number is used, then the texture gets stored once any
            player reaches the target era or immediately when loading an
            outdated savegame (i.e. without texture data) in which at least
            one player has reached the target era. -->
       <Define>
           <DefineName>REPLAY_TEXTURE_ERA</DefineName>
           <iDefineIntVal>10</iDefineIntVal>
       </Define>
    A higher resolution has some unanticipated drawbacks. Currently, AdvCiv replays can be read by BtS (i.e. with just a double-click on the replay file). A higher resolution breaks compatiblity. Also, the minimap <edit> on the main map </edit> uses the same texture resolution as the replay screen, so there could be some small performance penalty throughout the game for no real gain. (I've tried increasing the resolution only when creating the texture for the replay screen, but didn't get it to work.)
    Yes, the buggy slider is actually pretty annoying. Seems like the error is inside the slider component. PlatyUI uses +/- buttons iirc; I guess that would be the only way to really fix it. For now, I'm only making the slider a bit longer, which somewhat helps, and I'm increasing the impact of the slider position toward the right end, so that the 100% position results in a field-of-view value of 125. That seems to be enough to view Huge maps in their entirety. Until I deploy that change, you could try increasing the four values in the left column of DF_SKY and DF_GLOBE_TERRAIN in Assets\XML\Misc\Civ4DetailManager.xml. It's easy to experiment with that because changes to Civ4DetailManager.xml take effect immediately when the game is running. Those values set the camera height at which the game switches to Globe view. I think that's a bit different from the field-of-view value; seems to increase the number of zoom levels below the Globe view boundary. I'd generally like to increase those values a bit, but they result in a flatter camera angle when playing at a medium distance. In principle, mods can change the camera pitch (example), so, with some effort, this could be amended. Meanwhile, for AI Auto Play, Alt+F (Satellite view) might be helpful.
     
    Last edited: Dec 9, 2019
  9. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    597
    Location:
    Germany
    I'd like to implement a tech diffusion mechanism that factors culture in foreign tiles into the diffusion rate, so that geographical distance matters. But I don't expect that this would make tech diffusion any more effective as a catch-up mechanism than in BBAI. I don't have any other major change in mind to prevent snowballing; I see it as an inherent flaw of Civ.

    I expect that localized balance changes would alleviate the problem. Any technologies that are too powerful (Liberalism, Civil Service, Rifling, Steel come to mind) will take the civ that gets there first farther ahead. That said, I agree with your analysis that the quality of the land has a lot to do with runaway leaders, and that's also unfair (which snowballing doesn't have to be; it's just anti-climactic). Nerfing resources should help a bit. At the least, I'd like to reduce the food yield from Fishing Boats by 1 until Refrigeration and take away one food from Pig. Gold is also a problem, but, well, gold ought to be valuable. Some changes in that vein are already in place - slightly fewer extra resources at starting locations, bad terrain isn't always removed, no flood plains on river corners, fewer clusters of Gold and Gems. What might help more is a fairer placement of the starting locations. The current algorithm doesn't predict at all in which directions the civs can expand. Shallow-water connections to other continents are also ignored.

    The AI already tries to identify civs that might run away with the game and prioritizes war against them. In my experience, this does sometimes lead to the downfall of a civ that was already well ahead. Often, too few civs are able to reach a dangerous rival though. There are also already some disadvantages for strong civs built into AI diplomacy – there's the "you're getting ahead of us" rank hate and advanced civs get overcharged in tech trades. One could dial that up a bit more, e.g. by making the "fear you're getting too advanced" threshold actually care about how advanced the recipient is.

    As for options: There's the Rise & Fall option, but that's a pretty different experience than the regular game. I'm aware of mods that adjust player handicaps dynamically. That seems like the bluntest approach and isn't even very effective from what I've heard.
     
  10. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,560
    Location:
    israel
    thats an interesting discussion .
    it was always like this in civ, an ai is at the top, pretty hard to catch up with it. the lack of fluctuation in empire power. this makes victories that are time based, meaning not domination or conquest,
    to be a lost battle from the mid game, or a hard to achieve one.
    but as said, thats inherited on civ for ever.
    tech diffusion and such may help to narrow to gap somewhat.
    but, pretty hard to go for an ai with a 500 point gap .
    having ai personalities to target leading civs may assist. some ai perhaps can target those civs and hinder tham, even on the cost of the attacker to be weaker and loose its position, due to the power difference. that can help a bit.

    My previous version of Doto,
    i tried to play with these gaps , by adding "parallel" units, meaning, that other units types with similar powers are available on the other side of the tech tree, so , if one chooses to follow another path of the tech tree, it shouldn't be hurt and get further away from units. in addition, i have added units that have less strength than its "parallel" unit, with the one difference of not having to need a prerequisite resource to be built.

    maybe by adding some random factors, to hurt leading civs, can assist.
    events with some hard effects, maybe some health disease mechanism, such as in RI/c2c. maybe increase large empires maintenance .
    or maybe some cool mechanism that will split empires into small empires :) while keeping maybe the score or something ...
    (just fired some thoughts).

    but all and all, thas civ, and realism,
    empires that are in the lead, are hard to pull down or catch up, something needs to happen artificially to catch them.

    or,
    maybe nukes more powerful, with damage that can really take down empires :)
     
  11. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    33,585
    Gender:
    Male
    Location:
    Leblanc
    Have you considered some sort of technological rubber banding effect? In DoC, the most advanced quartile receives a tech cost penalty (gradually decreasing from the most advanced to the top 75% advanced) and the least advanced quartile receives cheaper techs. The effect also scales with era so that it's not too punishing early in the game where civs tend to cluster more. I think it's plus/minus 25% in the modern era for the top and bottom civs. It's kind of a crude instrument, and I'm sure some people will regard it as unfair/punishing, but I found it's quite useful to keep the tech race a bit tighter over time.

    For early gold, I've seen some mods take away commerce from it and add it later with a tech. I think it was Bronze Working, which makes sense thematically but I'm not sure if that particular tech needs to be even stronger for the early game.
     
  12. Zeta Nexus

    Zeta Nexus Deity

    Joined:
    Jan 23, 2014
    Messages:
    3,607
    Gender:
    Male
    Location:
    In a constant brainstorm...
    I think that is what Revolutions should be for. I know it hurts the AI more than the Human player, even with smaller empires but it may be a good area to start at brainstorming.

    I think of something like this:
    Bigger empires have fewer enemies outside and more inside
    You control X% of world population. Every turn there is X% chance that one of your cities will demand for autonomy (become a vassal). You can either grant it or the city will revolt for some turns (scaled by gamespeed, maybe mapsize too). This could work regardless of revolutions mod.

    An other attemp seen in Galactic Civilizations 2:
    All against the top one
    At some later point of the game all factions aligned against the leading one.
    Something similar could happen in Civ4 too but not sure how. Maybe diplomatic penalty between the top and all the lower players and bonus among the lower players. This could work if the top player gets isolated (cancelling trade agreements, open borders, e.t.c) and the rest of the world should unite (defensive pacts, increased trade, e.t.c.).

    ...and I have a 3rd thing in my mind:
    More people, more demands
    Again, you control X% of world population. Every turn there is X% chance that one of your cities will demand for something:
    • a building from the list of available list of that city;
    • a resource that you have no access to;
    • an improvement on a chosen plot in city's BFC (must be a valid improvement, but may want to replace your only Uranium mine with a Town :devil:);
    ...and you have some turns to fill the request or receive penalty (revolt and/or unhappiness).

    I'd like to have penalties on the leading civ(s) but only those kind that don't feel artificial and "You are punished for doing good" rather introducing additional layers of difficulties.
     
  13. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    597
    Location:
    Germany
    I had gotten bogged down a bit restructuring the AI code for evaluating city sites. That ties in with @VDNKh's post about AI exclaves
    and @keldath's earlier reports about misplaced AI cities. My development version can now write a breakdown of the city site evaluation to a log file. Example (screenshot of the main map attached):
    Spoiler :
    [125898.891] Player 7 (Amerindian Empire) setTurnActive for turn 82 (825 BC)
    About to place city at (16,41)
    Lower bound for found value: 729
    Found parameters for Sitting Bull:
    Culture claim treshold: 2960
    Defensive
    Expansive (tall)
    Computing found value for [16,41] Snow
    Site is coastal
    3 other Native America cities in the area, 3 in total
    Bad tiles: 4
    Base city value: 320
    Evaluate city radius ...
    Home plot: val=140, 2F1P1C
    Plot in radius: [16,42] Coast; val=64, 1F0P2C
    Plot in radius: [17,42] Coast; val=64, 1F0P2C
    Plot in radius: [17,41] Marble Snow Hill; val=105, 0F2P0C
    +928 non-yield resource value (Marble)
    Special yield: 0F3P2C
    Plot in radius: [17,40] Coast (Native America); val=64, 1F0P2C
    Plot in radius: [16,40] Grassland Hill (Native America); val=120, 1F1P0C
    Plot in radius: [15,40] Oil Grassland (Native America); val=141, 2F0P0C
    Bonus resource hidden
    Plot in radius: [15,41] Coast; val=64, 1F0P2C
    Plot in radius: [15,42] Coast; val=64, 1F0P2C
    Plot in radius: [16,43] Whale Ocean; val=27, 2F0P1C
    Can't improve resource
    +91 non-yield resource value (Whale)
    Plot in radius: [17,43] Ocean Ice; val=0, 0F0P0C
    Plot in radius: [18,42] Coast; val=43, 1F0P2C
    Plot in radius: [18,41] Coast; val=43, 1F0P2C
    Plot in radius: [18,40] Coast; val=43, 1F0P2C
    Cahokia has higher priority for (17,39)
    Cahokia has higher priority for (16,39)
    Cahokia has higher priority for (15,39)
    Plot in radius: [14,40] Snow; val=10, 0F0P0C
    Plot in radius: [14,41] Coast Ice; val=0, 0F0P0C
    Plot in radius: [14,42] Ocean; val=29, 1F0P1C
    Plot in radius: [15,43] Ocean; val=29, 1F0P1C
    Weighted sum of plot values:
    +674
    +169 from special yields (0F3P2C)
    Food modifier: 43 percent (special food +/-: 0/2, green tiles: 0)
    +62 from coastal
    =1639 in total before modifiers
    86 from distance to Cahokia
    Bottom line (found-city value): 1725


    Next best site: 1175 (19,29)
    Found parameters for Sitting Bull:
    Culture claim treshold: 2960
    Defensive
    Expansive (tall)
    Computing found value for [19,29] Grassland
    Site is coastal
    0 other Native America cities in the area, 3 in total
    First colony
    Bad tiles: 2
    Only 2 decent revealed land tiles; first-colony logic disabled.
    Base city value: 320
    Evaluate city radius ...
    Home plot: val=140, 2F1P1C
    Plot in radius: [19,30] Coal Plains Hill; val=105, 0F2P0C
    Bonus resource hidden
    Plot in radius: [20,30] Coast; val=64, 1F0P2C
    Plot in radius: [20,29] Peak; val=15, 0F0P0C
    Plot in radius: [20,28] Coast; val=64, 1F0P2C
    Plot in radius: [19,28] Cow Grassland; val=201, 3F0P0C
    Can soon connect resource
    +406 non-yield resource value (Cow)
    Special yield: 4F2P0C
    Plot in radius: [18,28] Coast; val=64, 1F0P2C
    Plot in radius: [18,29] Plains; val=126, 1F1P0C
    Plot in radius: [18,30] Coast; val=64, 1F0P2C
    Plot in radius: [19,31] Coast; val=43, 1F0P2C
    Plot in radius: [20,31] Coast; val=43, 1F0P2C
    Plot in radius: [21,30] Coast; val=43, 1F0P2C
    Plot in radius: [21,29] Coast; val=43, 1F0P2C
    Plot in radius: [21,28] Coast; val=43, 1F0P2C
    Plot in radius: [20,27] Coast; val=43, 1F0P2C
    Plot in radius: [19,27] Coast; val=43, 1F0P2C
    Plot in radius: [18,27] Coast; val=43, 1F0P2C
    Plot in radius: [17,28] Coast; val=43, 1F0P2C
    Plot in radius: [17,29] Coast; val=43, 1F0P2C
    Plot in radius: [17,30] Coast; val=43, 1F0P2C
    Plot in radius: [18,31] Coast; val=43, 1F0P2C
    Weighted sum of plot values:
    +837
    +163 from special yields (4F2P0C)
    Food modifier: 108 percent (special food +/-: 2/0, green tiles: 0)
    =1983 in total before modifiers
    Times 89 percent for low production (800/100)
    Times 2/3 for 1 deadlocked resources
    Bottom line (found-city value): 1175


    Best site adjacent to (16,41): 1342 (17,41)
    Found parameters for Sitting Bull:
    Culture claim treshold: 2960
    Ignoring other sites
    Defensive
    Expansive (tall)
    Computing found value for [17,41] Marble Snow Hill
    Site is coastal
    3 other Native America cities in the area, 3 in total
    Bad tiles: 3
    Base city value: 320
    Evaluate city radius ...
    Home plot: val=170, 2F2P1C
    +928 non-yield resource value (Marble)
    Plot in radius: [17,42] Coast; val=64, 1F0P2C
    Plot in radius: [18,42] Coast; val=64, 1F0P2C
    Plot in radius: [18,41] Coast; val=64, 1F0P2C
    Plot in radius: [18,40] Coast; val=64, 1F0P2C
    Plot in radius: [17,40] Coast (Native America); val=64, 1F0P2C
    Plot in radius: [16,40] Grassland Hill (Native America); val=120, 1F1P0C
    Plot in radius: [16,41] Snow; val=15, 0F0P0C
    Plot in radius: [16,42] Coast; val=64, 1F0P2C
    Plot in radius: [17,43] Ocean Ice; val=0, 0F0P0C
    Plot in radius: [18,43] Ocean; val=29, 1F0P1C
    Plot in radius: [19,42] Coast; val=43, 1F0P2C
    Plot in radius: [19,41] Tundra; val=50, 1F0P0C
    Plot in radius: [19,40] Silver Tundra Hill; val=60, 0F1P1C
    +348 non-yield resource value (Silver)
    Special yield: 0F0P5C
    Plot in radius: [18,39] Coast (Native America); val=64, 1F0P2C
    Plot in radius: [17,39] Coast (Native America); val=24, 1F0P2C
    Plot unlikely to flip
    Cahokia has higher priority for (16,39)
    Plot in radius: [15,40] Oil Grassland (Native America); val=141, 2F0P0C
    Bonus resource hidden
    Plot in radius: [15,41] Coast; val=43, 1F0P2C
    Plot in radius: [15,42] Coast; val=43, 1F0P2C
    Plot in radius: [16,43] Whale Ocean; val=27, 2F0P1C
    Can't improve resource
    +91 non-yield resource value (Whale)
    Weighted sum of plot values:
    +698
    +152 from special yields (0F0P5C)
    Food modifier: 43 percent (special food +/-: 0/2, green tiles: 0)
    +62 from coastal
    +150 from hill defense
    =2153 in total before modifiers
    Times 89 percent for low production (800/100)
    100 from distance to Cahokia
    Times 2/3 for 1 deadlocked resources
    Bottom line (found-city value): 1342
    [125899.000] Player 7 (Amerindian Empire) founds new city Chaco Canyon at 16, 41
    This will make it a lot easier for me to diagnose bad city placement. Regarding VDNKh's 29-civ Earth scenario, some general considerations:
    * When founding or conquering a city that isn't connected to the new owner's main territory, there's the possibility of correcting that at a later time through (further) warfare. When fighting a long-distance war, the first city to be conquered will always be isolated and not worth keeping if no further conquests are assumed.
    * The AI doesn't anticipate whether a new city will be cut off by foreign borders. That would be a somewhat difficult thing to compute. The AI does consider the air distance to its own nearest city and to the nearest rival city. (It would be better to take into account multiple cities.)
    * The historically accurate behavior for some of the European civs would be to stay at 1-3 cities until Astronomy. But if they play to win, they'll have to expand earlier by some means. When the available city sites are very poor (due to distance and other factors), then the AI should produce military units instead of a Settler. I.e. assuming that there is some target that the AI could realistically take a city from. So the war planning code could be the culprit. Or the chance of producing a Settler despite poor sites might still be too high. And city sites are probably sometimes valued too highly. Another problem on a tight map like this is that several AI civs will start producing Settlers for the same site. I've recently added (not yet deployed) a clause that causes the AI to switch production when there is no longer any site worth settling. However, so long as some site remains available, say, in the Urals, the AI will finish the Settler (and that isn't necessarily wrong).
    * From the screenshots, it's difficult to say which rival cities had existed when a questionable city was founded and which strategic resources the city owner was missing.
    Mali should've taken the Alexandria spot; perhaps Mali was slow to get Iron Working. I'd agree that Germany and Rome should've rather spent their production on military units than on a Settler. Cumae is in a pretty poor spot (unless you've added resources to the map).

    I'd combine that into "Automated workers never replace Towns and Villages and replace Forts only on workable tiles." (hover text) and name the option perhaps "Workers Leave Some Improvements" and rename the "Old Improvements" option to "Workers Leave All Improvements". Anyway, automation isn't a priority for me; just mentioning it on the off chance that someone else wants to implement that.
    These two would also help the AI. Though probably not much, so I'll only make a note about it for now.
     

    Attached Files:

    Leoreth likes this.
  14. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,560
    Location:
    israel
    very nice f1rpo,
    you taken up a notch on city placement.
    looks like a big project that you had your time on.

    im certain youll have some great improvements.

    im on a small civ break to play some league of legends, but im here always :)
     
    f1rpo likes this.
  15. Cruiser76

    Cruiser76 Chieftain

    Joined:
    Feb 4, 2018
    Messages:
    61
    Gender:
    Male
    Very cool, tinkering with AI city placement is a worthwhile project :thumbsup:
     
  16. Cruiser76

    Cruiser76 Chieftain

    Joined:
    Feb 4, 2018
    Messages:
    61
    Gender:
    Male
    I’d like to report on a fun ending to a game I just finished. I had a pretty good point lead due to population and land size, and was 2 techs behind Ragnar, the tech leader. Ragnar launched a spaceship but there wasn’t enough time for it to reach Alpha. I was simply running culture and letting the clock run out. With 2 turns to go Roosevelt launched a massive ICBM strike on me and captured one of my core cities on the coast. I actually had to sweat the finale a bit, hoping my score wouldn’t drop too much. The interesting thing is that he had no chance to win, so it was a pure spite attack. It made me wonder though whether the AI would do this to another AI player about to win?
     
  17. Elkad

    Elkad Emperor

    Joined:
    Mar 26, 2007
    Messages:
    1,011
    AI sea invasions are still.. well, stuck in a rut.

    The AI will pick a landing point (city) and throw endless stacks of troops at it, while other MUCH weaker target cities, sometimes closer ones, are ignored.
     
  18. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    597
    Location:
    Germany
    I've been separated :sad: from the Internet for a few days (my desktop PC is still offline).
    There is code to encourage AI civs to stop a disliked rival from winning. I'm not positive that this was a factor here. The AI doesn't recognize when a time victory is imminent – though that seems like an easy addition to make. So Roosevelt might have assumed that only Ragnar was a likely winner. Or perhaps you were close enough to some proper victory condition as well. So long as no civ is close to any victory condition, likely winners are identified based on score (and predicted conquests in ongoing wars). In that context, the human score is inflated a bit. I think that's the only anti-human bias in the king-making code. Anyway, the AI civs that can't win continue to fight wars for all the usual reasons, and the timing could’ve been a coincidence. If you have a savegame shortly before the declaration of war, you could enable the UWAI log in GlobalDefines_devel.xml to check. The log gets written during AI turns.

    Arguably, the AI shouldn’t start a nuclear war when it can’t win anymore. Also, ideally, nukes shouldn’t be launched as a matter of course when at war. Currently, the only levels of escalation while at war are “total” and “limited” war and the latter type of war merely makes the AI more hesitant to fire nukes.
    I don't think I've changed anything about that. There's a BtS loading screen hint suggesting that the AI will target lightly defended coastal cities:
    "Rival civilizations led by computer opponents now pose a more significant threat from the sea. Stronger fleets, amphibious invasions... Don't be caught unprepared! The more warlike leaders can be very sneaky with their attack plans, as they have learned to think beyond the sword."

    I agree that this doesn't really happen. I did make some changes to get the AI to attack by ship sometimes even when there is a land connection. But that'll also only come up once in a blue moon.

    I'm not sure if it would be fun to shift units back and forth along the coast to keep every angle covered. So the AI just trying to win through superior numbers seems fair enough, or almost. :) A bit of sneakiness would probably be a good thing, if only to make the AI appear more lifelike.


    Catching up a bit on other recent topics:
    I seem to have fixed the lag while hovering over the fly-out scoreboard.
    Having worked with the logs for some time – there really were some significant miscalculations and, given that every AI civ will consider settling on every legal tile, it seems that such errors tend to materialize pretty frequently. There are still some fundamental issues:
    * Penalties for foreign culture and remoteness are based only on a single existing city.
    * The distance penalties can lead to cities in sites that are clearly not local optima.
    * City specialization isn't encouraged at all.
    * The special treatment of resource yields (inherited from BtS) is an obstacle to further improvements to the yield evaluation.
    One unexpected issue was that the AI sometimes settled its second and third city without having explored the site’s surroundings (sometimes not even the full city radius). Not sure if it's much better now; I've added a clause that encourages exploration units to target unrevealed tiles near tentative city sites.
    When the early game is too decisive, one remedy can be to make the midgame and late game more decisive, i.e. to allow increasingly bigger swings through skill and luck. Since Civ ties new capabilities to technologies, the players in the lead are the first to get access to any game-changers. In that light, keeping players somewhat on par technologically seems especially important. Astronomy, for example, has the potential to upset the game – if a civ that urgently needs more space is among the first to get there.

    I'm open to including the DoC tech cost adjustment as an XML option. Sounds like it should be easy to adopt.
    I've seen Currency suggested a while ago – same problem wrt. game balance of course. Market perhaps; though the only applicable BtS XML tag would be BonusYieldModifier, e.g. "+10% (overall city) commerce with Gold". I think I'll leave this problem to mod-mods for now.

    The more I think about it, the more I think that a fairer spacial distribution of the starting locations would be the best individual measure against early runaway civs, with the fewest feathers ruffled. However, selecting nodes in a graph so that their mutual distances are maximized seems like a hard problem computationally (should be at least as hard as computing an independent set).
     
    Leoreth likes this.
  19. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    33,585
    Gender:
    Male
    Location:
    Leblanc
    I agree on the starting locations. One silver/gold/gems is already very powerful and may only be balanced at the expense of one food resource, more than one should never occur on a starting plot in my opinion.

    Is the computational complexity that impactful here though, when it comes to distances? The set of locations should be low enough for the impact to be limited.
     
  20. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    597
    Location:
    Germany
    Unless there is a real catch like Gems under Jungle. (I’ve changed the normalization step so that tiles with powerful resources can’t benefit from feature removal and terrain upgrade.) The found value function should be able to tell whether a starting site is too powerful. I haven’t looked at logs for the evaluation of (potential) starting sites yet; perhaps the commerce multiplier needs to be increased, but hopefully it’s not too far off the mark.

    Currently, CvPlayer::findStartingPlot greedily picks the sites with highest found values. Or rather, it’s a mix of that and maximizing the distance to previously picked sites. To rule out double-Gold starts, the algorithm should probably not go for the highest found values; at least skip outliers. That said, it’s also problematic when a civ gets to place its second city at a site deemed too powerful to be a starting site …
    I was thinking of evaluating all possible assignments of n players to m>n potential starting sites. I guess that’s the binomial coefficient since we don’t care which player gets which location. So that’s not going to be feasible for 18 players. To maximize, as I wrote, the mutual distances, a greedy algorithm should actually work pretty well. The PerfectWorld script starts by computing distances between all potential sites (m square complexity – no problem) and picking the site with the highest average distance. The other sites are then selected to maximize the distance to all previously selected sites.

    Even if this comes close to an optimal solution, it doesn’t give everyone equal space for expansion. If we imagine a star-shaped continent with one corner for every civ, then each civ will start at one corner, even if the sizes of the star’s triangles are highly assymetrical. Also, PerfectWorld starting locations are almost always coastal.

    So I’ll have to move the goal post. I was picturing an algorithm that works on a fairly large set of potential sites, e.g. m=6*n (or n times WorldSize.getTargetNumCities), and tries to give every player access to an equal number of sites, with contested sites (near multiple starting sites) counting only partially.
     
    Last edited: Dec 25, 2019

Share This Page