TripleA Logo TripleA Forum
    • TripleA Website
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Tags
    • Register
    • Login

    AI Interesting Moves and Points of Improvement on Revised

    Scheduled Pinned Locked Moved Feature Requests & Ideas
    53 Posts 8 Posters 12.7k Views 7 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Alexei SvitkineA Offline
      Alexei Svitkine @redrum
      last edited by Alexei Svitkine

      @redrum said in AI Interesting Moves and Points of Improvement on Revised:

      @Alexei-Svitkine AI testing is always helpful but doing it with the pre-release is definitely more useful as there are a decent number of AI updates there and stable release save games aren't compatible with the pre-release so hard to then retest. I'm primarily waiting til we release 2.0 until doing more AI changes.

      The purpose of the game wasn't to do testing, but to play a game. 🙂 I just shared it, in case it was helpful.

      We played on 1.9 because that's the last stable release. (For example, until a couple of days ago, 2.0 had a bug where the game could not advance past the Repair phase - which I just fixed recently in https://github.com/triplea-game/triplea/commit/fcf04c96796bac7bda8b586518b1087ef83009fc.)

      It's unfortunate that 2.0 save game incompatibility is blocking AI improvements.

      Have we considered having 2.0 be able to load 1.9 saves? For example, via a helper .jar built from the 1.9 code that can export to 2.0 format?

      1 Reply Last reply Reply Quote 0
      • Alexei SvitkineA Offline
        Alexei Svitkine
        last edited by Alexei Svitkine

        Okay, I have a save game from Great War map on 2.0 (so save game compatible), where AI played badly.
        For context, in this game, Ottomans and Austria is played by humans and all other countries played by AI.

        Here are some particular dumb things:

        • Early on - e.g. Round 8 - Germany could attack US transports with some subs and sink troops. Yes, transports defend on a 1 on this map, but still, its worth it to sink troops. Also, US should be defending its navy better.
          Screen Shot 2019-11-02 at 7.48.28 PM.png

        • In Round 8, US builds a plane in US. There are no ACs on this map and that plane literally cannot make it out of there. Later in the game, it builds another.

        • In Round 10, Russia built some boats. Why?

        • In Round 11, Germany attacks with a bad force. It has lots of Artillery and infantry, but chooses to attack mostly with infantry. In general, it seems AI was not pairing up Artillery and Infantry in this game - and just left lots of Artillery behind - and moved them into the same territory after in non-combat. Why? (20 Artillery left behind:)
          Screen Shot 2019-11-02 at 7.39.57 PM.png

        • Round 13: Germany does a dumb attack on Crimea when Russia has a strong counter attack
          Screen Shot 2019-11-02 at 7.45.46 PM.png

        • Round 18: Russia is fighting for its life. It decides to buy Cavalry instead of defensive units.

        • In Round 20, lots of Artillery left behind. Attack with 22 infantry and 2 out of 31 artillery. WTF? (The red army is Ottoman who is on the same side as Germany, so no counter attack there.)
          Screen Shot 2019-10-31 at 8.38.53 PM.png

        There's a bunch of other silly stuff in there, but those are some of the most dubious.

        Some other things:

        • AI was basically never buying planes in Europe.
        • Western front battles were very wonky (between France AI and Germany AI). I think neither side played well.
        • Germany spent lots of resources building fleets in the Mediterranean where it was not useful most of the game.
        redrumR 1 Reply Last reply Reply Quote 2
        • redrumR Offline
          redrum Admin @Alexei Svitkine
          last edited by

          @Alexei-Svitkine I don't think you actually attached the save game? If you still have it, can you add it here.

          TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

          Alexei SvitkineA 1 Reply Last reply Reply Quote 0
          • Alexei SvitkineA Offline
            Alexei Svitkine @redrum
            last edited by

            @redrum said in AI Interesting Moves and Points of Improvement on Revised:

            @Alexei-Svitkine I don't think you actually attached the save game? If you still have it, can you add it here.

            Oops, my bad. Here it is.

            Nov2_GreatWar.tsvg

            redrumR 1 Reply Last reply Reply Quote 0
            • redrumR Offline
              redrum Admin @Alexei Svitkine
              last edited by redrum

              @Alexei-Svitkine Responses on the save game:

              • Round 8 Germany - Not sure I agree. Attacking the cruiser is about 4 TUV attack and attacking the transport stack is about 0 TUV attack (80% chance to kill 1 transport which is worth about 12 itself + 6 in units so 18 total but trading 14 TUV in subs for that)
              • Round 8 USA - Yeah, the AI defaults to spending extra cash on planes assuming there is either carriers that can eventually move them or that they have enough range to reach enemies eventually. This is one of the few maps that this assumption isn't true for and additional logic needs added to prevent buying planes in this situation.
              • Round 10 Russia - In this case, the AI didn't know what else to purchase. It maxes out units in Moscow and realizes building units in Petrograd is a waste as they will just die. At that point, it doesn't have anywhere else to place units so decides to buy a few ships. I think you could argue its better to just buy inf in Petrograd or buy some planes instead of land units in Moscow.
              • Round 11 Germany - This is a current limitation of the AI. It essentially attacks with enough units so that it has overwhelming odds and tends to prefer to attack with cheapest units first. Once it hits a certain odds threshold it doesn't add any more units into the attack. The main reason for this is to give it some flexibility in NCM in case another nearby battle goes poorly. But it should have more logic to add in additional units in cases like this though in the end adding those 20 art into the attack only improves TUV trade by like 3-4 so not a huge difference just seems a little odd.
              • Round 13 Germany - I'd probably disagree here. The AI tries to use the minimum number of units to capture the factory (probably should use more art and less inf) and has around a +10 TUV average here for that battle and gets unlucky. It would force Russia to then attack there with probably a +15-20 TUV. So would lose a bit in the trade but stop factory production and force Russia to attack there. Plus trading units with Russia is good to wear them down.
              • Round 18 Russia - Ha. This one is a bit funny looking at it. So the AI tries to use all of its PUs so originally wanted to buy 6 inf but then tries to spend all of its PUs to upgrades 2 of the inf to cavs. It should really upgrade them to arts instead but the "spend remaining resources" logic is a bit basic at the moment.
              • Round 20 Germany - I think you have the wrong screenshot or something here???
              • Planes - AI generally doesn't buy enough planes but this is a tough thing to balance. Generally its better to favor land units as the AI doesn't use planes as effectively as humans.
              • Germany Med Fleet - I quickly glanced through and didn't see them buying too many ships. Mostly just looks like the consolidated what they had to the Med.

              Overall, some good feedback. I think it falls into a few categories.

              1. AI doesn't really have enough production capacity or doesn't know what else to buy so it does kind of whacky things like buy a few ships it really shouldn't, buy a plane where its stuck, or replace buying inf to cav.
              2. Attacking without all units it could and not using higher attack units enough (art). This just has to do with the AI attack algorithms preferring cheap units first and it preferring to 'save' units for NCM after a certain threshold.

              That being said, it does appear the AI does pretty well and eventually the all AI side is winning.

              TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

              Alexei SvitkineA 2 Replies Last reply Reply Quote 1
              • Alexei SvitkineA Offline
                Alexei Svitkine @redrum
                last edited by Alexei Svitkine

                That being said, it does appear the AI does pretty well and eventually the all AI side is winning.

                I would argue this is mostly due to Germany (played by AI) not pulling its weight. Besides the issues I mentioned, it basically doesn't focus enough on western front and keeps a massive amount of units in the middle of its territory where it's not useful for most of the game.

                In general, I find both AIs of France and Germany don't manage the western front well. But there is no single disastrous move - just lots of bad moves - i.e. attacking with very few units and leaving them to die later, rather than keeping forces consolidated.

                redrumR 1 Reply Last reply Reply Quote 0
                • Alexei SvitkineA Offline
                  Alexei Svitkine @redrum
                  last edited by Alexei Svitkine

                  @redrum said in AI Interesting Moves and Points of Improvement on Revised:

                  • Round 13 Germany - I'd probably disagree here. The AI tries to use the minimum number of units to capture the factory (probably should use more art and less inf) and has around a +10 TUV average here for that battle and gets unlucky. It would force Russia to then attack there with probably a +15-20 TUV. So would lose a bit in the trade but stop factory production and force Russia to attack there. Plus trading units with Russia is good to wear them down.

                  Ok, doing the odds, it looks like the attack is a 88% in favor of Germany, which is not as bad as I thought. Still, sending a couple of extra units arti would bring it to 99%. So it should have sent a stronger force to guarantee the win. Gambling with a 12% failure rate is not great for a "hard AI".

                  Also, for example, just going from 22/2 inf/arti to e.g. 16/6 (which costs 2 less TUV) results in a 95% win percentage with more units left for the attacker (and thus more trouble for Russia to retake since they all defend on a 2), while spending less TUV on it.

                  So I think it boils down to the AI needing to do infantry/arti attacks smarter.

                  redrumR 1 Reply Last reply Reply Quote 0
                  • redrumR Offline
                    redrum Admin @Alexei Svitkine
                    last edited by

                    @Alexei-Svitkine I'll have to look a bit closer at the overall game.

                    Here is a PR to address the weird buying cavalry instead of stronger units when its capital is about to fall: https://github.com/triplea-game/triplea/pull/5505

                    TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

                    1 Reply Last reply Reply Quote 1
                    • redrumR Offline
                      redrum Admin @Alexei Svitkine
                      last edited by

                      @Alexei-Svitkine I glanced over the game as a whole and actually the thing that jumps out most is that the Austrians played very poorly (I'd say more so than Germany or Ottos). They often weren't spending their PUs, lost control of Istria area, didn't help Germany much with Russia or Italy, etc. Really their only good play is taking out Petrograd (which was actually kind of lucky and poor play by the Russians). This then causes Germany to have to spend a lot of PUs to help defend Austria and deal with Russia which left it very little for the western front where it just gets overwhelmed by France/UK. It also takes the CPs way too long to take out Russia and by the time they do, Allies have just too much of a sheer numerical advantage.

                      Yeah, the AI right now prioritizes using too many cheap units for attacks (inf) and should balance this more with high attack units (art). This is a difficult problem to solve across all maps and all unit sets which is why the AI tends to overly prefer using cheap units.

                      TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

                      1 Reply Last reply Reply Quote 1
                      • Alexei SvitkineA Offline
                        Alexei Svitkine
                        last edited by Alexei Svitkine

                        @redrum said in AI Interesting Moves and Points of Improvement on Revised:

                        @Alexei-Svitkine I glanced over the game as a whole and actually the thing that jumps out most is that the Austrians played very poorly (I'd say more so than Germany or Ottos). They often weren't spending their PUs, lost control of Istria area, didn't help Germany much with Russia or Italy, etc. Really their only good play is taking out Petrograd (which was actually kind of lucky and poor play by the Russians). This then causes Germany to have to spend a lot of PUs to help defend Austria and deal with Russia which left it very little for the western front where it just gets overwhelmed by France/UK. It also takes the CPs way too long to take out Russia and by the time they do, Allies have just too much of a sheer numerical advantage.

                        Yeah, the AI right now prioritizes using too many cheap units for attacks (inf) and should balance this more with high attack units (art). This is a difficult problem to solve across all maps and all unit sets which is why the AI tends to overly prefer using cheap units.

                        I agree that Austria played poorly that game. Austria and Italy typically have a stale mate, holding a neighbouring territory each and exchanging control of another each turn. Austria wasn't quick enough at the start of the game to move that border into Italy and so the game of tag was in Austria's borders, which was awful for it.

                        Having said that, I think until Russia gets defeated, Germany has a lot of trouble figuring out what to do with its big forces. Often, they hang around in Warsaw or elsewhere in the middle of its territory (I'm talking 40-100 guys) - not contributing to either front.

                        I have another save game with the same scenario where Central powers do better, but again similar blunders by the AI are observed.
                        Nov17_GreatWar_Try2.tsvg

                        In this new save game, here are some issues:

                        Round 17:
                        At this point, Russia's fall is imminent.
                        Germany moves units from East Prussia to Lodz (towards Russia), even though they're not needed there. It should be moving towards the western front, since Russia will be eliminated by Austria by the time these units can actually threaten Russia.
                        Germany also moves lots of units to Kiev, again which are not needed there.
                        Please note that at this point, Western front desperately needs help and Germany is losing Hanover each turn and has to retake it, so moving their big force away from there is a bad move.
                        They leave Konigsberg undefended - which lets a transport land a unit there and capture it that round. Sure, they can kill on the counterattack, but it's better to just leave one or two units there to prevent this.

                        Round 18:
                        Germany decides to move back from Lodz to Silesia - basically undoing the move it did last time - it could have been ahead instead.
                        Germany also sends its large force from Kiev to Crimea, which is not useful there. I believe it's trying to amass a secondary force next to Russia to threaten it, but given that Austria really does not need help there and the fact that Germany is having troubles elsewhere, it really shouldn't be doing this.

                        Italy tries to take back its capital. It's desperate. It attacks with a percent chance to win of 38%. However, it just forgets an artillery that could have participated that would have raised the chance to 53%.
                        Screen Shot 2019-11-17 at 6.50.01 PM.png

                        Round 20:
                        Germany builds a factory in Serbia. This doesn't seem useful as its focus should still be on the western front and it doesn't need a factory there.
                        Later it will use this factory to send some units to help in Italy, but really it's just not needed. Germany already has two factories neighbouring Serbia - in Greece and Bulgaria.

                        Round 21:
                        British take East Prussia and Konigsberg from Germany who again fails to leave a token force behind - just leaving them completely empty and then having to retake them back next turn.

                        I have to check my notes, I might have other things I've observed in this playthrough, but these are from the most recent session.

                        EDIT:

                        Here are some more from earlier turns:

                        Round 5:
                        Germany has 8 subs in Sea Zone 10 near US navy. They decide to move (non combat) to Sea Zone 6. However, in the process (if they did as a combat move), they could have taken the Sea Zone 7 convoy center from the French.
                        Screen Shot 2019-11-17 at 7.02.53 PM.png

                        Round 7:
                        Germany has a good force near Bar-le-Duc and could easily defend it. It's a factory on the western front - so a very good thing to keep. (Sure they can retake next turn, but that means they can't build units there.)
                        Instead, they abandon it.
                        Before:
                        Screen Shot 2019-11-17 at 7.03.37 PM.png
                        After:
                        Screen Shot 2019-11-17 at 7.05.05 PM.png

                        redrumR 3 Replies Last reply Reply Quote 1
                        • Captain CrunchC Offline
                          Captain Crunch Banned
                          last edited by Captain Crunch

                          glossing over your conversations it reminds me the curious observation I made about the AI years ago I said to redrum that when playing the WWIIClassic map I thought the AI bought too many Artillery and not enough cheaper Infantry yet in this thread conversation perhaps the AI needs to purchase the more expensive Artillery type units ... as redrum just mentioned so it shows you how fickle the "probability of victory" percent roll is when trying to set the algorithm just right (requires many trials amiright)

                          1 Reply Last reply Reply Quote 0
                          • redrumR Offline
                            redrum Admin @Alexei Svitkine
                            last edited by redrum

                            @Alexei-Svitkine Responses:

                            Round 17:
                            I agree that at this point, its clear to a human that Turkey will be able to finish off Russia. The challenge is that is very difficult for the AI to determine especially multiple rounds ahead of when it will actually fall. Generally the AI looks at the current map situation and moves each unit towards what its believes is the closest and most valuable objective which in this case is Moscow still. Now I think round 19, it wouldn't be that difficult to see that Turkey will capture Moscow that turn so ignore it on Germany's turn but any turns before that its tough.

                            Round 18:
                            Germany decides to move back to Silesia because it lost the Cologne and Alsace factories and now thinks that is the new most important objective for those units. Unfortunately, it didn't realize it was gonna be double attacked and lose Cologne and its hard for the AI to simulate future turns. That being said Germany does appear to struggle with not moving its units away from Berlin and kind of dancing back and forth. I'll take a closer look at this.
                            So the AI tends to leave 1 unit in each territory to block blitzes. It obviously shouldn't do that here and some additional logic should be added to override blocking if that extra unit is really needed.

                            Round 20:
                            This is just a case of the AI not knowing what else to spend its extra PUs on after building land units in its factories that are relatively close to the enemy fronts (ignores Petrograd). You could argue its better off building some air units or naval units but its tough to balance when to buy air vs sea vs factories.

                            Round 21:
                            The Germans assumed that the Turks would leave a few units to defend East Prussia from that stack they have there. It doesn't really care about Konigsberg since it can just counter attack to take it back.

                            Round 5:
                            Yeah, the AI doesn't currently consider multiple paths to a territory.

                            Round 7:
                            There is an actual bug here. The AI ends up being overly cautious around defending some territories due to some randomness in its calcs. It should definitely defend Bar-le-Duc and a number of other territories that it doesn't this turn.

                            TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

                            1 Reply Last reply Reply Quote 2
                            • redrumR Offline
                              redrum Admin @Alexei Svitkine
                              last edited by

                              @Alexei-Svitkine Here is a PR to fix the round 7 example: https://github.com/triplea-game/triplea/pull/5559

                              TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

                              Captain CrunchC 1 Reply Last reply Reply Quote 1
                              • LaFayetteL Offline
                                LaFayette Admin
                                last edited by

                                Here's an interesting one, round 56, AI not wanting to capture Germany:

                                Screenshot from 2019-11-21 20-33-01.png

                                ai.tsvg.zip

                                1 Reply Last reply Reply Quote 0
                                • redrumR Offline
                                  redrum Admin @Alexei Svitkine
                                  last edited by

                                  @Alexei-Svitkine I also reviewed the AI not moving away from its capital area and there was an issue in capital land superiority checks causing it to abort moving units away from its capital. PR to improve that: https://github.com/triplea-game/triplea/pull/5562

                                  This potentially will make a major improvement in the German AI on Great War.

                                  @LaFayette That definitely looks bad and I imagine the UK should have captured Germany probably 10 turns ago. I'll try to take a look tomorrow.

                                  TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

                                  LaFayetteL 1 Reply Last reply Reply Quote 0
                                  • LaFayetteL Offline
                                    LaFayette Admin @redrum
                                    last edited by LaFayette

                                    Ah, belay that @redrum ; I had a buggy version. I was noticing the AI was not sending enough units in to attack. So AI was building up but could never close the deal 😃

                                    It was pretty interesting to see the borders had shifted quite a bit nonetheless.

                                    redrumR 1 Reply Last reply Reply Quote 0
                                    • redrumR Offline
                                      redrum Admin @LaFayette
                                      last edited by

                                      @LaFayette Ok. That's a relief as if the AI doesn't attack in that situation, I was pretty worried that there was a major issue.

                                      TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

                                      1 Reply Last reply Reply Quote 1
                                      • Captain CrunchC Offline
                                        Captain Crunch Banned @redrum
                                        last edited by Captain Crunch

                                        @redrum the AI Improve Defend Territory Check. That sounds like a vague check. Is that a number in 1 stat that you slightly increased or decreased? Is it named Defend Territory Check?

                                        EDIT: Ok, I see another page of this thread after I posted that and you made another bug fix for Capitol Defense Check ... again, is that just 1 number you increased or lowered?

                                        Basically I'm asking if you tweeked both the AI's Defend Territory function and the AI's Capitol Defense function by just changing 1 value for each?

                                        right?

                                        Does those 2 bug fixes effect the AI for WWIIClassic map?

                                        redrumR 1 Reply Last reply Reply Quote 0
                                        • redrumR Offline
                                          redrum Admin @Captain Crunch
                                          last edited by

                                          @Captain-Crunch Both updates are a bit more than just tweaking a value:

                                          • Improve Defend Territory Check - Sometimes the AI would add some units to try to defend a territory and when checking the result vs the result of not adding the units, it would decide not to defend it. Now the AI as long as it projects the defense to have a positive average TUV trade will add the units to defend it.
                                          • Improve Capital Defense Check - The AI makes a land superiority check (allied vs enemy units within a certain range of its capital) and was only considering units that had already been moved and ignoring units that could still move causing it to often abort defenses. This now makes it consider the max units it could move to nearby territories and then remove units that have moved away from it for other defenses already.

                                          Both of these improvements impact all maps including Classic though I'd say they probably have a bigger impact on larger maps like Great War. In particular, if you saw cases that the AI didn't move its units forward in noncombat move were it could defend, these 2 changes should hopefully fix those cases.

                                          TripleA Developer with a Passion for AI: https://forums.triplea-game.org/topic/105/ai-development-discussion-and-feedback

                                          Captain CrunchC 1 Reply Last reply Reply Quote 4
                                          • Captain CrunchC Offline
                                            Captain Crunch Banned @redrum
                                            last edited by

                                            @redrum you rock! I really thought your tweek was going to be much simpler so thank-you for that excellent reply which helps me understand the game programming a bit better and also thank-you for telling me it effects all map AI's so it looks like I'm due to submit another couple games against the AI on the WWIIClassic map ... I'm kinda busy doing some other stuff but I will get 2 wins vs the AI maybe for next weekend but, anyways, excellent reply and much appreciated

                                            1 Reply Last reply Reply Quote 1

                                            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
                                            • 1
                                            • 2
                                            • 3
                                            • 1 / 3
                                            • First post
                                              Last post
                                            Copyright © 2016-2018 TripleA-Devs | Powered by NodeBB Forums