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

    AI Development Discussion and Feedback

    Scheduled Pinned Locked Moved AI
    316 Posts 32 Posters 431.4k Views 30 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.
    • redrumR Offline
      redrum Admin @Frostion
      last edited by redrum

      @Frostion Good question. I believe the AI will essentially see the unit as "free" if it cost 0 PU as it divides its computed value by the PU cost which would essentially be infinity so consider it always the best defense option if its available. But I can't say I've ever tested it and there is a chance that 0 PU units could cause an error in some calculation.

      Generally yes it uses the same logic but only considers buying 0 move units when trying to defend a territory. It uses a factor of 0.1 for 0 move units compared to a factor of 1 for 1 move units (essentially sees them as an order of magnitude worse) so will usually only buy them if they are the only option (or cost 0 PU). Examples are NWO/WaW where it will buy bunkers as they are isConstruction so is the only option after placing up to the factory value. Same with Dom NML where it'll buy trenches after purchasing 1+ move units up to the factory value. Napoleonic Empires it'll probably only buy mortella_towers if it happens to end up with 3 remaining PUs so would have no other options as they aren't isConstruction.

      EDIT: Also it might be time to finally consider adding support for the AI to value other resources given we finally have a few maps that use multiple resources and seems like a few more in development. I'll need to try to dig up some of the initial thoughts I had around the best way to do it.

      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
        last edited by redrum

        So digging through the chronicles of history...

        Here was my original design around AI valuing non-PU resources (along with a bunch of related posts from @Frostion and myself): http://tripleadev.1671093.n2.nabble.com/AI-Development-Discussion-tp7585227p7590752.html


        Here is the initial design:

        1. Find resource that I have the most of (A).
        2. Find unit cost in terms of A by converting all other resources (B, C, etc) to this resource using ratio of this resource to the most resource.
        3. Use this value instead of the PU value that is used today for finding unit efficiencies.

        Example #1:
        Current resources and amounts:
        A - 50
        B - 5
        Units:
        U1 - cost 1 B, very weak unit
        U2 - cost 1 B and 10 A, stronger unit (3x 'power' of U1)

        #1 purchase (50 A, 5 B | 1B is worth 10A)
        U1 would be evaluated to cost 10A with efficiency (power/cost) of 1/10
        U2 would be evaluated to cost 20A with efficiency of 3/20 (purchase this unit)

        #2 purchase (40 A, 4 B | 1B is worth 10A)
        U1 would be evaluated to cost 10A with efficiency of 1/10
        U2 would be evaluated to cost 20A with efficiency of 3/20 (purchase this unit)

        And so on, so the AI would most likely buy 5 U2's which is good in this case.

        Example #2:
        The AI’s bank has 52 PUs (A), 26 Manpower (B) and 13 Coal (C)
        Infantry: 6 PUs/5 Manpower, power~7
        Artillery: 8 PUs/2 Manpower/1 Coal, power~8
        Tank: 10 PUs/1 Manpower/2 Coal, power~9
        (power values are just approximate showing that units are in decreasing efficiency based on just PUs, tend to buy most inf then art then tank ignoring new resources)

        #1 purchase (52 A, 26 B, 13 C | 1B is worth 2A, 1C is worth 4A)
        Infantry would be evaluated to cost 16A with efficiency (power/cost) of 7/16
        Artillery would be evaluated to cost 16A with efficiency of 8/16 (purchase this unit)
        Tank would be evaluated to cost 20A with efficiency of 9/20

        #2 purchase (44 A, 24 B, 12 C | 1B is worth 1.83A, 1C is worth 3.67A)
        Infantry would be evaluated to cost 15.15A with efficiency (power/cost) of .46
        Artillery would be evaluated to cost 15.33A with efficiency of .52 (purchase this unit)
        Tank would be evaluated to cost 19.17A with efficiency of .47

        .. 3 more artillery, I believe

        #6 purchase (12 A, 16 B, 8 C | 1B is worth 0.75A, 1C is worth 1.5A)
        Infantry would be evaluated to cost 9.75A with efficiency (power/cost) of .72
        Artillery would be evaluated to cost 11A with efficiency of .73 (purchase this unit)
        Tank would be evaluated to cost 13.75A with efficiency of .65

        So it would end up buying 6 Artillery with remaining 4 A, 14 B, and 7 C. Though each time it will value B and C less since A is becoming worth more as it is spent too quickly as you can see in purchase #2. This makes infantry become more and more efficient in comparison to artillery since it has the lowest PU cost. The AI essentially tries to spend resources as evenly as possible but the unit set is weighted too much towards costing PUs in comparison to starting resources.


        Follow up design (adding demand based):

        The algorithm has relatively few steps based around resource supply but has lots of power due to the feedback loop in it. The feedback loop allows the AI to adjust valuation of resources as they are spent so at first a very sparse resource will be worth a ton but as the AI spends its other resources the very sparse resource value becomes less and less.

        You bring up a good point about the available units. This algorithm so far is only a supply side algorithm as it only evaluates what/how many resources you have. To take the algorithm to the next level (more complex) you would then add in 'demand' ratios as well (how much of the resource is in the purchase options).

        So if you had a very sparse resource (like B above) and it is needed for every unit available for purchase then B is really worth even more (you pretty much don't care about anything but B since its the limiting factor). The opposite is if you have say 100 units to choose from but only 1 cost some B then B isn't worth quite as much since you have lots of other options that don't need B.

        1. Taking the above example with 1 unit that cost 10A and another unit (equal strength) that cost 1B. The average A cost across the unit set would be (10 + 0) / 2 = 5A per unit and B would be (0 + 1) / 2 = 0.5B per unit:
          50A / 5A = 10 units worth, 1B / 0.5B = 2 units worth, so unit#2 cost 5 times unit#1 (50A) - no change to the above

        2. Unit set skewed towards A: Now let's say we have 9 units that cost 10A and 1 unit that costs 1B. The average A cost across the unit set would be (109 + 0) / 10 = 9A per unit and B would be (09 + 1) / 10 = 0.1B per unit:
          50A / 9A = 5.56 units worth, 1B / 0.1B = 10 units worth, so unit#2 cost 5.56/10 (0.56) times unit#1 (5.56A) - would definitely purchase unit#2 first

        3. Unit set skewed towards B: Now let's say we have 1 unit that cost 10A and 9 units that costs 1B. The average A cost across the unit set would be (10 + 09) / 10 = 1A per unit and B would be (0 + 19) / 10 = 0.9B per unit:
          50A / 1A = 50 units worth, 1B / 0.9B = 1.11 units worth, so unit#2 cost 50/1.11 (45.05) times unit#1 (450.5A) - would definitely purchase unit#1 first

        You can see by adding this 'demand' ratio this then checks to see how much of the various resources are needed across the available unit set to take into account whether the unit set is 'balanced' across the various resources. It then adds more weight to resources that are needed the most in the unit set.

        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
          last edited by Captain Crunch

          ok I finally downloaded the latest Triple A release 1.9.0.0.13066 on this awesome new computer running Windows 10 and I also read redrum's latest posts so I'm caught up on this thread when I was off the forum for a bit but anyways tonight I can finally battle redrum's nasty AI on the World War II Classic map again!

          Not sure if I'll try to beat both the Allies AI and the Axis AI in one night but I'll get back to yous and who knows how long it's gonna take but is always fun!

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

            already 1 loss to the Allies AI ... so this may take a while hehe

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

              Side-note, FWIW, for the latest AI, you can check out the prerelease: https://github.com/triplea-game/triplea/releases

              We could really use as many people playing through the prerelease as possible and reporting any bugs/problems that they encounter.

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

                @LaFayette I just assumed the download at https://triplea-game.org/download/ had the latest AI upgrade ... I'm sure your link's AI update isn't much different from the 1.9.0.0.13066 version I am playing right now unless redrum knows of any tactical AI changes since 1.9.0.0.13066 but whatever this AI I am trying to beat is still gonna be tough! I'm not sure if I will test the AI again tonight or when I'll play during the week but I'll submit wins vs the Allies AI and Axis AI at some point

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

                  @Captain-Crunch There are some improvements in the pre-release that @LaFayette pointed to. If you are on Windows 10 then here is the direct link to the latest download: https://github.com/triplea-game/triplea/releases/download/2.0.17997/TripleA_2.0.17997_windows-64bit.exe

                  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
                  • Captain CrunchC Offline
                    Captain Crunch Banned @redrum
                    last edited by Captain Crunch

                    @redrum rofl thanks ok well I took 1 loss already but I do want to battle the latest AI so will install it and get back to you when I got a win vs the Allies AI and Axis AI ... so don't hold your breath because I may have to do many matches but I want to get it done over the week eh

                    ubernautU 1 Reply Last reply Reply Quote 1
                    • ubernautU Offline
                      ubernaut Moderators @Captain Crunch
                      last edited by

                      @Captain-Crunch it works pretty well now, especially for ground wars. When i was getting back up to speed i noticed several weaknesses in its tactics, however.

                      Wouldn't want to spoil it for you though i'm sure you will find them for yourself before too long. 🙂

                      Anyway once you get the edge on AI i have found handicapping it allows you to really get back up to cruising altitude. 🙂

                      "You should never have told me horses sleep standing up, it gave me a mental block." - Mister Ed

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

                        @ubernaut If you have feedback around a pretty recent pre-release version and the AI performance, I'd be interested in it. Feel free to post it somewhere or message me here on the forum. Some things are easier to improve then others but always welcome the feedback.

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

                        ubernautU 1 Reply Last reply Reply Quote 0
                        • ubernautU Offline
                          ubernaut Moderators @redrum
                          last edited by

                          @redrum i mainly stick to the stable releases these days is there a mac build or do i have to do it myself?

                          "You should never have told me horses sleep standing up, it gave me a mental block." - Mister Ed

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

                            @ubernaut Here is the latest mac build: https://github.com/triplea-game/triplea/releases/download/2.0.17997/TripleA_2.0.17997_macos.dmg

                            All pre-releases can be found here: https://github.com/triplea-game/triplea/releases

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

                            ubernautU Captain CrunchC 2 Replies Last reply Reply Quote 0
                            • ubernautU Offline
                              ubernaut Moderators @redrum
                              last edited by

                              @redrum i'll check it out can it play global or should i try a simpler map?

                              "You should never have told me horses sleep standing up, it gave me a mental block." - Mister Ed

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

                                @redrum Alright you want some feedback, here it finally is (hadn't tested the AI in almost a year I bet lool)!!!

                                so I battled the AI on the WWIIClassic map as always and I battled the 1.9.0.0.13066 stable release 1 time and got rocked by the Allies AI even though I thought I was in it for the first 12 rounds but then got overwhelmed by American troops and gave up after my German capitol fell and Japan had no chance so I gave up maybe round 18

                                THEN, LaFayette pointed out the latest AI update releases to test so duh I downloaded the 2.0.17997 release and played against the Allies AI over the last 2 nights and beat it in 48 rounds BUT there was 4 errors that a pop-up window asked me to report to Triple A so I did and there may be problems since I was totally floored that at the start of the game THE RUSSIAN AI DID NOTHING!!!

                                ... redrum, if you read the game log, at the Russia AI's first turn it says some weird message about triggers and then the Russia AI only did moves and placing its purchases but it didn't attack anything!

                                I see the "error" reporting feature gives you 5 free reports and in the describe error part I said what round the error occurred in 3 of the 4 error reports ... one error happened when it was the AI's turn right after I did a kamikaze attack maybe first time ever by my Japan plane around round 12 but the other errors were all when the AI had its turn like around round 25, round 30, and round 35 MAYBE ... the error reports were uploaded so you have to look there I guess

                                Oh, with the UI, when you are doing combat moves ... if you want to say move a Tank and then you change your mind and want to click "Undo Move" well that whole area used to be big but its now blocked by those fast buttons below and I tried the only 3 resolutions on my comp that I can and the Combat area is always so small I can barely scroll to the "Undo Move" button and its much slower than when it was a whole big nice area to click on so my question is can I click off those fast button things below the Combat window so I can see the Combat window better since I don't even use those Fast buttons things I've never seen before

                                Ok, here's the win vs 2.0.17997 Allies AI release but I think the version is glitched and will wait for redrum's assessment before I battle the 2.0.17997 Axis AI.

                                Despite the nothing move for the Russia AI to start the game it was tough to beat and I hadto buy Japan Bombers all game long to keep the Allies AI Navy from getting too big;

                                latestAlliesAIdefeated33.tsvg

                                Oh by the way, the game still played no problem after each error window popped up 4 times (thats not including the Russian AI lack of move 1st turn)

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

                                  @Captain-Crunch Wow, 48 rounds!

                                  Hmm that is pretty strange for Russia turn 1. They should almost always attack something at least the German navy and usually Ukraine. I ran 5 quick test games of just russia turn 1 and every time the Hard AI attacked those 2 and sometimes Manchuria. Here is an example: Russia1.tsvg

                                  Its possible there was some kind of error or that the AI hit some kind of weird edge case or something. Can you try just starting a new game against the Allies AI again to make sure it isn't happening every time for you?

                                  Thanks for reporting the errors and you can see your reports here (this is a new reporting feature): https://github.com/triplea-game/triplea/issues. A few of them we are aware of and need to fix before putting out a new stable release but we'll take a look at them all. I think most of them are harmless errors and shouldn't impact the game or the AI play.

                                  Thanks for the UI feedback as well and I'll highlight that over in the unit scroller thread. Its a new feature that allows you to scroller through all your unmoved units (can be helpful especially on very large maps).

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

                                  ubernautU Captain CrunchC 2 Replies Last reply Reply Quote 1
                                  • ubernautU Offline
                                    ubernaut Moderators @redrum
                                    last edited by

                                    @redrum so should i try global or a simpler map?

                                    "You should never have told me horses sleep standing up, it gave me a mental block." - Mister Ed

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

                                      @ubernaut Global is generally fine though the AI's diplomacy on the map is fairly limited and has a decent amount of randomness. It also doesn't understand NOs. Other than those 2 limitations it should play fairly well.

                                      So if you turn off NOs and do war declarations for it then you'll probably have an even better game.

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

                                      ubernautU 2 Replies Last reply Reply Quote 2
                                      • ubernautU Offline
                                        ubernaut Moderators @redrum
                                        last edited by

                                        @redrum tried it once with ai as axis already and didnt attack france.

                                        "You should never have told me horses sleep standing up, it gave me a mental block." - Mister Ed

                                        1 Reply Last reply Reply Quote 0
                                        • ubernautU Offline
                                          ubernaut Moderators @redrum
                                          last edited by

                                          @redrum another i've noticed in past ai at least on this map is that the ai doesn't seem to understand the effects of ports very well.

                                          "You should never have told me horses sleep standing up, it gave me a mental block." - Mister Ed

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

                                            @ubernaut It didn't attack France at all? That would seem pretty strange. Does that happen frequently?

                                            Yeah, I believe the AI will use the airfield and port move bonus but I don't think it actively tries to end in a sea zone with a port (I believe it does actively try to land where there are airfields).

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

                                            ubernautU 1 Reply Last reply Reply Quote 0

                                            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
                                            • 10
                                            • 11
                                            • 12
                                            • 13
                                            • 14
                                            • 15
                                            • 16
                                            • 12 / 16
                                            • First post
                                              Last post
                                            Copyright © 2016-2018 TripleA-Devs | Powered by NodeBB Forums