Rules interpretation for placement Human vs AI
-
Hi all:
First off I would like to thank @victoryfirst for his excellent map "Classic League". This is the mod I used here.
I would also like to thank @thedog who as described a problem he has with "1941 Global Command Decision" for a long time.
And also @frigoref who suggested I post here to get these rules clarified.
I get things wrong, ask @beelee and @cernel, I get things wrong alot.
Now for a little background.
When the AI encounters a purchase step it simulates certain steps between the purchase and the place or and endStep. These steps include combat move, combat, non-combat move and politics. If any of these steps come before purchase or after a place or endStep are not simulated. Also steps like tech and user actions are not simulated. When the place step is encountered, the AI simulates a purchase to place phase. Purchasing one unit at a time by evaluating its needs, using the simulated information, the placing that unit in a territory that can produce that unit.
This first figure shows a Human Germans player simulating an AI attack setup.

The Russian forces have been depleted to entice these attack movements by the AI. The Russians player purchased 1 transport that was placed in Karelia Sea Zone and 6 infantry in Russia. This will be the basic setup mostly used.
The Germans AI will generally, in its simulated combat, take both Karelia S.S.R. and Caucasus. Because Karelia S.S.R. has a factory the Germans AI can use this territory for simulated purchase to place units. Units purchased this way but cannot be place fall to the unplaced unit's routine. Please note the bottom right of the above figure. The Germans have bought 9 infantry and 1 armour and these will all have been pre-placed in Germany. The factory, transport and 1 infantry are given to Germans via a trigger are considered unplaced units just like units bought in error as described above. Also, units given by purchaseNoPUs/"productionPerXTerritories" are considered unplaced units. A Human player will have no problems placing all 13 units. The AI will have no problems with the 10 purchase to place units as they all go to Germany as seen below in the non-highted units;

Unplaced units are broken down into 2 different categories, non-construction units and then the construction units. What must be understood here is that both groups follow the same rules for placement and since the production rule has not been changed all unplaced must be placed into territories with production or in a sea zone adjacent to a territory with production. As seen above the transport was placed in Central Mediterranean Sea Zone and an infantry in South Europe. The factory can only be placed in South Europe or Germany. Even though Karelia S.S.R. has a factory and can be used for purchasing units being conquered this turn means it cannot be considered for placement.
That is the first rule that is different between the Human and AI player. A Human can place construction units in non-production territories. By rule the AI player cannot, all construction units must be placed into production territories.Cheers...
-
Now for a change up. This setup is exactly the same as above, the only change is the following:
<attachment foreach="$Players$" name="rulesAttachment" attachTo="@Players@" javaClass="RulesAttachment" type="player"> <option name="placementCapturedTerritory" value="true"/> </attachment>This will allow the Human player to place units into Karelia S.S.R. as well as the Karelia Sea Zone. The factory can go into Caucasus, but non-construction units cannot.
For the AI player this does nothing. The AI was already allowed to purchase to place in Karelia S.S.R. and these units can be placed there but by rule, unplaced units cannot, even with "placementCapturedTerritory" their placement looks the same as above. The factory unit is still not placed.
If a bunker unit is created:<attachment name="unitAttachment" attachTo="bunker" javaClass="UnitAttachment" type="unitType"> <option name="attack" value="0"/> <option name="defense" value="2"/> <option name="hitPoints" value="2"/> <option name="movement" value="0"/> <option name="isConstruction" value="true"/> <!-- place anywhere owned --> <option name="constructionType" value="Bunker"/> <option name="maxConstructionsPerTypePerTerr" value="2"/> <option name="constructionsPerTerrPerTypePerTurn" value="2"/> <option name="canOnlyBePlacedInTerritoryValuedAtX" value="1"/> <option name="canBeDamaged" value="true"/> <option name="canDieFromReachingMaxDamage" value="true"/> <option name="maxDamage" value="2"/> </attachment>And 6 bunkers were given to Germans along with the factory, transport and infantry. The Human player can place all 6 bunkers. They could be placed 1 each in 6 different or stack 2 in 3 territories. The Human player has options the AI does not have. The AI can place 2 bunkers in South Europe and another 2 in Germany and that is all the bunkers it can place. This is by rule the AI player can only place in production territories it has owned since the start of their turn.
Cheers...
-
The next change is pictured below;

No factories at the start of the game but factories are still needed for production. So, this will change Russians purchases to a single factory and it is placed in Russia.
The AI German player may purchase 1 or 2 factories. It is still being given a factory, transport and infantry, all of which cannot be placed this turn.
Prior to running tests this morning, I upgraded to version 2.7.15616. When running test on an older version, the AI German player favored Germany then East Europe, Karelia S.S.R. or South Europe. Now East Europe is highly favored followed by Karelia S.S.R. or South Europe. I have not seen a purchase for place factory for Germany with this new version. I have not dug too deep into the purchasing routine as I'm just trying to figure out the rules for placement. At first, I thought the rules would be similar for the placement of units given to a player whether AI or Human controlled. The placement of these types of units have completely different rules depending on the type of player.
If "placementCapturedTerritory" is still active and the AI purchased to place in Karelia S.S.R. or Caucasus, then that unit is placed. If not active, then those factories purchased for those locations will become held unplaceable units. Held unplaceable unit are either destroyed at the end of placement or saved over until the next turn determined by how "Unplaced units live when not placed".
So, the AI can purchase to place factories, but can still lose them because it can always try to purchase for captured territories even if they can't be placed there.Cheers...
-
-
So, the AI can purchase to place factories, but can still lose them because it can always try to purchase for captured territories even if they can't be placed there.
Not sure what all this means. Does new code need to be written for the AI not to do this ? Or does a new map property need to be added to the xml so one can turn it off depending on what game they're playing ?
I'm not real clear on all the different rulesets, as it's been so long since I've played anything other than G 40.
Anyway, I won't be of any help here but Good Luck for getting it corrected
I will ping @panther for you, as he is a rules heavyweight. -
To sum up what WC is pointing out here - basically the AI is stupid here in that it tries to purchase units for territories it can't place in. And it is also unable to place unplaced factories because it tries to place them in territories with factories.
This needs to be fixed on the engine level. Two fixes are needed:
-
When making purchases, the AI simulates it turn first and then uses that information to make its purchase. However, it then correctly needs to identify that it cannot place in conquered territories because right now it thinks it can.
-
When the AI tries to place unplaced factories, it needs to use a different set of territories than those for regular units.
-
-
Is this what should happen?
Components of this problemrulesAttachment has placementCapturedTerritory" value="true"
This allows for the placement of units in the same turn as they were captured.Order of delegates in xml speak
A&A style Purchase before Combat
Purchase> Combat move>Combat> Non-Combar move> Place> End Turn
or
New style Purchase after Combat
Combat move>Combat> Non-Combat move> Purchase> Place> End TurnFor Purchase before Combat
The AI tries to purchase what it thinks it needs based on its current TT and then Places them.
If PlacementCapturedTerritory=true then it should re-evaluate its Purchases/Place based on its new TT gains, yes? (As the gains might be better, closer to the enemy etc)Purchase after Combat
If PlacementCapturedTerritory=true or false
The logic is simpler, the AI purchases what it can place, yes?In the above mix, if the AI have been given units/factories from isAI/xml it should test for these first and not Purchase them,
Is the above what should happen?
-
-
Why are unplaced construction units being placed only into production territories or adjacent sea zones owned since the start of turn?
Why when using rule "placementCapturedTerritory" are unplaced units still limited to production territories and their adjacent sea zones owned since the start of turn?
Why when using rule "placementAnyTerritory" are unplaced units now allowed to be placed in captured territories. This is also including those sea zones adjacent to captured production territories?
Why when using rule "placementAnySeaZone" along with "placementAnyTerritory" are sea unis still restricted to sea zones adjacent to production territories? And why is this still also including sea zones adjacent to captured production territories?
Why are the rules so different for the AI to place unplaced units?Cheers...
-
Lol, I should have specified that when I talk about the rules I exclusively mean the v1-v6 rulesets.
I can't know what the intentions or intended specific game-(house-) rules behind those "placementWhatever" rules might be, as these are usually used to override those core game-rules, as it seems.
-
So in the PoS2 it states:
isConstruction values: allows the unit to be placed in territories that don't contain factories.But because this is not a rule, requiring the AI to place isConstruction units in territories with factories is not a bug.
There you have it @thedog. You can only give Human players factories with triggers but you can't give them to AI players.
Cheers...
-
You can only give Human players factories with triggers but you can't give them to AI players.
Yes, its wrong, TripleA should allow the AI to place Factories, because the Player can.
@wc_sumpton
Is this a question because the Devs want confirmation that, the AI should be allowed to place Factories like a human player? -
Let me see if I can explain things better. For reference I'll be looking at the "Axis & Allies Anniversary Edition" rule book. Page 10
*The U.S. player places the new Chinese units at the same time that the new U.S. units are placed. They may be placed on
any Chinese-controlled territories, however those units cannot be placed on any territory that already contains three or
more units. *To be rule complaint "World War II v3 1941" has:
<attachment name="rulesAttachment" attachTo="Chinese" javaClass="games.strategy.triplea.attachments.RulesAttachment" type="player"> <option name="movementRestrictionTerritories" value="Chinghai:Ningxia:Sikang:Yunnan:Hupeh:Fukien:Suiyuan:Manchuria:Kiangsu:Kwangtung"/> <option name="movementRestrictionType" value="allowed"/> <option name="productionPerXTerritories" value="2"/> <option name="placementAnyTerritory" value="true"/> <option name="placementCapturedTerritory" value="true"/> <option name="placementPerTerritory" value="3"/> </attachment>"placementAnyTerritory" allows a player to place any non-isSea unit into any land territory that was owned at the start of the players turn (Human player only not AI players).
can you place in any LAND territory you owned at the beginning of the turn?(Does not include newly captured territories for Human players only.)
"placementCapturedTerritory" allows a Human player only, not used by the AI player to place these units because "placementAnyTerritory" assumes placement into newly captured territories as a default, to place units into newly captured territories, but still follows production rules.can you place in territory you captured this turn?
Even though these are handled/enforced differently they are both considered rule complaint and so it will not be changed.
And don't get started on "placementAnySeaZone" (For Human player only)can you place in any SEA territory beside a LAND territory you owned at the beginning of the turn?But because there is no rule for placement of sea units without production, the AI will not be changed this.
One would think that the same rules would apply to the placement of a purchased factory would apply to the placement of a given factory. They do not. And because there are no rules that govern the placement of a given factory do not expect this to change ant time soon.Cheers...
-
I am very sorry for my above post. I do think that you have a legitimate bug/issue. I have found the cause to your problem (review issues #14447 and #14457). While investigating this issue I uncovered other problems with how the AI handles the placement of units. To me these fixes seemed simple, so I submit a PR to make those changes. A test was created to check the output of the file I wanted to change.
The file passed all the tests. I took issue with the test file because it failed to test the broken functionality of file. Some changes were made to the test but none of the testing covered any of the issues which I raised. So again, I took issue with the test.
Now I'm being told to find the rules.
When a Human places an isConstruction unit, either given or purchased, there are certain rules the player follows. These are the same rules the AI player follows when placing a purchased isConstruction unit. But the rules change for the AI player when placing a given isConstruction unit. Why? So now I have to find a rule that governs the placement of a given unit because it's not the same as placing a purchased one.
A human player as to follow certain guidelines with respect to the use of "placementAnyTerritory", "placementAnySeaZone" or "placementCapturedTerritory" but the AI does not have to follow the same guidelines unless there is a rule?Why are there different sets of rules for placement given that a player is Human vs AI?
Again, sorry for the rant. The fixes are easy. But without a rule they will not be made.
Cheers...
-
@wc_sumpton
Your post above lists 3 functions that the AI cannot do that a Player can, I would like to add a 4th.Give the AI a Factory it will not Place it (it will place units). It will only Place a Factory that it has decided it needs, even though it might have a lot them to place.
Give a Human the Factory, they would place it if they thought it safe to do so.
The AI does not appear to check how many Factories it has already and still buys what it thinks it needs and in turn Places it and no others.
@wc_sumpton
Summarising the Chinese rules, they do appear to work for a human, I have tried them once for human play, but your saying for the AI they dont?Is one of the problems placementAnyTerritory only applies to land TTs?
@panther
In World War II v3 1941 A&A game PvP, Lets look at an unlikely scenario.
Japan build a Factory in Manchuria, 3PU
Next Turn, China captures Manchuria
..In that same turn, how many units can China, place in Manchuria?
..Is it 2 or 3 ?
..Also, in 62 Sea Zone can China Place any ships in this same captured turn?Note: The above is for the boardgame.
@Anyone what does the TripleA game do?
-
Hi Dog
Long time since I played Anniversarry. I think China can only have 3 dudes in a TTy max. Not sure but I think the Fctry gets destroyed the way it would in G 40 as china can't use it.

-
@beelee
Thanks, you could be right.If this is the correct WW2v3-1941balmod.xml
Then it is badly written there is only one generic/shared productionFrontier so China can buy a Factory, even though the A&A rules might say otherwise.
To quote Panther
Don't always trust TripleA when it comes to rules questions. Know the rules before you start … and better check what TripleA has done.Also it might explain wc_sumpton frustration as the China xml code is mimicking A&A rules only and is not intended for generic use.
This is all supposition , as I dont play A&A boardgames or know the rules.
-
yea Idk. The balance mod is different from the OOB map. The triplea version of AA50 aka WWII v3 1941 is pretty accurate. A few things are off rules wise but it's one of the more successful triplea maps. BlackElk drawn

There's multiple A&A versions with different rulesets.
I think triplea trys to incorporate all of them but the original game the engine was designed around is different from the latest ones.Why there's been so many additions. Add in multiple developers over 20 years and you get what we have now

At least people trying to make it better

Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login