[PYTHON] Bizarre attack behavior in Neoteric World. It does not contain a "CvUnitAI.cpp" for me to inspect.

arcvoodal

Chieftain
Joined
Jan 14, 2009
Messages
61
I have seen some rare weird attacks by the AI and am trying to find out what changes Neoteric World makes to the AI. I cannot find the python file.

The main thing I am asking here is if anyone knows how to access the info on what Neoteric World does with the AI because I may want to check it out for other reasons in future, but of course I will explain the behavior I want to investigate now too.

The behavior is that sometimes the AI will do a very random attack on the player with a single unit that makes no sense and nab a win, but might not attack with anything else anywhere. I must also note this behavior of a lone unit attacking irrationally like this has never resulted in a loss for them. The most extreme example was an AI getting rekt on the other side of the world just randomly has a lone transport waltz up to my full-health +20% strength destroyer and sink it, then merrily sail away.
Similar thing happened when I had a SOD outside their city. They have siege weapons and a big SOD inside the city, yet they only attacked with a single unit, a swordsman against a SOD of macemen all +10% Strength on a forested hill, swordsman won with only decimal health lost. They didn't use their siege units at all for some reason.
Another time I had a full health rifleman on a hill with +hills defense, the AI had a lot units nearby (grenadiers and cavalry), yet attacked with a maceman and won with minimal damage.

I am wondering if neoteric world does something similar to XCOM where successive losses gives a free 100% guaranteed win on the next attack (or if they are behind in tech), the AI calculations know when it has this 100% win chance and so make these random attacks that result in unlikely victory, and also why they do it without coordinating it with siege weapons.

As an aside, I also want to inspect if neoteric world removes amphibious attack penalty for the AI, maybe to compensate how hard it would be for the AI to understand to spend movement points to cross a river first and then attack their target? Just curious about that because the AI seems to cause a lot of damage to full-health well defended units for attacks across rivers and amphibious landings when in my experience amphibious attacks result in doing little damage to full-health defending units in cities and on hills.
 
CvUnitAI is a C++ class; there is no such Python script. As I wrote in another thread of yours, I can't find C++ sources for the game core DLL in the Neoteric World thread. Having taken another look, it seems likely that Neoteric World uses the RevDCM DLL with few changes - if any:
This mod uses RevDCM core, all credit goes to the guy called Jdog something, cant remember the last part of his internet name its been a long time but he done a lot of work and time on civ 4. [...]
(Ftr, Dale would also deserve some credit, seeing that DCM is "Dale's Combat Mod.") All the "expanded gameplay" changes listed in the opening post of the Neoteric World thread also seem to be present in RevDCM, maybe apart from changes to map scripts and scenarios. The credits also match those in the RevDCM thread. It's not obvious which version of RevDCM BobeBrown used; some development on RevDCM continued until 2013. In the Neoteric World thread, it doesn't sound like updates from RevDCM were incoporated, so my best bet would be the code version from 1 June 2010, right after BBAI was merged into RevDCM. Neoteric World was first released on 10 June. Unfortunately, one can't be certain that BobeBrown didn't make some DLL changes on top of RevDCM,

The AI does have a routine AI_anyAttack (defined in CvUnitAI.cpp) for a single opportunistic attack when the odds are favorable. Seeing that the AI attacks succeeded in the examples that you've listed, it would seem that the odds were indeed favorable. Though it sounds like they shouldn't have been. If you still have savegames – what odds are shown in the combat log (Combat tab of the Event Log; Ctrl+Tab) after the attack? Maybe there are powerful promotions in the mod? Or, as you surmise, some insufficiently documented change to some aspect of the combat rules. CvUnit::resolveCombat (CvUnit.cpp) would seem like a good starting point for inspecting the code, but I think it's more promising to check the log first – also regarding the river penalty.
 
Oh cool that there are those logs for combat! Will check it out when I am back at my beloved pc 10 days from now and report back here
 
Here's an example, just to clarify what I mean:
Spoiler :
(Needs to be read from the bottom up.)
combat-log_AI-turn.jpg

(But the mod could do things that aren't covered by the log.)

Also: The RevDCM code version that I've suggested is probably too recent. Based on this post by BobeBrown in the RevDCM thread, this version is more likely the correct one: RevDCM 2.721
(Apparently, the BBAI merge on 1 June was merely an update to BBAI v1.0, i.e. RevDCM 2.721 already includes an earlier version of BBAI.)
 
So after a while of playing and watching that log like a hawk for a ridiculously long time, there doesn't seem to be a "gotcha" for the AI cheating. If there is any bias in the AI favor (I believe there is) it is very slight. It still feels like the AI wins slightly more than it should and suffers less damage than it should, but its too little to be able to know for sure without some series excel OCD and I don't care enough to do that if the bias is so slight. Annoying but not game-ruining, especially since the human has save and reload or can spawn units when not in the mood to lose.
 
Last edited:
Welp. Here is something weird "Extra Combat". "Combat Odds: 55.5%" shouldn't be that because they are attacking across a river. But that could be to offset the AI not being able reason river crossing attacks and maneuver around rivers before assaulting. Extra Combat should be +25% instead of +30% if that is the case. I dunno.(playing on Noble difficulty with that Neoteric world mod, which I think uses "better AI" mod in it.)

extracombat.png
 
Seems that "Extra Combat" normally refers to the Combat promotion line, so if the AI unit has Combat III, then the log entry makes sense. The "Combat +/-25" probably refers to the anti-Gunpowder modifiers built into the Infantry unit. And the AI should actually have some capacity for avoiding rivers. There's e.g. this check in the BBAI logic for picking a tile from which to attack an enemy city. I would also guess that already the BtS AI will cross a river before attacking with a 2-move Cavalry unit.
 
Seems that "Extra Combat" normally refers to the Combat promotion line, so if the AI unit has Combat III, then the log entry makes sense. The "Combat +/-25" probably refers to the anti-Gunpowder modifiers built into the Infantry unit. And the AI should actually have some capacity for avoiding rivers. There's e.g. this check in the BBAI logic for picking a tile from which to attack an enemy city. I would also guess that already the BtS AI will cross a river before attacking with a 2-move Cavalry unit.
Ah okay the combat promotion. And then the other "Combat" modifiers are for the bonus infantry gets vs gunpowder. I am rusty after such a long break. Everything checks out.
 
Back again!

I didn't find an answer on the forums and I figured it would be better to post this question here for anyone in future searching for AI attack behavior to get some info in one place.

I thought it was impossible for siege units to completely kill a unit? Could Neoteric world have changed this? Or is this commonly known to happen?

artiliraykill.png
 
I don't think Siege units are ever able to kill a defending combat unit in BtS. Specifically, when there's a iCombatLimit of less than 100 hit points set in Civ4UnitInfos.xml, combat resolution should reliably enforce that limit. RevDCM at least does not seem to have added any exception to this (CvUnit::resolveCombat). In the mod, can your Artillery units destroy defenders?
 
I've never seen that, but I did recently notice some REVDCM options allowing ranged bombardment and opportunity fire which I tried.
It may be that artillery units do 'some' damage using this system and may do perhaps 10 points of damage which could kill a barely-alive unit.

If you have those settings on it might be the reason...??
 
Na, I don't use the ranged bombard stuff. I tested with world builder from both angles with all siege weapons. Neither me nor the AI could completely kill units. So it doesn't happen all the time and is just a rare glitch. AI doesn't get an advantage being able to constantly kill units with siege weapons. Very strange glitch in Neoteric World.
 
I had assumed that the "Ranged Bombardment" mentioned in the Neoteric World thread refers only to bombardment of city defenses. I see in the code that it can also hit units and indeed kill them, which uses the same game text (TXT_KEY_MISC_YOU_UNIT_WAS_DESTROYED) as for units destroyed in combat. Searching for further uses, I also find code for Archer Bombardment and Stack Attack (though I don't know if Stack Attack is supposed to make Siege units lethal; probably not). But, if those can all be fully disabled and are disabled, then I have no explanation for that destroyed-by-Artillery combat message.
 
I also suspected it would have to be the mod's Stack Attack. The other stuff is disabled.
Oh well not a big deal since it happens so rarely I couldn't even reproduce it in world builder. At least the information is out now. I doubt there is any other problems after this many hours of checking the logs for anomalies.
 
Top Bottom