AI Development Discussion and Feedback
-
I don't think i'm gonna get to test that new version redrum, I uninstalled all my versions, cleared the map and saves directory, and did a fresh install of 9743 with fresh downloads of the maps and i'm still getting that error.
(I'm not gonna clutter this thread with anymore of this unrelated to ai bug, just wanted to let ya know I can't be testing that ai fix due to it) -
@redrum Thank you brother. I will go through a few playthroughs and see if I can arrive at more specific recommendations before getting back to you. It may take a few weeks for me to narrow down what is bothering me since I don't know what I am doing and want to make sure anything I site is demonstrable.
This really is my favorite map though, so I appreciate all of this immensely and am happy to help.
Just one question. How does the AI distinguish between priorities, are they hardcoded, or is there a mechanism for weighing variables?
-
@cody-young Currently, AI priorities are all generic and dynamic for all maps. There isn't any map specific AI configuration yet but its something I want to add in the future. For example, in terms of Germany moving in WaW turn 1 it mostly sees Paris as the number 1 objective for most of its units since its the closest factory then secondarily the Russian factories/capital. The way the AI tends to see it is each factory/capital radiate strategic value which diminishes the further away from it. So each unit tends to try to move towards increasing strategic value.
@zlefin Can you create an github issue here so we can avoid cluttering this thread for debugging your error: https://github.com/triplea-game/triplea/issues. Does the error occur on other maps as well or just BW2: BoP?
-
@redrum Can I request a feature? I want to hijack all methods in ProPurchaseOptions that calculate efficiencies to fool the AI into behaving correctly. I plan to use it on complex maps where the AI has no clue what is going on, so its unit choice is no better than pure random (while being awfully boring and stupidly easy to counter). If I understand correctly, the ratio of efficiencies is effectively the ratio of purchased quantity (although different efficiencies are calculated based on the purpose of the would-be unit). If so, instead of some cryptic calculation involving raising stuff to 30th power, could it not just simply read numbers from a map specific configuration file when being told so?
-
@alkexr Yeah, providing XML AI configuration for influencing purchases is something I'd like to do as well as other AI XML configs. Its a bit more complex than just looking at the ratios as it calculates a bunch of stuff around what type of units to buy attack vs defense vs fodder vs long range for example. So just setting those efficiencies probably won't be enough to get the effect you are going for. Most likely I'll either add a few default algorithms to choose from that is different from the current behavior that looks primarily at say "TUV" to value units for complex maps. Could also create AI unit classifications so that map makers could tag units with different tags to let the AI know how they are meant to be used.
One of the challenges is its fairly easy to imagine specifying units for germany/russia on WW2 maps but much more difficult for say UK because they have lots of different threaters which need different units if you have complex unit sets. So really providing a way for the AI to understand the 'value' of a unit and 'when' to use it is the best approach IMO.
-
@redrum I don't expect the AI to ever understand that "charge" special attack is good against infantry. I'm not even asking the AI to play reasonably well on such complex maps. What I want is to manually adjust for this blindness of the AI by forcing it to purchase more than a single type of unit, preferably a diverse unit composition. This won't make the AI much better, but it will at least make it less boring and less vulnerable to trivial counterstrategies.
I don't fully understand the AI purchase logic, but it seems like it buys units for specific purposes: sea, fodder, defense, etc. A map specifically configured mix of units for each purchase purpose would do it for me. Something like "buy 40% walls and 60% archers for defense". Not asking for the ability of the AI to assess the value of each unit in any way. (Yes, I want the AI to blindly believe that the units are balanced, and that there are no obviously op/useless units. It's the responsibility of the map maker if they are not balanced and the configured AI is suboptimal as a consequence.)
(For reference, I'm talking primarily about Large Middle Earth, and partly about the upcoming Fallen Empire.)
-
@alkexr Yeah, while it would be possible to eventually have the AI understand units being good against other specific units we are pretty far off from that. Though for example the AI actually determines support attachment value by looking at the ratio of nearby supportable and supporting units. For example, if the AI has lots of infantry but 0 artillery then it'll give full value to the artillery support attachment where as if it has 0 infantry but lots of artillery then it'll give almost 0 value to the artillery support attachment.
I think the simplest solution is just having an AI option that only looks at TUV, air/land/sea, and movement then assumes attack/defense, support, and AA options are balanced for the unit set.
-
been playing some more games, and have some notes; I also often play as just one major nation, leaving all others to ai to make it more of a challenge.
general observations on ai play in the big world 2 maps (both rise of the axis and balance of power)
if you set all nations to ai, the axis reliably win. I don't know what hte maps underlying balance point is; but i'd say two particular factors that often hurt the ai allies play is that britain and US often fail to apply enough pressure.
If I play as just one of the majors: as russia I generally can't pull off a win; I can hold well for awhile, but eventually the pressure from germany + japan becomes too much, and they aren't distracted enough by the other allies' actions. playing as the US or britain, it's closer and I usually win. moreso in the rise of the axis map where the effect of my presence seems to have a larger effect.in the rise of the axis map, the axis have the typical ai difficulty of failing to expand as fast as they should, especially Japan; but they still seem to win anyways. the US in particular seems to project force quite poorly in this one; it's early buys are often pure fighters, with no way to get them somewhere they'll help. sometimes a stack of 15 fighters just sat in britain no accomplishing much.
nothing I can think of in particular to change how the ai plays; just observations of its behavior.
there's also one more specific bug I've noticed today:
in the Rise of the Axis map, on britain's first turn, they often let a plane or two die because they left them over the sea (to go on a carrier presumably, but I can't be sure that's why it does it), but didn't place the carrier in that location (which they clearly weren't planning to anyways cuz they moved their fleet elsewhere and it's an unsafe location). so they end up just lettin 1-2 planes die that they easily could have moved to land. this occurs in SZ 10.
with all nations set to ai this occurs fairly often on britain's 1st turn, maybe half of the time as I just ran 6 or so tests in the background. they buy a carrier, attack the german BB in sz 10, then leave a plane or two behind in sz10; usually when a plane is left behind, it's a tac bomber.when I tried getting the behavior to recur from an autosave during the turn, the ai got weird somehow: it didn't even place its carrier. but since it occurs often enough from the start, that should suffice.
that reminds me of a side note: is there an easy way to pause the game? if I set all nations to AI, they just keep going, which makes it hard to read through the history. i'm no taware of a good way to pause the game so I can look over it without my place getting interrupted whenever the ai makes a move.
edit addendum:
I have one change from the default map options: I set it so that bombard casualties CAN return fire. the default is they don't return fire. also, in terms of those settings done by those checkboxes at greenland, I don't use national advantages, and the transport/sub rules are set to "no" as well, which means it uses the old (revised?) sub/transport rules. I do that because if the first nation is ai controlled, it always moves them there. -
@zlefin not sure of a "good" way to pause it. I just hit save then quit and switch everyone to human on the restart. A pause button would be nice.
-
@zlefin Yeah, on most maps, Axis tends to do better than Allies since they are more centralized and need less naval forces. Naval AI is just plain difficult to do well. There was actually an old AI attempt (Dynamix) that only ever did land/air because naval was much more difficult to implement.
If you have some save games showing particularly poor purchases, I'd be glad to take a look at them. I'll see about running a quick Rise of Axis simulate for UK's first turn to see if I see that behavior.
There is no way currently to pause the AI but could probably add something so that it say stops at the end of the current AI players turn. Also, not sure if you autosave partway through the AI's turn but if so then that will cause weird behavior when you load it up as currently the AI doesn't persist any state to the save game so recalculates everything.
-
@zlefin I took a look at Rise of the Axis UK1 and the problem is the AI doesn't currently support 'friendly' relationship so it tries to move its air units to land in Russia and that move fails so they are left to die in SZ10. You can see this in the AI logs:
1-britishNonCombatMove: could not move [bomber owned by British] over Route:Finland -> SZ 12 East Baltic Sea -> Novgorod -> Western Russia because: Not all air units can land 1-britishNonCombatMove: could not move [tactical_bomber owned by British, fighter owned by British] over Route:SZ 10 North Sea -> SZ 6 Norwegian Sea -> SZ 7 Barents Sea -> Karelija because: Not all air units can land
-
@zlefin Here is the fix: https://github.com/triplea-game/triplea/pull/3318
The AI wasn't checking all the politics on what was valid landing zones so tried to land in what it considered 'allied' which appears to include 'friendly' in BW2: RotA. It now properly doesn't try to land UK air in Russia. Also tweaked things to avoid the AI trying to chase subs around with its air.
-
Alright, the AI dev redrum said he tweaked some tactical settings and I haven't tested the latest Axis and Allies AI update in maybe a year and a half so finally I got back at it vs version 1.9.0.0.9687! I am surprised that some think the Axis AI is tougher than the Allies AI on the WWIIClassic map ... maybe because of the positioning of the Axis but for myself I find that battling the 3 Allied AI country powers against my 2 Axis country powers is super tough!;
Match 1: this is where I forfeit my 1st turn with Russia for fun with me as the Allies and I blow my dice on Tech and only start if I don't win a tech ... so I have no money and I skip my turn and let the German AI go first overall ... I started ok and was surprised no Pearl harbor attack start by the Jap AI but the Germany AI marched fast and took my Russia capitol in round 4 maybe and with the Jap AI marching the Axis AI had Economic Victory in round 6 or 7 and as soon as I lost my UK navy I gave up in round 9
Match 2: this match I didn't forfeit my 1st turn with Russia and I played Russia very well and marched and took down the German AI capitol in round 7 and then with my other Allied countries I beat back the Jap AI and finally took its capitol in round 15;
0_1524468517512_latestaxisaidefeated32.tsvg
Match 3: Here's where it gets ugly vs this AI!!! I first tried to build Germany with units and do some small battles and try to handle the Allied AI navy forming but it built up too fast and I was too slow with Japan building too many Factories so Germany got squeezed and fell maybe round 8 and then I tried to last with Japan but I had no chance and quit at round 15
Match 4: this time I tried to take out the Allied AI's navy fast and succeeded using my German airforce but it didn't matter and although I played Japan a little better I still couldn't take the Russian AI capitol and my German capitol fell in maybe round 10 and when I saw Japan had no chance then I gave up around round 16
Match 5: Craziest match ever only because I played great and then stupid!!! This time I went all out with Germany attacking Karelia and the Russian AI on my 1st move ... the attack was awesome and I retreated because I had lots of units and I left the Russian AI with only 2 Fighters in Karelia .... from there the UK AI navy retreated because I still had all my German airforce and the Allied AI literally retreated for the first 3 rounds lol. I then played Japan sweet and marched to keep the Russia AI occupied and eventually my German forces took the Russian AI capitol in round 6. Here's where it gets nuts!!! ... I could have said this was my best played match EVER and would take all 3 Allied AI capitols in maybe 12 or 13 rounds but NO because 1st mistake I bought Anti-Aircraft thinking I could put 2 AA in 1 area but no you can't so I wasted 5 P.U. but no biggie ... but then twice I didn't retreat my Submarines in a battle because I forgot they can't hit Planes so duh I delayed building my German Navy at least 3 or 4 rounds due to stupidity and then also I had the American AI back-door me and take my German capitol in round 12 because I wasn't looking and I did take it right back but the American AI got all that P.U. there and then also I was soooooo lucky at a battle in round 17 where the American AI used 7 Infantry to try and liberate Russia where I only had 2 Jap Tanks and a Fighter to defend loool and I miraculously won that battle even still with 4 American AI Infantry vs my 1 Jap Fighter and I still held the capitol and if the American AI had liberated Russia there I think I would have lost momentum but somehow I held it and then played well again (minus my stupid middle rounds) and then hadto rebuild an airforce and navy to take back the North Sea waters and finally captured the UK AI capitol in round 23 and then Germany and Japan took turns Strategic Bombing and attacking North America for another 9 rounds to finally take the American AI capitol ... wow does this Ai utilize Stategic Bombing so well now and in this match the Allied AI Anti-Aircraft TWICE rolled snake eyes with my 2 Planes Strategic Bombing and it seems like my Anti-Aircraft can't hit anything lol.;
0_1524470599970_latestalliesaidefeated32.tsvg
That was a blast and I'm ready to test the AI again if there's another tactical update!
-
I always like reading battle reports.
Yah Classic is tilted a lot in fanvour of the Allies (I think the bid for Axis is about 20), so, if the AI would become as good as a fairly skilled player, then beating the Allies AI in a standard game should be virtually impossible.
I recally I already suggested this, but maybe you want to try skipping only the first combat move with Russians, instead of skipping the whole first turn. This would be a practice in between your two extreme of either totally skipping the first turn or playing by the box. This should give you a fairly balanced challenge, instead of the extremes of the game being either almost impossible or overly easy.
Tho I have to say I'm intrigued by maybe trying out your AI handicap of totally skipping Russians 1 and see if I might beat the AI anyways.
Side note, you don't need to blow your dice on tech, or something like that. TripleA now allows you to remove PUs with Edit mode. You can also just buy units and not place them, since in Classic they get destroyed.
-
@cernel Oh thanks for that tip about removing P.U.'s but, anyways, completely skipping Russia's 1st move was something me and my friends try occasionally for fun with the actual board game and my friends have actually beat me when I was the Axis and they were the Allies and they skipped Russia's 1st turn and let me go first with Germany and they still beat me and they loved that win!
Against the Ai, I can't remember if I've ever beaten the Axis AI still when I forfeited my 1st turn with Russia (I would say it if I did in my posts earlier in this thread!) but it's my usual routine for testing the updated AI - the 1st game I do the Russia forfeit move, and then if I lose I don't forfeit my 1st move with Russia in the next match. Once I've beaten the Axis AI, I then do a regular match against the Allies AI which is very hard as I've said ... and getting harder!
-
For beating the Ai, oh I wanted to mention that using Low Luck dice is a massive help and if I didn't use Low Luck dice I bet I would have played way more games trying to beat the Ai so basically Low Luck dice is a bigger help against a machine opponent than a real person I am positive eh?
-
<attachment name="triggerAttachment_Produce_submarine" attachTo="Player1 " javaClass="games.strategy.triplea.attachments.TriggerAttachment" type="player">
<option name="conditions" value="conditionAttachment_Player1_produce_submarine"/>
<option name="purchase" value="Submarine" count="1"/>
</attachment>A human player receives the free submarine from the above trigger and can place it during the placement phase alongside other normally purchased units, but the AI is seemingly blind and does not know about, see and place the trigger given submarine?
I actually thought that the problem of AI not placing free units was restricted to infrastructures and upgrades, I don’t know it also didn’t place normal units. Or is it just given isSea units that are not placed by the AI?BTW: I played on 1.9.0.0.10498
-
@frostion My guess is its just "isSub" units as the AI doesn't fully handle them though I'd need to take a look. If you're able to run a quick test giving them say a destroyer instead of a sub then that'll help narrow it down.
-
@redrum
No, I have now tried with Battleships, Cruisers and Destroyers. The AI gets them in the bank (this can be seen in the history at the left of screen and in the history fan to the right) but the ships are never placed.I don’t think AI can place sea units that have been given via trigger.
I have tried the same conditions and triggers with land units, and they are placed.
-
@frostion Alright, thanks for the additional info. Guess placing triggered sea units must not be implemented. I'll try to take a look at it later today.