How to encourage the AI to build seige units?

Antandron

Chieftain
Joined
Aug 5, 2022
Messages
7
I'm playing the Realism Invictus mod and recently the AI has ceased to build or, when given catapults via World Builder, deploy seige units to any effectiveness whatsoever. Is there any way to fix this issue myself?
 
You could experiment with the iAIWeight values in Civ4UnitInfos.xml. Those get used by the (GameCore) DLL in
CvPlayerAI::AI_unitValue
in line ... SourceForge doesn't show line numbers ... in the line that says
iValue += kUnit.getAIWeight();
That iValue variable isn't on a particular scale, so it's hard to say what the iAIWeight should be for a unit that the AI is supposed to produce more of; should probably try something very high for a start, to see if this has any impact at all – it might be that the AI doesn't even evaluate the unit for some reason –, but not so high to cause a numeric overflow somewhere, so maybe 10000.

Those weights are a kludge; the proper way would be to debug the AI code, i.e. to step through the AI functions that choose city production (CvCityAI::AI_chooseProduction and its subroutines) and those that move siege units (CvUnitAI::AI_update et al.) to see where exactly the AI goes wrong. That'll require, in my estimation, either basic knowledge of both C/C++ and the BtS codebase or advanced knowledge of C/C++ in order to find one's way around the codebase and to debug it without chasing ghosts.

Or you could systematically try older revisions of Realism Invictus until you find the one that introduced the issue and try reverting (part of) that.
 
I don't have the skills to fix this myself so I can only be of use to flag possible issues like in my opening post. In the early game the AI overvalues scouts, stacking 3 together in a stack, undervalues seige weapons and iirc overvalues mounted units when preparing stacks that will assault cities. This is especially suboptimal when there are no seige units reducing the city defense bonuses.

I've taken the CoreGameDLL from RI 3.57 and used it to replace the CoreGameDLL from the latest SVN update. Results to follow...
 
Last edited:
Sounds like a long shot that the old DLL would be compatible with the other assets. I guess going back to an older version, cleanly, is easier said than done with such a large mod. The individual SVN revisions may also be too big to sufficiently narrow down the problem this way. And a DLL change doesn't have to be the culprit, it's also conceivable that an XML change, maybe to the stats of siege units, isn't handled well by the AI code in the DLL.

Reporting AI issues to Walter in the RI thread or subforum seems like the best course of action to me. Don't know if he'll even notice this thread here, and, considering that RI has its own rules for Siege units, I think it's pretty unlikely for someone who doesn't follow the discussions there to jump in and fix AI issues. I see that you've already posted in the RI thread. If that turns out to be too unspecific, a savegame or screenshot where the issues are especially glaring might help. (Just from my own experience of acting or not acting on reported AI issues.)
 
I didn't get anywhere pasting an old DLL files into the new SVN Realism folder. It only caused some weird UI issues.

I'll concentrate my efforts in the RI thread.
 
this was something that i put much thought into.
since i rewrote how siege units are in my mod.

as f1rpo stated , ai value is a start.
i found that i changed the dll in several places to get proper ai usage of siege.
this isnt an easy task and require much testing.

if you dont want to complicate stuff,
give the siege units some more valuable stuff for the ai -> ai weights as said, more strength / bonuses in battle, movements.
if you fear that giving siege more strength, you could negate this by giving extra defense to all other units, lets say unitcombat vs siege 10%.
in that way the ai will think siege are stronger and build more, but infact all units have more defense vs them.
also - combat limit lowers the build count of siege units - think about that as well.
could also change its unitai - attack, attack city, counter and such.

VIP , Civ4Reimagined, RI and my own mod, doto, did some major changes to how siege is working.
cheers.
 
Two battering rams spotted!

After reading Keldath's advice, I increased the strength of battering rams to 3, catapults to 5, bombards to 7 and cannons to 9.

We'll see how popular catapults are.
 
I don't know if this is of any help, but Legends of Revolution has an XML file pertaining to what percentage of an AI stack is siege weapon. I believe it originates from Better BTS AI mod or Dale's Combat Mod. Surely RI has something similar? If so, you could simply alter a value in the XML file(back up original first). ?
 
Top Bottom