AI and Neutral Relationship (was Japanese vs Russians)
-
I'm trying to mod the World War II v5 1942 2nd Edition map.
- I would like the Japanese and Russians to be neutral towards each other, but the victory conditions for Axis and Allies should still apply.
How should I go about this ?
So far I've used "movementRestrictionTerritories" player rulesAttachment (Japanese can't go into Russian/European territories).
EDIT:
It seems it can be done by adding a neutral relationship:<relationship type="Neutrality" player1="Russians" player2="Japanese" roundValue="1"/>
with a Neutrality relationshipTypeAttachment as detailed in POS2.
- I would like the Japanese and Russians to be neutral towards each other, but the victory conditions for Axis and Allies should still apply.
-
While this did work, it also highlighted some limitations of the AI (The player AI still sends its land troops to the China-Soviet border, which it can't cross because of the neutral relationship).
A neutral with benefits Germans vs Japanese relationship seems to work well though:
<attachment name="relationshipTypeAttachment" attachTo="Neutrality" javaClass="RelationshipTypeAttachment" type="relationship"> <option name="archeType" value="neutral"/> <option name="givesBackOriginalTerritories" value="true"/> <option name="canMoveAirUnitsOverOwnedLand" value="true"/> </attachment>
-
@butterw Try eliminating alliances entirely and just political relationships and triggered victory. That might solve the AI issue.
-
- I removed Alliances and Victory Conditions
- added "canMoveLandUnitsOverOwnedLand" to the Japanese/Russians relationship.
- made RUS strictly neutral towards USA/BRI.
Japanese AI still amassed troops in Szechwan and didn't move them into Russia even though it could.
The Fast/Hard AI seems to like to empty out its controlled coastal areas and prefers to counter invasions rather than defend (even when it's a Victory City ex: France).
In this map it means the Japanese would be well prepared if a "Japan declares war on Russia" trigger was added. It would make more sense for the Japanese AI to try to focus on getting India (VC + Factory), which Szechwan doesn't help with because Himalaya is impassable.The AI also empties out troops from islands (Borneo, East Indies and conquered VC Hawai) which can be problematic later.
Australia is rarely taken by the Japanese AI, how can the AI be incentivised to conquer it ? Increasing the production value of Eastern Australia to 2 and making it a VC would help presumably ?
It makes more sense for RUS to be part of the Allies and at war with the Japanese AI.
One issue I have is that the RUS AI sometimes rebases it's fighters in India (which leads to them being lost if India falls). To avoid this I can block Russians from this territory, but it then means I can't bomb it when the Japanese do take it. I don't know if there is a simple solution to this. Is it possible to enable/remove a movementRestrictionTerritories option with a trigger ? -
@butterw The AI doesn't know anything about victory cities. If you want the AI to care about something, you need to make it capital. You can negate the bad consequences of losing a capital, but the AI will still focus on its attack & defense.
Possibly making India and Australia capitals will draw Japanese attention away from Russia. You can allow Britain to function with only 1 capital. You may need to create a Commonwealth player controlling India & Australia to avoid odd British AI behavior.
-
@rogercooper OK. With the retainCapitalNumber playerAttachment, a player can have multiple capitals and avoid having his PUs captured if one is taken.
I had a quick skim through: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback?page=1
- Hard AI tries to defend its (and Allied) capitals and gain/preserve TUV.
- There isn't currently a way to tune AI strategy for a specific map (only Capitals, territory Values and unit placement). Victory Cities are not taken into account .
From what I understand, relationships are always reciprocal but are independent of alliances:
If ww2 RUS is part of Allies, Allies AI will try to defend RUS and RUS AI will try to defend Allies (ex: India). -
Is there a way to place a "movementRestrictionTerritories" on a player only when he is AI ?
-
@butterw said in AI and Neutral Relationship (was Japanese vs Russians):
Is there a way to place a "movementRestrictionTerritories" on a player only when he is AI ?
Not currently. I have requested an isAI condition on GitHub. You could use switch units to achieve a similar effect.
-
@rogercooper What do you mean by switch units ?
A lot of the trigger stuff seems quite difficult to handle. I haven't figured out how to switch the movement restriction on Russians based on the current ownership of India.
-
@butterw A switch unit is a non-functional unit that exists just for triggers. Check out the Feudal Japan scenario to see it in use.
For changing restrictions take a look at the trigger "triggerAttachmentChinese4_ChineseOverrunTheirBorders" in the PactOfSteel2 scenario.
-
@rogercooper
As a alternative to the Feudal Japan approach a custom game property RUS AI can be set manually if Russians are to be played by the AI.<property name="RUS AI" value="true" editable="true"/>
"movementRestrictionTerritories" is a player "RulesAttachment", a trigger can overwrite the value.
<attachment name="rulesAttachment" attachTo="Russians" javaClass="RulesAttachment" type="player"> </attachment> <attachment name="conditionAttachmentRus1" attachTo="Russians" javaClass="RulesAttachment" type="player"> <option name='gameProperty' value='RUS AI'/> </attachment> <attachment name="triggerAttachmentRus1" attachTo="Russians" javaClass="TriggerAttachment" type="player"> <option name="conditions" value="conditionAttachmentRus1"/> <option name="when" value="before:russianPurchase"/> <option name="playerAttachmentName" value="RulesAttachment" count="rulesAttachment"/> <option name="playerProperty" value="movementRestrictionTerritories" count="India:15 Sea Zone"/> <option name="playerProperty" value="movementRestrictionType" count="disallowed"/> <option name='uses' value='1'/> </attachment>
I'm only testing the trigger once based on "RUS AI". To apply/clear movementRestrictionTerritories based on the ownership of India, I think you would need 2 opposite triggers based on conditionAttachmentRus1.
If RUS_AI: trigger1 (set movementRestrictionTerritories)
else: trigger2 (clear movementRestrictionTerritories).