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. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    569
    Location:
    Germany
    As far as I can tell, there isn't any special treatment of starting food resources in the AI code. At any point of the game, e.g. for Animal Husbandry (AH), the AI counts (or rather: estimates) how many Pastures it'll be able to build and by how much the Pasture yields exceed the yields of the best improvement that could currently be built on that tile. AH especially was almost always researched way too late until I tweaked the yield evaluation in version 0.95(?). I don't think AH was reearched that late in BtS and K-Mod, so I suppose I had created the problem by reducing the value that the AI assigns to health in the (very) early game.

    I've run another test game now, and noticed Roosevelt (starting tech Agriculture, Fishing) with a coastal start on Prince difficulty researching Hunting, Sailing, Archery and then the Wheel. He ended up working a Plains Deer Camp and Wine Farm for a while until he finally got to AH and improved his Plains Sheep. Screenshot attached, showing also Roosevelt's tech values after discovering Archery (Ctrl+Alt on his capital in Debug mode). The shown tech values unfortunately include a random portion. When viewing the values in Debug mode, that's kind of OK because the values get constantly recomputed, so one can see how randomness affects the values. For a screenshot, it's not so good. (Oh, and the right part of the screenshot is from turn 5, i.e. not contemporary with the left part.) But one can tell that AH isn't valued highly enough. Perhaps trade networks are generally valued too highly too early, which would explain Wheel > AH and early Sailing. Archery and Hunting is OK with me; hardens the AI against Warrior rushes.

    I've found and fixed one more obvious issue with the yield evaluation: Values were reduced to 2/3 in order to account for owned resources that might be outside of city radii – but that never happens in the very early game. Probably still not enough. At least during the Ancient era, when performance isn't an issue, the AI should go through each city, check for tiles in the city radius where the new improvement can be built and compute the difference in yields between the new improvement and the worst currently worked tile. And then put the sum of those differences in relation to the total yield rate of all its cities.
     

    Attached Files:

  2. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    569
    Location:
    Germany
    I suppose he didn't see you there, with the hills and forests in the way. Though I'm not sure if seeing a single tile of yours would've made a difference. The randomness is due to the exploration moves of the Archers I would guess. Not sure how to prevent such a thing. Perhaps by making the AI prefer settling at or close to its starting location when the map is densely populated. The AI code for moving the Settler is mostly from Better BUG AI.
     
  3. Elkad

    Elkad Emperor

    Joined:
    Mar 26, 2007
    Messages:
    1,009
    His starting square was kinda terrible - with just the sheep and a floodplain, I'd have moved as well.
    Moving to pick up the corn was a good move when his scout saw it.
    As a Creative civ, squashing me was a great move for him as well (even though he did it blindly). So great I abandoned the map rather than trying to rush his 2 starting archers on his hill.
     
  4. VDNKh

    VDNKh Chieftain

    Joined:
    Sep 26, 2018
    Messages:
    18
    Gender:
    Male
    I've been playing this mod with a modified version of the Earth 18 Civ scenario that spawns 29 civs. On prince difficulty, some things I've noticed is, the AI settles cities very aggressively early game. On a tight map this works out well, like sometimes Netherlands settles southern Norway or France will grab Ireland and add a nice twist to the borders that makes sense. But it makes some strange settling choices too. 1st pic attached is 100 turns in on noble, normal speed, AI only game.
    • Egypt is settling behind Zara's cities near Shaka and Mansa Musa.
    • Rome is settling far behind Russia.
    • Germany is settling even further back behind Russia and Persia.
    • Persia and Greece are also making some questionable city placements but they could work.
    Second pic attached is the price game I'm playing now. I'm having a blast with it! It feels like the AI is playing to win. Some notes about the other changes from K-Mod
    • I like the new revolt mechanic, but like @Elkad said, there needs to be some tool tip telling you the minimum number of garrison units of whatever era you're in to suppress revolts.
    • The AI doesn't offer trades that much, you have to hunt for them yourself mostly.
    • Barbarians cause a lot of trouble for Russia, Mongolia, and Korea early game with all that wide open space. The algorithm probably works better on normal maps sizes but cities are routinely razed early game on this huge map. I suspect it would be the same other random huge maps.
    • The AI will sometimes vassal civs it has no way to protect, like Huayna Hapac vassaling Wang Kon, though that's been a problem since vanilla. Overall the AI does seem more modest with acquiring vassals.
    • The AI in war will target and conquer cities that are deep in foreign culture that have no hope of ever culturally breaking out of the 1 city tile. So then the war will end, and the units will just sit stranded in these little holdouts like West Berlin, and slowly wither the city down to 1 pop. Vassals in war are even more guilty of this. I can see in some situations that it makes sense to do that, but not when the AI does it. In the second pic you can see this in the Greek city in between Persia and Mongolia. This happened a lot in other AI only games I spectated on this same map. Again, it's probably better on normal sized maps.
    Bugs:
    • The hover over scoreboard causes a huge FPS drop, had to disable it.
    • Sometimes the AI will make demands from me to end a war even though they are about to be annihilated.
    • Something the K-Mod dev said he wanted to fix: persistent city sorting in the domestic adviser, so when you issue a build order it doesn't reset the order.
    • Net effect value doesn't get applied to the add great person to city option. It's been awhile but I'm pretty sure it does this in the BUG mod.
    Requests:
    • Removing culture borders over water on the minimap and strategic maps.
    • A bigger minimap, on 1080p and 1440p monitors, it's pretty small, and making it higher res would help with the distortion due to the low res. (That being said I love the fullscreen replays, I just wish the map wasn't just stretched but actually high res.)
    • Global warming can change the face of the planet and the replay only uses the end game map for the entire replay. Is there a way to fix that?
    • An option for automated workers to leave forts and towns and villages.
    • A "split" button for selected units which evenly divides the selection in half, like what Paradox games have. I find myself doing this manually a lot.
    • A way to disable globe view for watching AI games.
     

    Attached Files:

    Last edited: Nov 28, 2019
  5. Isabelxxx

    Isabelxxx DoaNE Explorer

    Joined:
    Sep 26, 2010
    Messages:
    378
    Well the other option would be to raze the city, but that imposes diplo penalties. I think "it's ok" to capture a city and then slowly weaken it (you make your opponent lose something valuable), but then the AI should simply retreat most troops in those cases the city will not be able to grow its cultural borders withing reasonable amount of time (-> when city size = number of plots available thanks to culture). That change would maintain that strategy as viable (which I think it is) and the AI would still maintain cities when it makes sense.

    When diplo penalties are irrelevant the AI should raze it when the city will not be able to grow its cultural borders withing reasonable amount of time.

    To me the problem is the definition of "vassals". The way I see it on civ is something like "allies", but between a higher and a lower powered nation when the differences are so great it makes no sense to be "allies". ie. the master does not need to be land connected to the vassals or even have real capability of protecting them (would be too difficult to measure it on code).

    I think the best approach to it would be to split that diplomatic option into 2. "Vassals" -like now- having land connection as requirement. And a 2nd option where the weakest nation gives something to the strongest one and become allies, and this diplo option obviously should become available as soon as vassals are. It could reuse the already available alliance option and just make it early and consider it between nations with bad relations but great power differences (like forced alliances) or just as a new option reusing code.

    As a forced change I don't see it, but it would be great as a game option (or button on minimap could cycle among 3 states: all borders/only land/no borders). Btw on 2nd page there is even an option for higher transparency.
     
  6. VDNKh

    VDNKh Chieftain

    Joined:
    Sep 26, 2018
    Messages:
    18
    Gender:
    Male
    With diplo on a timer now though, I think the AI can afford to be more raze happy if it takes a city is has no reason to hold. But if it doesn't want to raze the city it shouldn't target it. If the city is that culturally entrenched and the AI isn't planning on taking more cities near by, then burn it. The original owner can just plop another city down after the war ends.

    After finishing that prince game I withdraw that comment. The AI makes pretty sensible vassal choices, no complaints about it. If anything the AI doesn't offer war vassaling enough, both of my vassals were peaceful. But that ties into my bug report where the AI will make demands from the winning side of a war when it is losing badly.
     

    Attached Files:

  7. Cruiser76

    Cruiser76 Chieftain

    Joined:
    Feb 4, 2018
    Messages:
    58
    Gender:
    Male
    Workboats and galleys ignore terrain impassable when in cultural borders (i.e., they can enter ocean). However, other units don't work this way. For example, if you make desert impassable for a warrior, it can't enter desert even if inside cultural borders. I don't know if this would be considered a bug or not (pretty sure it is a vanilla issue), but I think it is something that should be addressed.

    For those of us doing mod-mods, this creates weird situations in which cities can be settled but not defended. It also doesn't seem realistic. Would it be possible to extend the "cultural terrain restriction ignore characteristic" of workboats to all units? I don't see anything in the unit xml to allow this.
     
  8. xyx

    xyx Chieftain

    Joined:
    Aug 7, 2013
    Messages:
    29
    I don't like this behavior either, but this is intended.
     
  9. Elkad

    Elkad Emperor

    Joined:
    Mar 26, 2007
    Messages:
    1,009
    I'm getting an occasional weird bug where I get a "you can't make this item anymore" message, but I can immediately re-queue it.

    Seems to be linked to border pop turns, but I'm not sure.

    So if I'm building a chariot, and I get a border pop (if that's it), it interrupts access to horses just for an instant and kicks it out of queue, but I can immediately re-add it.
     
    VDNKh likes this.
  10. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    569
    Location:
    Germany
    That's a fair point. I'll try the forced-move approach then. To the rally point or else to the nearest city/fort.
    I guess my hope was that players would relent when faced with revolts in several cities rather than produce more garrisons and spies and press on. But even if slow expansion (until the late game) leads to a higher probability of victory, continuous aggression is still going to be the best strategy in terms of winning at the earliest date possible, which is also a reasonable goal. (And just playing aggressively for the sake of it is also valid.) I can see that my changes to the revolt rules make sustained wars less enjoyable. The most important change is, I think, that not only cities near a border can revolt. I'm fond of that change because it removes the incentive to just conquer more cities when in trouble with enemy culture. So I guess the best I can do is, as you suggested, to tweak the revolt probabilities. A decrease equivalent to the 25% fortify bonus won't fundamentally alter the system, and if you say that this could already significantly improve the flow of your games, then that sounds like a good start.

    Tile culture decay in the inner ring of a city should be 5% per turn currently. That's a half-life of ca. 13 turns. xx% of 100,000 culture is still a lot; however, for tiles that are contested between mature cities, the current decay rates are already pretty aggressive. Like the revolt probabilities, culture decay can be adjusted through XML (TILE_CULTURE_DECAY_PER_MILL, CITY_RADIUS_DECAY) – in case that you want to experiment with that.
    AI Isabella probably would've done the same thing against Willem though, so I do find this behavior is a bit worrisome.
    A savegame would be helpful. Apparently, the popup triggers during a plot group update, but it's difficult to say how that happens exactly. BtS only checks at turn end whether strategic resources have become unavailable; that behavior avoids such glitches but can be exploited.
     
  11. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    569
    Location:
    Germany
    There's a domain check in the DLL:
    Spoiler :
    Code:
           if (m_pUnitInfo->getTerrainImpassable(kPlot.getTerrainType()))
           {
               TechTypes eTech = (TechTypes)m_pUnitInfo->getTerrainPassableTech(kPlot.getTerrainType());
               if (NO_TECH == eTech || !GET_TEAM(getTeam()).isHasTech(eTech))
               {
                   // sea units can enter impassable in own cultural borders
                   if (DOMAIN_SEA != getDomainType() || kPlot.getTeam() != getTeam()) 
                   {
                       if (bIgnoreLoad || !canLoad(&kPlot))
                       {
                           return false;
                       }
                   }
               }
           }
    (same for FeatureImpassable)
    Judging from the Firaxis comment, it's intentional, but I agree with your reasoning, so I'll just remove the domain check.
     
  12. VDNKh

    VDNKh Chieftain

    Joined:
    Sep 26, 2018
    Messages:
    18
    Gender:
    Male
    I was able to catch this bug in the act again, got a save from the turn right before it happens. Advance to turn 55 and it will say I can no longer produce Immortals even though I can.
     

    Attached Files:

  13. xyx

    xyx Chieftain

    Joined:
    Aug 7, 2013
    Messages:
    29
    I was somewhat confused regarding vassals while being in a permanent alliance, because they appear as a usual civ in the scoreboard, so I initially thought all vassal agreements are cancelled. Would it be possible to show vassals below the team, exactly as is done for regular (non-permanent alliance) civs?
     
  14. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    569
    Location:
    Germany
    Thanks. I've fixed it. Not sure if this was the last such problem; here's hoping. Thanks also for the detailed feedback; I'll get to that soon.
    Apparently, vassal agreements only partly survive the formation of an alliance currently. The BtS code had, in principle, allowed a vassal to have multiple masters (nice for a Mandala mod maybe), and when I replaced that array of masters with a single variable for efficiency, I failed to properly update the alliance code. If you'd like to repair the game (by loading a pre-alliance save), I can upload a DLL with the bugfix. Otherwise I'll hold off until a more critical problem crops up.
     
  15. xyx

    xyx Chieftain

    Joined:
    Aug 7, 2013
    Messages:
    29
    Thanks, but I am happy to wait.
     
  16. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,535
    Location:
    israel
    hey,
    good work,
    thank you VDNKh .

    f1,
    the fix is the "bVerifyProduction"?
     
  17. Cruiser76

    Cruiser76 Chieftain

    Joined:
    Feb 4, 2018
    Messages:
    58
    Gender:
    Male
    Hey f1rpo, I'm loving the "speed bonus" tag you added for units. I'm using it for units that require oil and setting their base movement as 1, with appropriate bonuses based on access to oil. I like the idea that modern armies need continual access to oil to perform maneuvers.

    I just had a question on the implementation. After testing, it appears the capital city must have access to the resource. Is this correct?
     
    Last edited: Dec 2, 2019
  18. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    569
    Location:
    Germany
    Yes, all changes tagged with "advc.064d" in this commit. The other changes are unrelated.
    Sounds good, not too punishing and they can still take the railroad.
    Essentially, yes. In non-hostile tiles, it should also be enough if the current tile is connected to the resource. Since the trade network doesn't extend onto hostile tiles, the capital seemed like the only reasonable criterion.
     
    Cruiser76 likes this.
  19. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,535
    Location:
    israel
    cool ,
    might have added some more.

    and dont worry, i watch the commits so , no need to post them for me :) ill just ask if something isnt clear.

    thanks.
     
  20. Montezuma12

    Montezuma12 Chieftain

    Joined:
    Apr 13, 2014
    Messages:
    14
    Is there a way to edit the Apollo Program or other projects in the files? I had a game where none of the AI's ever built it (and thus no competition for space), and when I looked in the worldbuilder I couldn't find a way to add projects to cities manually, which was my band-aid solution. Also couldn't find it or other projects in the files anywhere, and I'm very confused...

    As usual, love the mod overall, best one I've played for Civ 4, blah blah blah :p (but honestly, I actually mean that. This mod is incredible!)
     

Share This Page