AI Development Discussion

classic Classic list List threaded Threaded
1250 messages Options
1 ... 28293031323334 ... 63
Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

Frostion
Thanks for the answers Redrum and Veqryn
A Qestion:
Is a unit with “isArtillery” and a unit that gives +1 attack power equally valued by the Hard AI? For example when the AI shops its units, does it think the same of these units?

I am trying to determine if I will use isArtillery or use support attachment for my artillery units.
Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

redrum
Administrator
@Frostion - Short answer is that they are treated 100% the same and I recommend NOT using "isArtillery".

The "isArtillery" tag is actually translated into a +1 attack support attachment with the name "ArtyOld" by the engine. The AI and battle calculator have been updated to only reference support attachments and not use isArtillery anymore so they are treated exactly the same.

My recommendation is to NOT use "isArtillery" and just use support attachments so that your XML is more consistent and its easier to understand the various support rules. It would eventually be nice to completely remove the "isArtillery" tag but that would take a great deal of effort since so many maps currently utilize it and all of them would need to be updated.

I believe this is Veqryn's view as well but I'll let him chime in if he feels differently. It would be interesting to try to start deprecating certain XML tags that have been replaced with better options so that new maps and updated maps have more guidance on the best practices.
Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

Frostion
@redrum
I was thinking/leaning towards the same thoughts.

But what about the <option name="artillerySupportable" value="true"/>
I guess it is useless without isArtillery?
I have "artillerySupportable" attached to all my infantry that are meant to be supported. I believe the attachment gives the unit info “can be supported by other units”.
Without “artillerySupportable” there is no such info.
I like the info, but still it is given by an attachment that is being phased out.

Will this be part of future development?
What about a customizable <option name="UnitInfo" value="Here the mapmaker can write something"/>
Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

redrum
Administrator
@Frostion - I believe the 'artillerySupportable' tag is only used when 'isArtillery' is used. The engine translates the units marked with 'artillerySupportable' into the unit types list for the support attachment it generates. So if you aren't using 'isArtillery' then you shouldn't mark any units with 'artillerySupportable' though it shouldn't cause any errors.

Interesting point about unit info (tool tips). I glanced at the code and it appears that you are correct and only if units have the 'artillerySupportable' property set to true do they get any unit info added indicating that they can receive support. Here is the code snippet:
if (getArtillerySupportable())
   stats.append("can Receive Attack Bonus From Other Units, ");

I think that there should probably be some tool tip logic added to add something if a unit can receive support from a support attachment just like the artillerySupportable one. The customizable option is an interesting idea and makes things flexible but you wouldn't want to duplicate info. I'll let Veqryn comment on it and see what he thinks.
Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

Frostion
In reply to this post by Frostion
@redrum
I have just implemented dragon units on my ”Dragon War” map. They are given to a specific AI player (Named "AI") in specific turns, and then the AI player places them on the map during the Place Units phase. The Hard AI handles this well, but the Medium AI cannot place them.

Hard AI can also moves the dragons around. The Medium does not/cannot do this.

But after 1 or 2 rounds, when the AI finally decides use a dragon in combat (I think), aka in the start of that AI's Combat Move phase, this java error pops up and the map stops working:
XML wrote
triplea.engine.version.bin:1.8.0.5
Exception in thread "Triplea start thread" java.lang.ArithmeticException: / by zero
        at games.strategy.triplea.ai.proAI.util.ProAttackOptionsUtils$3.compare(ProAttackOptionsUtils.java:230)
        at games.strategy.triplea.ai.proAI.util.ProAttackOptionsUtils$3.compare(ProAttackOptionsUtils.java:152)
        at java.util.TimSort.countRunAndMakeAscending(Unknown Source)
        at java.util.TimSort.sort(Unknown Source)
        at java.util.Arrays.sort(Unknown Source)
        at java.util.List.sort(Unknown Source)
        at java.util.Collections.sort(Unknown Source)
        at games.strategy.triplea.ai.proAI.util.ProAttackOptionsUtils.sortUnitNeededOptionsThenAttack(ProAttackOptionsUtils.java:151)
        at games.strategy.triplea.ai.proAI.ProCombatMoveAI.tryToAttackTerritories(ProCombatMoveAI.java:908)
        at games.strategy.triplea.ai.proAI.ProCombatMoveAI.determineTerritoriesToAttack(ProCombatMoveAI.java:398)
        at games.strategy.triplea.ai.proAI.ProCombatMoveAI.doCombatMove(ProCombatMoveAI.java:142)
        at games.strategy.triplea.ai.proAI.ProAI.move(ProAI.java:179)
        at games.strategy.triplea.ai.AbstractAI.start(AbstractAI.java:469)
        at games.strategy.engine.framework.ServerGame.waitForPlayerToFinishStep(ServerGame.java:665)
        at games.strategy.engine.framework.ServerGame.runStep(ServerGame.java:541)
        at games.strategy.engine.framework.ServerGame.startGame(ServerGame.java:333)
        at games.strategy.engine.framework.startup.launcher.LocalLauncher.launchInNewThread(LocalLauncher.java:100)
        at games.strategy.engine.framework.startup.launcher.AbstractLauncher$1.run(AbstractLauncher.java:57)
        at java.lang.Thread.run(Unknown Source)
I can see that there is a “by zero” in the text, but all the units are in the <production> and they have a price, as far as I can see. What could be wrong?
Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

redrum
Administrator
@Frostion - I'm 99% sure that its the same issue as before. You must still have at least one unit that doesn't have a > 0 production rule. You can view the unit cost by hoving over units in the battle calculator window to make sure all the dragons have a cost. If you post your XML I can take a look.
Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

Frostion
Ok. Thx for the assistance Redrum.
I have simplified the xml by graying out all dragons except “Young-Red-Dragon” and “Red-Dragon”. The map works, but with the exact same error as before, and at the same time.

• The idea is that the “Young-Red-Dragon” unit is given to the purchase list of player named “AI”.
• “AI” places the dragon on the map. (“Young-Red-Dragon” is structure and construction)
• The “AI” uses the young dragon in a battle at some point and looses it to a player.
• “Young-Red-Dragon” whenCapturedChangesInto “Red-Dragon” now belonging to the victorious player.

The concept works as far as just before the “AI” player thinks about going to battle with it's young dragon.

Dragon_War.xml
Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

redrum
Administrator
@Frostion - Both production rules for Young-Red-Dragon and Red-Dragon reference Red-Dragon which leaves no purchase cost for Young-Red-Dragon that causes the divide by 0 error. Here are the rules:

<productionRule name="buyRed-Dragon">
<cost resource="PUs" quantity="90"/>
<result resourceOrUnit="Red-Dragon" quantity="1"/>
</productionRule>

<productionRule name="buyYoung-Red-Dragon">
<cost resource="PUs" quantity="85"/>
<result resourceOrUnit="Red-Dragon" quantity="1"/>
</productionRule>

Just change it to the following and it should work:

<productionRule name="buyRed-Dragon">
<cost resource="PUs" quantity="90"/>
<result resourceOrUnit="Red-Dragon" quantity="1"/>
</productionRule>

<productionRule name="buyYoung-Red-Dragon">
<cost resource="PUs" quantity="85"/>
<result resourceOrUnit="Young-Red-Dragon" quantity="1"/>
</productionRule>
Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

Frostion
Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

redrum
Administrator
@all - I just committed the latest changes and updated the pre-release. Change list:
- Added logic to consider exposed units in combat move
- Enhanced combat move neutral territory attack consideration to avoid the AI attacking too many neutral territories and have it select the best ones
- Fixed canal consideration to avoid a possible NPE
- Fixed AI logging to actually properly organize each nations turn in a tab
- Added a check if units don't have a production rule defined to log a warning rather than have an exception occur
- Fixed blitzable territory consideration to take into account territory effects that block blitzing
Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

Black Elk
This post was updated on .
Downloaded the new jar and gave it another whirl with World War II v5. So far so good!

Here's an amusing save
HardAI_World_War_II_v5_KGF_Russian_Red_Turtle_round_16_USA.tsvg

This was the best I've seen Axis do yet under hard AI control. I thought I'd try a standard grinder game, total Europe focus KGF. Not exactly what I'd call optimal strategy from the Allies in v5, but it seemed the best bet for the AI. With some reckless bombing runs, and other sub par Allied plays, to see how it would handle the Center stack by Allies.

Basically KGF Red Turtle style Russian defense, with zero pacific commitment by USA, and just a race to hold the center to see how the Hard AI performs. It did fairly well under these conditions, when the Pacific side of the map is more or less ignored by the Americans. This was a popular technique in Classic and Revised, to put the rush on Berlin, and it was nice to see the AI handle it fairly well. Solves the problem of Allies not just wiping out out the IGN due to superior US carrier tactics (since under human control they clearly wreck too hard lol.)

The Red Turle, which is probably Russia's most bland and minimalist approach, kept the Allies holding the center until Round 15, When USA finally cracked Berlin.

Examples of when the Axis Hard AI goofed it...

Would be like in round 6 Germany, when it doubled back on Karelia and pushed into Persia, giving up a strong position on Caucasus/Moscow, or the chance to stack W. Russia and threaten to take Moscow. Or in the following round when they launched off Caucasus to take India, instead of staying put and waiting for the Japanese to consolidate in Kazakh. Another minor error might be round 10, when Japan landed bombers without fodder cover in range of Moscow based US fighter attacks.

On the whole the most glaring issue from the Japan side of the AI was getting trapped in a loop down in sz 19 off Panama. Sz 19, where the Japanese Navy goes to get all shitfaced in Acapulco, and forget there's a war going on haha.

Early on Japan started position toward W. US and Midway, launching on Alaska, Hawaii etc. this had a certain novelty, since I had decided to play a stubbornly KGF game. But Hard AI made the same mistake as many a newb, by getting distracted with North America instead of putting the rush on the Russians. By round 15 of the slog, the IJN had amassed an impressive array of 7 battleships! The had some alright hits on Alaska, but sadly the battleships then traveled for the trap in sz19, where they remained for most of the game with a bunch of destroyers patrolling the coast.

Had the IJN at some point simply swung around the bottom of the board, crept to Brazil, or captured Panama, they could surely have blown the Atlantic wide open, but it was not to be. Instead they seemed focused on the Alaska drop, countered by the W. US ground push along the old familiar Canadian route, or just straight push out of W. US to Central US for drop on Africa.

Fun AI though!
This guy has some chops!

So yeah, that was my most amusing game so far facing down the HardAI on a standard grind, the old one dimensional KGF strat. Just trying to apply Classic principles to 42.2 (even though they don't work as well now haha) and no bid for Allies obviously.


For a fun Axis bid on the KGF slog, might be fun to give Japan a factory in Philippines and see how that affects the gameplay. But yeah all in all I dig it
Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

Black Elk
Here's another cool one HardAI as Axis v5

This time using the same idea as above, but going the opposite direction. No US involvement in the Atlantic, just full Pacific press.

HardAI_Axis_vs_Human_World_War_II_v5_KJF_round_15_Super_USA.tsvg

Despite doing fairly well at the outset, and achieving the dream of Reich that stretched from Paris to Vladivostok, the Germans were unable to leverage their strong position post Moscow collapse into ultimate victory during the deep endgame. Their Kriegsamarine was massive, but seemed content to close off the med by Gibraltar and then just relaxing off the coast of West Indies.

Rather than pursue the British baltic fleet in sz5, the Germans instead focused on fighting the USA overland across Asia and Africa.

Russia went for the full smash against Japan wild sacrifice play. Hard AI was able to trade Moscow in the 6th round, but lost the rich Japanese islands in the south Pacific and Tokyo shortly thereafter. USA Production and Income eventually outclassing anything the Germans could put up. By the 15th round, again more or less a foregone conclusion. But Super G did pretty well.

It was pleasing to see them get into the naval race, albiet rather late and not to terrible effect. Still they had a pretty massive fleet, that could have easily crushed had they pursued the enemy into home waters.

Most of the endgame loops seem to occur around Panama, or with navies not transiting between the Atlantic and Pacific, launching late game amphibious and putting all their battleships into the action. Instead they get stuck in a bermuda triangle, and languish. Overland though, and with some nice Air on Naval hits, Hard Ai stood up pretty well, to the wild Russian sacrifice KJF plan. Stalin is probably lost somewhere in the jungles of Malaya going mad, Colonel Kurtz style! haha



Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

Black Elk
This post was updated on .
Finally something more split theater from Allies, standard squeeze with UK focusing carrier. Here Japan does a somewhat better job of sprawling with their Navy. G pushes hard towards the center, which was fun, but buckled after a failed attempt on Caucasus, with army group south retreating into turtle up mode around Eastern Europe and Berlin. Went 16 rounds before UK cinched it out of Baltic states.

Here again, Japan was a bit too preoccupied with North America and could probably have turned the tide earlier but expended a lot of energy into murderous Canadian campaigns. Alas the Emperor just couldn't get there in time this game hehe. Germany was pretty effective at stacking their capital and controlling Europe. Some Japanese bombers got smoked again on fodderless defense, but then the Allies forgot to move their units in the Southern Hemisphere for half the game, so you figure its a wash lol.

Again Hard AI stood up pretty well, taking the slog well into latter rounds before cracking. Fun stuff all around. I can see major potential and entertainment value out of this one. Great work again

HardAI_Axis_vs_Human_World_War_II_v5_Split_Theater_round_16.tsvg

and another one showing the Panama problem for Japan.

HardAI_Axis_vs_Human_World_War_II_v5_round_15.tsvg
Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

redrum
Administrator
@all - Just committed the latest changes and updated the pre-release:
- Added isFFA consideration for combat move phase to decrease value of TUV swing and increase value of holding territories
- Fixed place before move phases bug (reported by Frostion on Dragon War)
- Fixed transport max build per player (reported by RogerCooper on AAC-Build Caps)

@Black Elk - Excellent reports. Glad you are enjoying the new AI. It seems like the newest AI pre-release is playing pretty well on WW2v5 at least for beginner players. I'll look through your saves more closely to see what I can do to improve it.

I'm hoping to get more feedback and save games like that as it really does help identify the AI's mistakes and weak points since I only have so much time to test it myself.
Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

Black Elk
This post was updated on .
Cool sounds good! Just downloaded the updated jar and checked again in v5 to see how Japan performed under AI control.

Fun stuff!

 Here is another save that shows the fodderless bomber issue, where Japan parks them dangerously close to Moscow, vulnerable to attack. Here they got a 5 stack of bombers waiting to get smoked by any number of Allied attacks.

HardAI_Axis_vs_Human_World_War_II_v5_KJF_Japan_bomber_mistake_round_4.tsvg

Also in this situation, where USA is just pressing against Japan across the North Pacific, it would be helpful for the AI to have a factory in East Indies. Hard AI seems to struggle because they can't drop one safely in Manchuria, when Allies go all ballsy frontal attack mode and their transports get clipped.

Here is the same game the following round, on UK combat to show how they let the spitfires nuke the bombers and hose Japan's TUV...

HardAI_Axis_vs_Human_World_War_II_v5_KJF_Japan_bomber_mistake_round_4_UK_attack.tsvg

And then the USA follow up. Notice that had the Japanese bombers not been parked it a vulnerable position (in range of Enemy air, with insufficient fodder) then USA would not have been able to position off Soviet Far East. Germany also might have helped cover the loss, had they flown in fighter support to cover Japan's bombers. Instead UK sweeps the bombers on the ground, and then USA nukes the Japanese Manchuria factory that HardAI just bought for themselves. Sort of the Classic dilema, of purchasing Axis production on the mainland, when the mainland is about to get swept! HardAI Japan would have been better off building factory in East Indies, trying to holdoff the US advance on the water.

Manchuria factory loss
HardAI_Axis_vs_Human_World_War_II_v5_KJF_Japan_bomber_mistake_round_4_USA_takes_Manchuria_factory_attack.tsvg

Which leads to Allied honorable victory by round 10
HardAI_Axis_vs_Human_World_War_II_v5_KJF_Japan_bomber_mistake_round_10.tsvg

HardAI's got spirit though, putting up a fight to last, no matter what! Germany still plays with teeth, even when the war is lost in the Pacific. I dig it

ps. one more with a different approach to the Russians, center wedge.
HardAI_Axis_vs_Human_World_War_II_v5_Center_Hold_round_15.tsvg



Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

captaincrunch
I played the ai.jar update before this and won the 2nd of 2 matches and it was so funny that the AI when playing Japan DOES NOT attack Hawaii on 1st turn now lol. Both matches it didn't and I just have never seen that with a player or the ai not attacking Hawaii on 1st turn. Still, overall I'm sure the AI has a solid logic and I only mentioned it not attacking Hawaii on 1st turn on the WWIIClassic map because it was a noticeable change. I only posted to say I love testing the updates but only when I have the time or feel like some intense battling so I may dissappear for some time but eventually I try to submit 2 matches against the AI where I am either the Allies or the Axis. I assume I can always beat it but you never know hehe. I keep watching for updates though.

Will get back to yas when I can!
Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

redrum
Administrator
@all - Just committed the latest changes and updated the pre-release:
- Finished remaining combat move changes to value exposed units
- Changes to better value neutral territories
- Enhanced logic to block enemy blitz opportunities
- Enhanced capital defense logic

Next up is improving air unit landing in safe territories. If you have any recent save games where planes were left in vulnerable locations please post them.
Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

Eschelon
@redrum

I'm noticing that the AI is spending a fair amount of time thinking about the build phase if a player has been eliminated, or has no territories or factories.  BTW, I eliminated the 'sea capitals' on my map in my most recent playtest version, so once the last land territory is captured, the AI player has no 'hidden' territories to confuse the issue.

This is a common issue amongst the AI's in general, but it might not be a bad idea if some 'do I have territories I can build in' check for the AI was implemented.

Sure, I could just assign a do nothing AI to these players when this happens, but players in general may not think to do that, hence slowing down their human vs AI games a bit in these instances.


Also, in my latest game, I'm noticing in my playtesting that the HardAI is still stockpiling a good number of PU's (it's been doing this for a while actually) in some instances, which it doesn't spend when it is on the defensive.  I don't have the very latest .jar, so I don't know if this has been addressed in your latest changes.  This has been an ongoing problem - AI's getting eliminated while they still have 100 or more PUs to spend, which could have went to more expensive units or something as a 'last gasp defensive unit spree' thing, and perhaps shifted the balance a bit.
Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

Black Elk
Just ready to gloriously Liberate India after a clean Japanese Hard AI push against it! But then my game locked up on me. Had to put the war against the machine on pause hehe.

Anyone have any ideas as to why this save would crash me to reboot?
I don't catch a java error or anything but for some reason it blacks out in the middle of Germany's turn. Not sure why, but it happens every time I load it. Same thing happened the other day to me as well, when facing down Japan.

autosave.tsvg

I recall once being able to catch an error message that said something about too many map files and then citing the v5 in use: me/triplea and then one in programfiles (x86)/tripleA. But in order to see that I had to reload the autosave. And wait for Germany HardAI to finish making his move.

triplea.engine.version.bin:1.8.0.5
INFO: Found too many files for: World War II v5 1942  found: [C:\Users\Jason\triplea\maps\World War II v5 1942.zip, C:\Program Files (x86)\TripleA\triplea_1_8_0_5\maps\World War II v5 1942.zip]
INFO: Found too many files for: World War II v5 1942  found: [C:\Users\Jason\triplea\maps\World War II v5 1942.zip, C:\Program Files (x86)\TripleA\triplea_1_8_0_5\maps\World War II v5 1942.zip]
Exception in thread "Triplea start thread" java.lang.NullPointerException
        at games.strategy.triplea.ai.proAI.ProPurchaseAI.place(ProPurchaseAI.java:823)
        at games.strategy.triplea.ai.proAI.ProAI.place(ProAI.java:289)
        at games.strategy.triplea.ai.AbstractAI.start(AbstractAI.java:481)
        at games.strategy.engine.framework.ServerGame.waitForPlayerToFinishStep(ServerGame.java:665)
        at games.strategy.engine.framework.ServerGame.runStep(ServerGame.java:541)
        at games.strategy.engine.framework.ServerGame.startGame(ServerGame.java:333)
        at games.strategy.engine.framework.startup.launcher.LocalLauncher.launchInNewThread(LocalLauncher.java:100)
        at games.strategy.engine.framework.startup.launcher.AbstractLauncher$1.run(AbstractLauncher.java:57)
        at java.lang.Thread.run(Unknown Source)


I'm guessing it is something to do with my set up? but couldn't figure out what. I was playing with the jar from yesterday. Will check out the new one see if I can get it to play out without the hang up.

I enjoy facing down this AI, its entertaining haha. Thanks for working on this stuff!
Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

redrum
Administrator
In reply to this post by Eschelon
@Eschelon - Interesting. You could also argue that the engine shouldn't even call the AI if the AI can't actually do anything. Either way I can definitely look to reduce purchase time for AIs that no longer can purchase/place anything. If you have a save game showing it then please upload so I can test with it.

It has methods to try to spend as many PUs as possible though there could be some edge cases that I haven't considered. If you have a save game showing it please upload and I'll take a look.

@Black Elk - I believe I just fixed that bug in the pre-release I uploaded today. Please try the latest and see if you still have the issue.
1 ... 28293031323334 ... 63