Maniac
Apolyton Sage
In Planetfall the AI declares much less wars than you'd expect. DanF5771 recently loooked into it and found some causes. Unfortunately that does not yet give me any solutions.
(the spoilered part has been answered)
Planetfall allows land units to travel over water inside your cultural territory. This has created the following problem. DanF:
One thought I had was to, instead of looking at the area AI of the plot the unit is on, look at the CvSelectionGroup::lastMissionPlot if it has one. However if the AI constantly cancels and re-examines its missions, this probably wouldn't make any difference. So I need to know when exactly, and where in the SDK, the AI decides to re-examine what it will do with a unit. Can you guys tell me that?
Is it truly after every movement point??
How then does the AI ever get anything done? If the AI constantly cancels all its MISSION_MOVE_TO, MISSION_ROUTE_TO etc missions, it seems to me on first sight the AI would always go
and change its mind even without area switching.
(the spoilered part has been answered)
Spoiler :
The first problem DanF mentioned is the spamming of defensive units. I think I may have found the cause of that. But to be sure I was wondering if you could tell me how C++ does basic algebra.
If you have in the code:
x - y / z
does C++ calculate '(x - y) / z' or 'x - (y / z)' ?
If it's the first one '(x - y) / z', I have accidentally caused the AI to want to produce 33% to 50% more floating defenders or so.
The second problem:
If you have in the code:
x - y / z
does C++ calculate '(x - y) / z' or 'x - (y / z)' ?
If it's the first one '(x - y) / z', I have accidentally caused the AI to want to produce 33% to 50% more floating defenders or so.
The second problem:
Planetfall allows land units to travel over water inside your cultural territory. This has created the following problem. DanF:
I noticed that Planetfall's special movement rules do indeed get the AIs into trouble, especially the movement of land units over water. On the next turn Deirdre's SoD enters the lake south of Gaia's High Garden, since the pathfinder dictates to go the fastest route (2-moves for land units over water). But the units leaving the landmass results in them going from one area (the continent, for which Deirdre has calculated the AreaAI AREAAI_OFFENSIVE) to a different area (the lake, with AREAAI_NEUTRAL = the default AreaAIType for water areas).
As the AreaAI is crucial for the units' decisions and a new decision is made after the usage of each single movement point, the SoD on the lake tile forgets about all the planned warring and heads straight back to Gaia's Landing. The monster-SoD is caught in a loop, repeating these two movements each turn.
After world buildering in a Mag-Tube the SoD starting from Gaia's Landing chooses the faster route over land (never leaving the area) so that Deirdre DoWs after two turns.
One special problem here is that Deirdre's stack is a mix of 1and 2
units. The 2
Rover spends 1 of his 2 movement points when entering the lake which triggers a new decision for the whole selection group. If for example you give Santiago a SoD of 4 ATTACK_CITY Walkers (1
) in Sparta Command she will move this stack 2 tiles to the SE (x=59;y=36) on a path leading E - SE - S with the first 2 steps over water (she has the tech Pressure Dome for +1
over water; movement starts in MY2206 after she has finished her preparations and switches to WARPLAN_TOTAL). But since this movement is just one swift step of the whole 1
-group, she doesn't think about her plans while having her SoD on the water and will then continue her assault on University Base.
One thought I had was to, instead of looking at the area AI of the plot the unit is on, look at the CvSelectionGroup::lastMissionPlot if it has one. However if the AI constantly cancels and re-examines its missions, this probably wouldn't make any difference. So I need to know when exactly, and where in the SDK, the AI decides to re-examine what it will do with a unit. Can you guys tell me that?
Is it truly after every movement point??

