-
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:
- Find resource that I have the most of (A).
- 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.
- 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 .65So 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.
-
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 -
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 -
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.
-
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!
-
already 1 loss to the Allies AI ... so this may take a while hehe
-
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.
-
@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
-
@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
-
@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
-
@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.

-
@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.
-
@redrum i mainly stick to the stable releases these days is there a mac build or do i have to do it myself?
-
@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
-
@redrum i'll check it out can it play global or should i try a simpler map?
-
@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;
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)
-
@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).
-
@redrum so should i try global or a simpler map?
-
@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.
-
@redrum tried it once with ai as axis already and didnt attack france.
-
@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.
-
@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).
-
@redrum well in the past at least it wasn't aware of my range and i only saw it not attack france once wiht the prerelease but i will try it again.

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