ww2v5 AI Stacking, No Good Reason to Fix It
-
(Update 250317.0631: The site fortunately still allows me to edit this. I don't think the problem is a stacking problem. I'm assuming right now it's a termination problem, because I switched to a triggered victory. It actually could be a testimony to the strength of
Hard (AI)
, because it normally does the right thing and finishes. The title of this post wasn't at all meant to be provocative. It was a quick fix to keeping it short.)Overview 1
This post is a continuation of my last post. I broke it out because I don't want it to get buried. However, it's really not important. Move it somewhere else if you should.
Better Title
I shortened the title. I'm not talking about ww2v5. I'm talking about any mod that uses the same units and unit specs as ww2v5, and where I don't change the section
<propertyList>
, except for commenting out what's not used, have a differentresourceInitialize
, have a triggered victory, and have a change needed for the neutrals:<property name="neutralCharge" value="0" editable="false"> <number min="0" max="9999999"/> </property> <property name="Neutrals Are Impassable" value="false" editable="false"> <boolean/> </property>
Assumption about the Rules, Not the Mod
I'm assuming the example I show here, where there's stacking, is not a reflection of my mod, but a reflection of the rules of my mod, along with how
Hard (AI)
makes decisions.In other words, I need ww2v5 to be the problem.
Overview 2
This post is also a result of a coincidence. In the last post, I learned, to my benefit, some things about the stacking problem:
- There is a stacking problem and people know about it, but it's been tolerated because person to person play has been more important.
- But now those in charge care about trying to improve solo play with the AI.
- But their effort has been put into a new map which requires at least TripleA version 2.7.14848, released in July 2024, which means this effort to improve solo play is a recent effort.
Coincidence: The coincidence is that I was running
AI (Hard)
on a mod namedgezz_ww2_BvJ
, which is a two-player, 4-victory-territory mod of ww2v5.I ran 8 games which ran good, but on the 9th game, it went into a bad stacking loop, at what should have been the end. It stacked in a sea zone next to the 1 territory of significance it needed to capture.
There's a problem? No. Only an annoyance.
But sometimes you can get it when the gettin' is good. And if the gettin' is good now, what with the powers now catering to solo play, I want to get it.
Get it now? Get it whenever. Now, six months from now, 1 year from now, or 2 years from now. My middle name is Frank. Frank begins with "F". Flexible also begins with "F". The logical conclusion? I'm flexible because my name is Frank.
What the Powers Should Do
What should the people in charge do, about the stacking problem, for the particular game with filename
world_war_ii_v5_1942-master.zip
?Nothing, most likely.
- The only good solution is a solution which doesn't arbitrarily limit unit numbers in territories, except maybe on a per map basis. (But whatever the case,
world_war_ii_v5_1942-master.zip
should not be changed with some imperfect fix.) - When two capable opponents are evenly matched, it can result in many rounds of play, with large numbers of units accumulating in territories where evenly matched opponents are doing battle.
- If you arbitrarily limit number of units in territories, you never get to see when the AI can use large numbers in territories as the best tactic.
- Stacking results in large numbers of units, but legitimate play can also result in large numbers of units.
What I just said many others have probably already thought about.
Two Images of the Mod
The mod I show is
gezz_ww2_BvJ
, and it's the first mod where I took the ideas from how I modded 270BC, after I overcame the idea that it wouldn't make sense to do it to ww2v5.For others, it could be that what I'm doing is another good test of the general abilities of the AI, but maybe it's just rehashing what's already known.
Image 1 and What It Means
The first image below shows the initial map.
There are 2 capitals and 2 other victory territories. These 4 all have a factory, but there are no other units. All other territories are either neutral or impassable.
The impassable are to limit the areas where battle can be done. Territories are all of value 5, except those of 0.
IMPORTANT NOTE: With territories being of value 5, the number of units in territories can get large.
Territories of value 0 limit activity in the Pacific, keep the right side of Japan from being attacked, and keep the left side of UK and Brazil from being attacked.
It's meant to model a situation where the geography constrains the battle, such as with mountains and mountain passes.
There are 4 paths from left to right. There is 1 path down the middle of the top 3 paths where the 2 passes are 0 value so that no one can lock up the pass by putting a factory there.
Image 2 and Stacking from Round 28 to 81
So finally at round 28, the Japanese have moved into a sea zone next to Brazil. Rather than do battle and conquer it, it stacks forever.
IMAGE 1
IMAGE 2
-
@igbi
TripleA AI was written specifically for the A&A style games and it does an OK job as it and gives the average player a decent game.In reality it is an amazing set of code for its time. Personally I dont think it will be improved as it involves a lot of work/time.
That said, any map outside of the A&A style games the AI will struggle and needs help.
The AI is interested/weighs;
PU value (in a sea of 1s the 2s will be magnets, literally)
Factory have a high value
Capital has a high value (In 1941 GCD Oil Fields are Capitals, it has 80ish Capitals, even though only 29 a Victory Centres)
Units and their value in a stack, TUV.There are 7 Capitals in this image, shown as Roundels, including 2 in the sea. (I displayed these just for this image)
.
1941 Global Command Decision (GCD) has
800ish locations (Territories & Sea Zones) vs A&A maps have under 200
1800ish units, as Upkeep/Maintenance limits super stacks vs A&A 400ishWhen testing GCD AI gameplay, the US would place 40+ Tactical Bombers in Brazil. It did this more than once. As GCD was intended for solo play I wanted to find a solution, so stacking limits were enforced for better game play.
Takeaways
The Territories & Sea Zones that you as a player aim for make them capitals, then the AI will play better.470 and 435 stacks of Bombers, they are under pointed, so broke, increase their pu cost.
You need to limit the stack sizes, maybe use the unit limits in GCD as a starter.
Consider an Upkeep/Maintenance cost of 1pu per unit, this will help limit super stacks. The bigger your force the more it will cost to maintain, as in life.
Change to Fast AI, it would probably have invaded Brazil
In short, if this is your favoured map then customise it to help the AI give you a better game, just like I did for GCD.
PS Just a thought, check the connection between that Brazil sea zone and Brazil exists.
-
@thedog said in ww2v5 AI Stacking, No Good Reason to Fix It:
@igbi
TripleA AI was written specifically for the A&A style games and it does an OK job as it and gives the average player a decent game.(I write a long post here, but there's a good chance there's actually no problem. People talked about a stacking problem. I saw what looked like stacking, but it's most likely a termination problem.
However, it'll take me time to experiment with switching back from a triggered victory to the code which uses
property name="Total Victory" value="true"
. I renamed that string the other day, for a mod that deletes all units but factories, leaving ww2v5 the same as much as possible. It didn't work. The early games hard code stuff in Java, I guess, or put it somewhere else.)Superfluous Stuff
At this point, I'm under the impression that
Hard (AI)
is at least slightly better than what you say, and even better than what you say. But even if it's weaker, I'll make it work.Me playing is only tha player half. If
Hard (AI)
plays weaker than skilled human players, I'm interested in analyzing it all and quantifying what the difference is.And meaningful ratings come from rounds of play. Can you beat
Hard (AI)
? Okay, but can you win 19 out of 20 rounds? But really, that's out of the realm of what humans do and want to do.Intentionally sub-par play, I don't like that. But handicaps can generally turn non-competitive play into competitive play.
In reality it is an amazing set of code for its time. Personally I dont think it will be improved as it involves a lot of work/time.
But to appreciate the art, I need to not only be a Java programmer, but understand the algorithms, and understand the historical context of what's being pioneered here. Is it great technically? I don't know.
I can say, it's pretty great to me right now. It's the skilled players around here who have talked about what it can't do, not me. I watch and can see some waste, but until I play, I won't be able to evaluate it.
But I don't want to play until I have a good Python application to help me figure it all out, every round, every phase. Don't just play. Master having an understanding of game state, to be strategic, rather than just do piddly battles here and there.
That said, any map outside of the A&A style games the AI will struggle and needs help.
What I'm intent on doing is not anything much you're going to care about, so maybe it is, again, actually better than what you say it is, because if you're not doing what I'm doing, you won't know what results I'm getting.
My starts are unorthodox, but the generalized part of the AI seems to deal with that.
As to helping the AI play ww2v5 with a different start, I don't see any code in the XML files that is designed to do that. I like to do things proper, as much as possible. (You did make suggestions, and I saw them.)
"Heuristics", I think I saw that word used in terms of the AI, it could have been by you. Adhoc heuristics are never so desirable as a set of mathematical equations which reduce things down to numbers, along with an algorithm which uses those numbers.
My mods are only a big change to the game start. The units are the same and there's that setting
property name="WW2V3" value="true"
which I see. I see thatHard (AI)
wastes effort, but it immediately starts using all the standard A&A unit tactics to slowly claim territory, playing against itself, it winning against itself, with different outcomes, in a balanced game.The AI is interested/weighs;
PU value (in a sea of 1s the 2s will be magnets, literally)
Factory have a high value
Capital has a high value (In 1941 GCD Oil Fields are Capitals, it has 80ish Capitals, even though only 29 a Victory Centres)
Units and their value in a stack, TUV.Studying the details of the various documents and posts written about the AI is heavy brain work.
In spite of this post, I have not been alarmed about how
Hard (AI)
plays against itself.I postpone understanding the details of the AI, and I don't want to do tweaks to optimize ww2v5 for the AI.
And setting capitals and victory cities are not tweaks for the AI. They're proper settings that were made part of the XML files way back then.
Takeaways
The Territories & Sea Zones that you as a player aim for make them capitals, then the AI will play better.And this sentence of yours I could have replied to only, and not said so much. I woke up today and it shortly occurred to me that the problem is most likely merely a termination problem.
With a triggered victory, the
conditionAttachment...
using the territory nameBrazil
is not used by the AI to set any priorities, I guess.To a human, it's obvious that at round 28, Japan has won. It's irrelevant that Brazil hasn't been taken, except for the fact that it has to be taken for the game to terminate, using a triggered victory.
You need to limit the stack sizes, maybe use the unit limits in GCD as a starter.
In some ways I rebel. In other ways I follow the lead of whoever is running the show here.
I don't want to tweak core settings that affect how units work. I like that the initial core games have a fairly simple XML file. And I only know of GCD as greatest common denominator.
But this is wasted words now. I'm pretty sure the AI is running as good as it can for the standard, core games.
It's up to your side to make changes for the AI, and then release it as an updated ww2v5, which you're not going to do.
Consider an Upkeep/Maintenance cost of 1pu per unit, this will help limit super stacks. The bigger your force the more it will cost to maintain, as in life.
No. You have to do the tweaks to optimize AI play for ww2v2 to ww2v6. I didn't see any of
Upkeep/Maintenance
in the fileWW2v5_1942_2nd.xml
. I don't want new code for new features in my XML files. If you don't put it in them, it must mean the new code is for new features, and not new code to fix old problems.I found the triggered condition code in 270BC and used it. Today I will figure out if
victoryCity
can be used withproperty name="Total Victory"
. Otherwise, I'll go to 4 players with 4 capitals, as you suggested.Change to Fast AI, it would probably have invaded Brazil
No way. I want heavy computations. Computers excel when they're doing lots of heavy arithmetic and doing it fast, along with their inhuman algorithmic thinking.
I don't know why anyone wouldn't want to incorporate the battle calculator into their play. I'm thinking the best of players would make an art out of using probability to make nuanced decisions, that are strategic and help them win over someone who doesn't use the math so much. But I'm just guessing.
The comparisons here are with Texas Holdem poker, not that I gamble. New style GTO play (game theory optimization) changed the game.
In short, if this is your favoured map then customise it to help the AI give you a better game, just like I did for GCD.
It's not my favorite. It just represents the only way I want to start an A&A game. I reduce it all down to from 2 to 13 victory cities, which all have a factory. It's non-standard, and the AI seems to mainly know how to deal with it.
The units are the same. The fundamental rules are the same. Therefore, unit battle tactics remain the same.
PS Just a thought, check the connection between that Brazil sea zone and Brazil exists.
It's good. I didn't touch that section of the XML file.
Thanks for the help.
--IGBI
-
PART I - Fix of Past Clueless Copy and Paste
FIX: Switch from
"Triggered Victory"
to"Total Victory"
, in your three ww2v5 mods. Triggered victory is not in any way, shape, or form needed for what I'm doing.NOTE: Clueless copy and paste is usefull for getting past giving up.
DO:
- Uncomment the original
"Total Victory"
code inpropertyList
and delete the triggered victory properties. - In
attachmentList
, delete sections such as these:"conditionAttachment_Allies_Victory_2
and"triggerAttachment_Allies_Victory_2"
.
- Delete the file
notifications.properties
.
So nice. Very clean now.
Tags of
<option name="victoryCity" value="1"/>
were already being used for display in the right sidebar of the application, so no need to add them.The triggered victory in 270BC is original code, but switch that over to
"Total Victory"
style.Wow, dude, a null pointer exception. Did you notice the
"Axis Total Victory VCs"
and"Allies Total Victory VCs"? Something's hard coded there, and you're using
alliance="RomaAlliance"and
alliance="AntiochAlliance"`. Seems the null pointer had to do with something else, but good thing it happened.PART II - Does This Fix the Pseudo-Stacking Problem?
Run games. If you never see it show up again, it did.
Comment
In 270BC, the pseudo-stacking problem happens backwards of ww2v5. There's an island that's a victory city. The Romans will group some units on the shore. There's the shore, then a sea zone, and then the island. The Romans will keep accumulating troops, but never capture the island.
That would happen quite often, but not so often as to make running games useless.
Never seeing that again shows I fixed the problem.
--IGBI
- Uncomment the original
-
@igbi What is wrong with stacking rules? Most wargames limit stacking including the operational A&A games. It is also realistic.
The AI often overbuys airpower if it has a lot of income. This an AI flaw that should be fixed. However, limiting the amount of air units can buy is quick fix and also realistic.
-
@rogercooper said in ww2v5 AI Stacking, No Good Reason to Fix It:
@igbi What is wrong with stacking rules?
(This was last, but I brought it up here. Roger, I hate talking like I know anything about stacking and stacking rules. I assume
world_war_ii_v5_1942-master.zip
has no code that limits stacking, but maybe it does. I did a quick search in the PDF manual for "stacking" and nothing came up, but maybe there's something there.)Roger, you're an experienced jazz player who effortlessly improvises for 15 minutes. You understand the complexities of jazz theory, and it allows you to stay in sync with the chord changes of the pianist and bass player. You could play classical-style pieces, but it totally bores you.
My goal is to play the Moonlight Sonata well. But first, I want to learn some harmony, and definitely at least a little counterpoint, and then there are fugues, which require understanding advanced counterpoint, so I guess it's advanced counterpoint after all, that I have to learn, before devoting myself to actually playing the piano.
With all due respect for your advanced A&A skills, asking me what's wrong with stacking rules, in the context of ww2v5, is like asking me what's wrong with doing a 10 minute improvisation, 16 measures after starting the Moonlight Sonata.
...Most wargames limit stacking including the operational A&A games. It is also realistic.
I now answer your question a 2nd way: There are no stacking rules in the PDF manual that's published by Renegade Game Studios on renegadegamestudios.com/axis-allies-resources.
However, there is a group called TripleA who distributes a file with filename
world_war_ii_v5_1942-master.zip
. From that ZIP, if there was code in the fileWW2v5_1942_2nd.xml
, I suppose I would accept the idea of stacking rules, as part of an official release by TripleA.What is important to me is that TripleA claims, in some way, that
WW2v5_1942_2nd.xml
closely lines up with the PDF manual that has a first page titled Axis & Allies Rule Book 1942 Second Edition.It's all good, Roger. It's all a bit anarchistic here, what with TripleA allowing mods.
Part of the anarchy is I'm not willing to try and fix the problem, with no experience in being bugged by the problem.
(POST-POST-EDIT-TIME: Really, I would like to know with 100% certainty whether the game
world_war_ii_v5_1942-master.zip
has any kind of stacking rules built into it.)--IGBI
-
@thedog said...
Capital has a high value (In 1941 GCD Oil Fields are Capitals, it has 80ish Capitals, even though only 29 a Victory Centres)
and
There are 7 Capitals in this image, shown as Roundels, including 2 in the sea. (I displayed these just for this image)
and
The Territories & Sea Zones that you as a player aim for make them capitals, then the AI will play better.
Mental blocks can be hard to get past, especially if you only scan quickly what someone tells you, because you really don't want to deal with understanding the details at the time.
AI Optimization Nuclear Option - Every Victory City a Capital
It took a while to sync in that a player like
"British"
could be assigned multiple capitals. And then there's "Is this right, because very few nations have multiple capitals."But artistically, a big flag icon is better at marking a victory city than the little star. And the millions of newbies that will look at my map will know nothing about that the flag icon traditionally marks a capital.
So, I accept the nuclear option of making every victory city a capital.
Thanks for the tip.
(EDIT: Looking at pictures and words that don't make no sense, that you then make sense of. Looking at your image again, I now understand that I can make a sea zone a capital. Interesting fact that that may be useful in the short or long future.)
--IGBI
-
@igbi
As 1941 GCD map is 4-5 times bigger then a typical A&A the AI needs help. It took me weeks to understand this and lots of trial and error.Yes, every Victory City/Centre should be a Capital
Every Capital should be important to the AI like;
- Victory City - usually used to the win the game, also a focus for the AI
- Resources - like Oil Fields, Lend Lease Depots
- Player focus - Panama Canal, Suez Canal
- A Sea Zone/Territory 6+ locations away from another Capital - like in the middle of the Pacific (The AI needs focus)
.
This might help again, now you have a better understanding.
https://forums.triplea-game.org/topic/3743/how-to-make-a-map-ai-friendly -
@thedog said in ww2v5 AI Stacking, No Good Reason to Fix It:
Yes, every Victory City/Centre should be a Capital
I'm glad I've made every victory city a capital, and switched from a triggered victory to the old-style total victory, but the problem remains.
The end result will be a more general import of the log files in my hypothetical application.
With the changes, I saw the problem on the 2nd or so game I ran. This falls under the category of a bug, because the AI mostly takes Brazil last, and only occasionally goes into the bad loop. The original AI dev could look at it and probably figure out why in an hour or a day. But there are times in life to move on to the new stuff.
Every Capital should be important to the AI like;
- Victory City - usually used to the win the game, also a focus for the AI
Check. Got that.
- Resources - like Oil Fields, Lend Lease Depots
Doesn't apply to me because I'm sticking with standard older games.
- Player focus - Panama Canal, Suez Canal
(I wrote some stuff, but what you're saying here is part of your bullet point list on the other page, which I comment on below.)
- A Sea Zone/Territory 6+ locations away from another Capital - like in the middle of the Pacific (The AI needs focus)
Okay, so I loaded 1941 Global Command Decision and I saw how there's a flag in every sea zone.
But in trying to do my homework about sea zones as capitals, I searched through
1941_global_command_decision.xml
, and there's no more use of settings like<option name="capital" value="Russians"/>
.So that's being taken care of somewhere else now.
OKAY NOTE: Okay, a your bullet point on the other page describes what's done now:
Liberal use of "capital" xml code that tells the AI what is important to players
.But putting markers all over the map should be only done with precise understanding.
And I like the idea of starting with a blank slate, were 2 to 13 territories have to be captured, and the AI makes the best possible strategic choices based on the best of battle tactics, in the context of geographical constraints.
There are quick fixes, and then there are long term fixes. I'm in no hurry.
This might help again, now you have a better understanding.
https://forums.triplea-game.org/topic/3743/how-to-make-a-map-ai-friendlySo in searches before I made an account, I briefly looked at that. And then a little again after you recommended it, and now again.
(Each time I gravitate towards reading what @black_elk has to say about AI.)
That page is nice because it's one page. Each time I've gone through the bullet list, I say, "Well, I don't use things like technology and politics, so I already meet most of the requirements for AI friendly."
ITEMS 1,2,3 ("capital" code, no objectives, no politics): Doesn't apply to ww2v5 because it's in the basic
"WW2V3"
class of games.ITEM 4 (No A&A style technology): I guess you're talking about technology features you can play in TripleA, not technology per the rules in a PDF, for a boxed set game. I delete the technology in the XML files, so it doesn't apply.
ITEM 5 (isAI): Seems complex. The TripleA people should release an official modified ww2v5 using it, if they think that's the way to go.
ITEM 7 (only PU): Doesn't apply. ww2v5 is limited to that.
ITEM 6 (stacking rules/upkeep): Worthy of more comment.
You say, "As a guide if your map has 20+ units of the same type in a territory you need stacking rules." For normal play, I suppose, but even then maybe not true.
A legitimate, naive tactic is to take the conservative approach: never attack if you're not guaranteed to win the battle. But if two opponents are both using that tactic, large numbers can build up. Why not let them do that? They start thinking they're good, and then someone comes along and takes advantage of that and beats them.
A more sophisticated tactic would be, "Always attack with the absolute minimum of forces which your calculator tells you to use."
But regardless, I constrain the battle and create choke points. With all territory values being value 5, large numbers build up, like 100 or more infantry, or 50 tanks.
Thanks for the tips.
--IGBI
-
@igbi said in ww2v5 AI Stacking, No Good Reason to Fix It:
Okay, so I loaded 1941 Global Command Decision and I saw how there's a flag in every sea zone.
Those are Convoy Flags, in GCD they are used to show ownership of the PUs. GCD does not display capital xml code as Capitals as it is used to influence the AI. In A&A maps they are used as Capitals of a nation.
In GCD you see if a territory is a Capital , by using the Territory tab..
<option name="capital" value="Russians"/>
Search for USSR instead of Russians
-
@igbi Be careful with making every VC a capital. The AI can overdo it, focusing too much on it.
It would be good if the AI had direct support for victory cities, at a level intermediate between capitals and normal territories.
-
@rogercooper said...
@igbi Be careful with making every VC a capital. The AI can overdo it, focusing too much on it.
But Roger, unlike your mods, there's no nuance or sophistication to my mods. They're a brutal reduction.
Ha, ha. You tell me one thing. TheDog tells me another. A rock. A hard place. I'm between them? No, no, I'm over to the side, just a blip on the screen. Only the storage scope will show that I've been here.
It would be good if the AI had direct support for victory cities, at a level intermediate between capitals and normal territories.
Don't know the details in any way, manner, or fashion. But the best of AIs would require no tweaking by us, except to weaken it, which would be in the options.
There are things of number value all over the map. Those numbers, along with the tagging of what has to be captured should be enough information for a super-strong AI to calculate a plan.
A strategy, with battle tactics to carry it out, adapting as needed to what the opponent does.
But maybe you're talking about something else.
--IGBI