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:
    483
    Location:
    Germany
    I suppose the personalities are intended to reveal themselves more gradually. ;)
    I've tried to reproduce that through WorldBuilder and saw some extra Archers but no big stacks – but you wrote that it doesn't happen very frequently, so that doesn't say much. I would surmise that large numbers of Archers are only trained during war preparations (you could check by holding down Alt while hovering over the scoreboard in cheat/debug mode). If so, then discouraging early AI war plans should solve the problem. To that end, I'd try increasing UWAI_WEIGHT_FAIR_PLAY in AI_Variables_GlobalDefines.xml; perhaps from 100 to 150 would be enough. That weight affects the first 100 turns (speed-adjusted). Will also affect e.g. Axeman rushes of course. :undecide: Giving Archer a NotUnitAI "UNITAI_ATTACK_CITY" could also help. Pending evidence to the contrary, I'm assuming that this is mostly not an issue in the base mod – though it's not clear to me why it's happening in your mod, that is, unless starting locations are very crowded.
     
  2. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    483
    Location:
    Germany
    Small update on the PerfectMongoose script: I've made some tweaks; the result isn't radically different, so, not much point in a screenshot. I've described the changes in the commit messages here and here. The latest version of the script is here.
     
  3. LeBashar

    LeBashar Warlord

    Joined:
    Feb 1, 2012
    Messages:
    154
    Location:
    France
    I have questions about the global warming mecanism (it's be so long I haven't play a vanilla's game I don't remember how it's work in it either) : each building with a unhealthy bonus count ? If I add a unhealthy bonus in a new building (or existing one), It will be a global warming step, even if the city is able to don't have unhealthiness ?
     
  4. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    483
    Location:
    Germany
    I've never looked into either the original or the K-Mod Global Warming rules much.
    Based on that, I assume that the total health values of cities don't matter.
    If that means iUnhealthyPopulationModifier=-100 (like National Park in K-Mod), then the city should not contribute to Global Warming.
     
  5. Elkad

    Elkad King

    Joined:
    Mar 26, 2007
    Messages:
    997
    AI retreating units is nice. But it does it a bit too aggressively for a city it should really be holding.

    I was attacking AI rifles with trebs/knights/muskets. Attack turn didn't go great, and ended with me having about 8 wounded units, and the AI still had 6 left.
    AI had a general born in the city as well.
    City is a capitol, with several wonders and it's HE.
    AI settled the general, and then retreated all it's units - leaving one new production rifle to defend.

    If it had promoted it's stack, or even just turtled, the attack would have failed.
     
  6. Pepo

    Pepo Prince

    Joined:
    Nov 27, 2012
    Messages:
    313
    I have tried the mod for the first time and wow! Even if I'am a bit rusty, the ai soundly beat me on prince difficulty when three different were DoWing on me constantly. Although I admit I play a diplomatically bad strategy on purpose, the difference with vanilla is quite noticeable :hatsoff:

    Also what happened to the proposed changes to combat that were being discussed a few months ago?
     
  7. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    483
    Location:
    Germany
    That's a good catch. The AI needs to check if a city is safe before spending any Great Person there. Should be easy to amend.
    Available promotions probably aren't taken into account when the AI decides which cities to abandon. Shouldn't be too difficult to change either; I'll see what I can do.

    As for the formula in general, I doubt that's it's far enough off the mark to explain this behavior. It's more likely something specific like the attacker having outdated units. I'll try to make a WorldBuilder test.
    Cool. Thanks for the feedback.
    devolution was the driving force behind those. He's on a hiatus of sorts. I think this post of mine was the latest one on that subject. Rough implementations of defender randomization and the attack width limit can, in principle, be tried out, but that would only be for experimentation as the mod isn't balanced around those rule changes.
    This is still (or soon to be) under investigation. keldath has sent me savegames.
     
  8. Cruiser76

    Cruiser76 Chieftain

    Joined:
    Feb 4, 2018
    Messages:
    36
    Gender:
    Male
    I agree with this sentiment. The retreat formula could use some tweaks.

    There are two main issues I have noticed. One, the AI is not understanding the strategic value of certain cities, i.e., the war will likely be lost even when retreating, so it would be better to make a stand or capitulate. This issue will be hard to address. The AI does properly capitulate most of the time. I've been surprised how well it recognizes a lost cause once you deeply penetrate its territory with an overwhelming force.

    Second, the AI will slowly bleed itself to death by retreating. If the AI is going to retreat, leaving units behind makes no sense. The AI will often leave 4 or more units behind. Makes some sense from a realism point of view, but none from a gameplay view.

    Another AI war issue, and this is a long standing issue with the vanilla game, is the unprotected siege attacks in AI territory. The AI will send a small stack (sometimes 1 unit) of siege to attack. These attacks would have much more value if the AI would do it from a city, rather than in open terrain.
     
    Last edited: Sep 9, 2019
  9. Elkad

    Elkad King

    Joined:
    Mar 26, 2007
    Messages:
    997
    Got another stuck Blockade.
    Save will load to the correct city.
    Pacal's destroyer is blockading my coast.
    Hit end turn and let Washington take my city. (random seed is on, so theoretically my troops could get lucky and win, but 3 longbows vs cannon and grens, so unlikely)
    Pacal's destroyer moves away during the same IBT (north towards me), but the blockade remains in place.
    I have a bunch of frigates in the area if you want to make sure the sea is clear, just scatter and dodge the destroyer.

    advciv 0.96. No locked assets this time, so it should load.

    http://pages.suddenlink.net/flowerdog/Civ4/Blockade.CivBeyondSwordSave

    Yes, I'm losing.
     
  10. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    483
    Location:
    Germany
    That's the error on a silver platter; thanks. So it happens in exactly the situations you had described. I was unable to reproduce it before because I was looking only from the point of view of a war ally of the new city owner, and blockades against third parties are invisible. That must also be why this bug went unnoticed for so long. I introduced it when I merged the plunder range code with the blockade range code (blockade range was using path distance, plunder range was using air distance). I'll try to upload a fixed DLL tomorrow.

    Distance maintenance is perhaps a bit high, e.g. 8.9 gold per turn in Hadrumetum, which has only 5 population and doesn't seem that remote in relation to the map dimensions (screenshot attached). That said, inflation is at 83%, so the cost is probably not way off.
     

    Attached Files:

  11. keldath

    keldath LivE LonG AnD PrOsPeR

    Joined:
    Dec 20, 2005
    Messages:
    6,486
    Location:
    israel
    very nice that you tracked it.

    checking the git every few days :)
     
  12. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    483
    Location:
    Germany
    v0.96d is available now. Sorry – this took a bit longer because a few other bugs had come to my attention. Some annoying UI issues in networked multiplayer, a problem with the AI closeness cache and, in Elkad's savegame with random personalities, I noticed that the displayed total relations values were counting the hidden modifiers (first impression, rank) and, worse, that none of the memory-based modifiers (e.g. "you declared war on us") were displayed. Also the "Tech" tab showed all rival technologies although tech trading was disabled.

    To pick or tie up some other loose ends:
    The formula is based on K-Mod's localAttack/DefenceStrength functions. Those functions mostly add up the combat strength (including the various modifiers from abilties and tile defense and adjustments for collateral damage and first strikes) of the individual units, i.e. they assume that two Swordsmen are as strong as one Grenadier. Strategically, I'd say the Grenadier is more valuable than even three Swordsman because it can often engage just one Swordsman at a time (defeat in detail). That's reflected in my war planning code by taking unit power values (which are usually equal to combat strength) to the power of 1.66. When a stack with Grenadiers is already facing a stack of Swordsmen though and the question is mainly which stack is stronger, then I think it's better to assume that the Grenadiers are outnumbered and will have to fight multiple times in a row. (If they aren't outnumbered, they'll have the higher strength value in any case.) Still, a Grenadier is going to be better than two Swordsman. I'm using an exponent of ca. 1.25 now. This change applies not just to the city evacuation check, but in several (probably not all) situations when stack-vs-stack combat is evaluated. Therefore, I'll have to test it more and it's not included in v0.96d. Also not included is code for counting unassigned promotions in the evacuation check and anticipating their healing effect. I did include safety checks before spending Great People and there is (not new) a parameter called AI_EVACUATION_THRESH in GlobalDefines_advc.xml for tweaking the AI behavior. So if the AI generally evacuates too readily, you (@Elkad, @Cruiser76) could increase that parameter (at least as a temporary measure).
    Evacuation is based on a function called ... "AI_cityValue", which counts the population and per-turn production and commerce yield. I convert that into a percentile rank between 0 and 1 with the least valuable city receiving a 0 and the most valuable a 1. From there, the behavior is simply this:
    Spoiler :
    Code:
    if(kOwner.getNumCities() <= 1) // Never evacuate capital
        return;
    // ... Compute strength values of all units that can reach the city in time.
    // Threshold for the strength ratio
    int iThresh = iAI_EVACUATION_THRESH; // Set to 150 in XML
    if(relativeCityVal > 0.5) // Leave iThresh at 150 for low-value cities
        // This puts iThresh between 150 and 225
        iThresh = ::round(iThresh * (0.5 + relativeCityVal));
    if(kOwner.getNumCities() <= 2 && isCapital())
        // Capital, and only one other city left.
        iThresh *= 2; // Should normally set the threshold to 450.
    // If attacker-to-defender strength ratio (as a percentage) is above the threshold, then evacuate.
    m_bEvacuate = (::round((iAttStrength * 100) / (iDefStrength + 1.0)) > iThresh);
    This requires the attacker's strength to be 150% of the defender's strength even if the city is pretty worthless. I thought of that as a pretty conservative threshold. One problem could be that the strength calculation is off, but perhaps you're also right that sometimes cities with a low-ish rank in terms of population and yields can be worth defending at a 150% strength advantage for the attacker.
    Some 2-4 city defenders left behind can be a bit of a headache for the attacker. You don't want to throw siege units at them and don't want to lose time bombarding the defenses, but if you just attack, you lose, well, probably just 1 unit per defender – after that they're all damaged. However, trading 1 for 1 is pretty good when badly outnumbered overall. Perhaps the problem is that the AI sometimes leaves so many units behind that collateral damage can be employed efficiently.

    If cities were vacated, I worry that the attacker could conquer all the peripheral cities at 0 cost and then make peace. Even if this is not such a bad outcome for the defender, who also doesn't lose units, it's unfair (for lack of a better word) to the civs not involved in the war.
    Off the top of my head, I couldn't even say which UnitAI routine is responsible for such attacks. Mental note taken, but it doesn't sound like something I can easily improve.
    Based on the savegame I looked at, this was probably due to Japanese combat modifiers and first strikes (Protective trait, unique unit).
    It's not unexpected on island maps and I think not that irrational either. That said, my war planning code assumes weaker resistance from civs that are spread out across multiple landmasses and this was supposed to lead to more/ earlier naval warfare. I'll try to check why this isn't really working.
     
  13. Elkad

    Elkad King

    Joined:
    Mar 26, 2007
    Messages:
    997
    This has always been the case, it's not something you introduced. Once you (or they) hit the trading tech (Alphabet), you can see their "can research" list, even with trading off.
    If you turn it off, it would be nice if there was a way to view the enemy tech tree via EP spending or something. If I can see what they are researching, makes sense I should have a history of what they have already researched. Otherwise you end up in the spreadsheet game, where you record their research every turn (and track score changes and guess for those you don't have enough EPs on).
     
  14. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    483
    Location:
    Germany
    OK. I wasn't sure anymore how it worked. The somewhat broken layout was probably my work; well, now I'm not sure about that either.
    That makes sense. At least the techs of civs whose current research is visible should be shown. I'm not positive that one can realistically deduce from observable game state changes which tech a rival civ has just discovered. Less information could be more fun, or not. Since I'm in doubt, I'll probably revert to the BtS rule (show all techs) and only fix the layout, i.e. move the "No Tech Trading" label to the right where there is space.
    Maybe, for the time being, you could use the v0.96c CvExoticForeignAdvisor.py.
     
  15. tantanmen

    tantanmen Chieftain

    Joined:
    Sep 25, 2019
    Messages:
    14
    Hello f1rpo, thank you so much for all the work you're doing with AI. I downloaded AdvCiv when it first came out and I'm eagerly awaiting your new improvements. (I especially appreciate the memory decay for ‘declared war on us’ :mischief:) I have been fine-tuning a flavor mod built on K-Mod and eventually, once I stabilize my customizations, I would like to transfer them to the Advanced Civ platform.

    Until then, I wanted to ask, if you wouldn't mind, could you please reupload the ‘pre-chop’ code for K-Mod? You had posted a link earlier for Fippy, but I missed the download window. I would be extremely grateful for your help. Thank you! :goodjob:
     
  16. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    483
    Location:
    Germany
    Sure, I've attached it. Good call asking in this thread; I don't mind keeping that modified K-Mod DLL uploaded here. It looks like I haven't kept a local copy though :rolleyes:, so I've recompiled it, this time with the global optimization compiler option for slightly better performance.
     

    Attached Files:

    tantanmen likes this.
  17. tantanmen

    tantanmen Chieftain

    Joined:
    Sep 25, 2019
    Messages:
    14
    Hey f1rpo, thank you very much for the speedy response as well as the sweet recomp :thumbsup: And please keep up the awesomeness with :bowdown:Advanced Civ!!
     
  18. fallfgrace

    fallfgrace Chieftain

    Joined:
    Dec 10, 2010
    Messages:
    9
    Hi, I have been playing some games on Prince difficulty and have been enjoying them thoroughly, usually I'm an Emperor player. The AI is relentless had a couple of games I just got outplayed by the AI. This mod is becoming my favorite of all really fast.

    I have to concur with the other comments about some questionable retreat behavior. Also once I had a continent locked down for myself I didn't need to build any units at all could just tech rush, AI doesn't seem interested into making any naval invasions. They did try some small naval skirmish.

    Furthermore what I'd like to see is an additional option for Barbarian spawning, maybe let them spawn in groups of 3-4 units. That would make being alone on a continent more exciting.

    Edit: I like that when you conquer cities they revolt for a period, it would also be interesting to have them spawn some barbarian units when they do.

    Anyway thanks a lot for this mod it's been so enjoyable.
     
    Last edited: Sep 26, 2019
  19. Leoreth

    Leoreth 心の怪盗団 Moderator

    Joined:
    Aug 23, 2009
    Messages:
    33,090
    Gender:
    Male
    Location:
    Leblanc
    Does that not also suggest a fundamental issue with the combat mechanics themselves? Strategically you are encouraged to concentrate units in cities because you have to defend them, but tactically that is often a bad choice because it leaves you vulnerable to collateral damage. This problem is exacerbated by the fact that siege units often carry city attack bonuses and have access to city attack promotions, which are already very valuable. This leads to the paradoxical situation where the attacker usually has the advantage when it comes to fighting over cities, when the general understanding of strategy games is that the defender should have the advantage when it comes to defending their economy. Siege units were given collateral damage as a counter to large stacks but they have a dual role in that they are also dedicated city attack units. I think there is an issue in the design in that those two roles come together when large armies fight over a city that results in an undesired defender's disadvantage.

    I know you follow DoC from time to time, so you may already know and have considered this, but what I did to address this issue somewhat is that the current city defense modifier is also subtracted from the maximum collateral damage that can be inflicted on units in the city. In other words, if a city has 100%+ defense all units in it will not take damage from collateral damage, and for 70% city defense they can only be damaged to 70% health etc., regardless of other limitations the siege unit has for collateral damage. The idea here is that bombardment of defenses becomes a more attractive option, as opposed to rushing the defenders with collateral damage. It also drags out siege battles, leading to a more historical feeling siege process, and giving the defender more time and incentive to slow down the attacker or reinforce the city.
     
    DarkLunaPhantom likes this.
  20. Pepo

    Pepo Prince

    Joined:
    Nov 27, 2012
    Messages:
    313
    @f1rpo Having play some more time with your mod (I will repeat myself, but good work man) I have some issues/suggestion:
    -On Ai I have to say that overall it is a great challenge and really make the game much more entertaining than before. However I do think that peace evaluation needs to be tweaked a little: even if an Ai is losing, it refuses to offer concessions if their enemies face multiple enemies. In my current game I'm facing Churchill on my continent and Huyana and Saladin on the other. Despite the long duration of the war , both Churchill (1.5 strength ratio in my favour) who has lose two cities and the Incas who has lost two cities a well while also fighting the Portuguese refuse to offer concessions. I believe Ai should try to be more cautious on multiple wars, as there are a lot of circumstances where it maybe be getting destroy but still figths because the aggregate strength is higher

    - I would change machine gun bonus against mounted to 50%. Cavalry it's supposed to be the counter to cannons mostly, relegating the role of offensives to grenadiers. However against machine guns they suddenly become quite viable, trading with them at almost a 1:1 ratio, which is absurd. Thus MG should be deadly against then as well. Artillery, tanks and marines should be the way for dealing with them, not horses

    -Counting that Sci method now gives +1 :science:for each specialist, maybe rep could be nerfed a little to give two :science: per specialist instead of three so as to need representation a little bit ( and it also put it more in-line with other civics resource bonuses)

    -Frigate should be faster than the ship of line, otherwise there is no reason to build then. SoL and galleons could stay at 4:move: while frigate goes to 5:move:
    -Considering how profitable is to kill forests in civ IV, the global warming mechanic probably needs to be revised. Also it fires way to fast in my experience (counting other mods that incorporates the mechanic), and being more progressive would make for a more engaging experience

    - Emancipation could use a buff. It may hurts others civs, but literally any other option in the category is superior to it. 100% growth for cottages comes to late, and the difference it makes is fairly minor (sure you get extra commerce for X turn, but you are losing all the other options). I would suggest adding a :gp: bonus to the civic. The Parthenon will probably be obsolete and pacifism is a risky economic option, so boosting GPP may not be a bad idea. Also it synergies well with representation and the statue of liberty, which fits thematic wise

    -Forest preserve could use a buff as well. Overall the improvement isn't worth it compare to the sawmill and if you want commerce you make a cottage. I would make forest preserves like the forest improvement in smac, adding bonuses to all categories. In this case I would make the reserve give +2:commerce:, gaining +1:food: & +1:hammers: With ecology and gaining +1:commerce: with genetics . Probably not a big game changer, but it currently feels like a worthless option as an improvement

    That's all in top of my head right. I would probably add some more things tomorrow about balance issues
     

Share This Page