AI Development Discussion

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

Re: AI Development Discussion

Black Elk
This post was updated on .
Hmmm so far not seeing much in the way of the Axis crush I'd hoped for hehe. Rather than take the light hit at pearl and the safe factory in East Indies to focus on taking India, Japan still seems keen to buy their production in Manchuria and focus north.

HardAI_v5_Axis_opener_Med_Carrier_round_9.tsvg

For a minute there in the game where G went carrier, it seemed like Axis might try to squeeze the middle and sweep Africa, but Japan again went more northern focus, and G failed to keep its fleet grouped together to guard the transport. I expected them to probably fly the fighters off the carrier deck, but for some reason it also likes to separate off the med battleship rather than keeping Regia Marina all together, leaving themselves exposed to USA bomber strikes.) Tank buys again did pretty well at keeping the center wedge from collapsing early, but I think its mainly because Japan is throwing a lot of their money and TUV towards North America instead of putting it all against India. It wants to buy naval out of the East Indies factory instead of ground to suck into Burma.

Now I'm wondering how the HardAI would do, if edit a factory onto each VC territory from the outset? I used to play AA50 that way it was fun.

Here is a sample game for v5 using this concept. Under this mod, each VC has a factory to begin with, meaning HardAI Germany gets a factory in Paris, and HardAI Japan has a factory in Shanghai and Manila. USA gets one at Pearl as well. I wonder how AI will use the factories? If it works, this might serve as a kind of bid. Call it the all Victory Cities get a starting factory idea ;)

HardAI_Axis_VC_Factory_Idea.tsvg

Axis will have a slightly stranger position, because Japan will have a starting factory on the mainland under such a scheme. Maybe HardAI will determine they have enough production, and will just use what they start with against India/Russia, rather than spending the 15 to buy another one in Manchuria. Will have to test and see.


ps. Follow up...
HardAI_Axis_VC_Factory_Idea_round_18.tsvg

The game with the extra starting factories was interesting. Again with no SBR, just to see what Axis would do with their factories. The additional production didn't seem to help them much at the center, but they did fight a little slightly better into the endgame. Germany held off D-day invasions for the duration, and fought well into the 18th round. The factory in France discouraged them from allowing the territory to be traded with light forces (something I always assumed would happen with players too, if an A&A board ever took that approach.) Rather than letting UK or USA storm the beaches they stacked to defend it from the first round and never pulled out, until it was clear the Berlin would not survive without all available units at the capital. It took a while haha.

Japan was predictably smoked. Having the extra factory in Shanghai did encourage them to push a bit harder at the center, but still not enough to make a difference. Germany stacked up to 100 units for the final defense of Fortress Europa, but fell to Russia on the triple hit in the 18th, after a lot of stacking and counter stacking.

I was curious to see if the AI might use the France factory for Med coverage, but not really the case. USA was able to push Across the med, and spin around Africa to clip Japan from the opposite direction. At a few points the Philippines factory seemed to coax some of the Japanese ships out of their hiding place in sz19, but they just don't seem to recognize the priority of the oil and rubber rich islands to their ultimate war aims hehe. I think most human players would defend those islands with everything available, but here USA was able to slip in from the rear with little opposition.


edit.

OK I think I have a pretty good feel for what HardAI Axis is going to do in v5, and the sorts of things that could improve its gameplay. Now my next plan is to start playing against HardAI Allies.

Going to start by giving the computer a standard bid of 12.

First game will be all 12 ipcs to UK for a pair of subs, which I'm hoping the HardAI will use to destroy the Japanese fleet in sz37. Fairly standard.
Elk_vs_Hard_AI_Allies_bid_12_UK_double_subs_for_sz37_hit.tsvg

Next game will be a split bid game with 4 ipcs to UK for an extra artillery unit in Egypt, and 8 to Russia for an artillery in Karelia and Caucasus. Also fairly standard.
Elk_vs_Hard_AI_Allies_bid_4_UK_8_Russia_for_Artillery.tsvg

I'll edit the results in here when I get them, so as not to spam the thread too hard :)

Ok already seeing a major goof by the Russians in their opening move.

For whatever strange reason Russia using the starting Karelia fighter to attack Ukraine, and its starting Moscow fighter to attack Baltic States (3 moves!). This means that the fighter it uses to attack Baltic states mist land in Karelia where it is certain to die on G1. Why HardAI does this is a mystery to me, because they could run the exact same attacks without sacrificing a fighter if it just used the Moscow fighter to attack Ukraine, and the Karelia fighter to attack Baltic states. Then both fighters would be able to land out of harms way.

Instead Russian hard AI lands it's Moscow fighter in Karelia to die, when if it just reversed the fighters they could both land in Caucasus. Here is the save showing the goof

Elk_vs_Hard_AI_Allies_Russian_fighter_mistake.tsvg

Both Russian fighters must survive the first round, or it's basically impossible for Allies to prevail in v5. Otherwise Germany can do something like this, and totally screw them haha. Also notice how Axis HardAI does not use their bid to destroy the Japanese fleet in sz37, so that bid doesn't do Allies much good.

Elk_vs_Hard_AI_Allies_UK_fails_to_attack_sz37_with_subs.tsvg

Now I'm going to try the all artillery bid, in the hopes that Allied AI doesn't behave as foolishly. Perhaps the extra artillery in Karelia will persuade them not to kill off their fighter to no purpose in the first round hehe






Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

redrum
Administrator
This post was updated on .
@panguitch - The error you are getting is due to this event:

                        <attatchment name="triggerAttachmentKet_Event_4" attatchTo="Ket" javaClass="games.strategy.triplea.attatchments.TriggerAttachment" type="player">
                                <option name="conditions" value="conditionAttatchmentKet_Has_Mercenaries:conditionAttatchmentbinary_switch_1_true:conditionAttatchmentbinary_switch_2_true:conditionAttatchmentbinary_switch_3_false:conditionAttatchmentbinary_switch_4_true"/>
                                <option name="conditionType" value="AND"/>
                                <option name="when" value="before:KetCombatMove"/>
                                <option name="removeUnits" value="all:bullywug:ogre:bugbear:gnoll:skirmisher:gnome:sellsword:hedge_knight:berserker" count="1"/>
                                <option name="notification" value="DesertionEvent"/>
                        </attatchment>

It is removing units that they AI think still exist as it plans its combat move in the purchase phase if purchase is before combat move. When it tries to move them and can't find them it errors out. I would suggest having all events fire before purchase rather than before combat move (looks like most of yours do) or move the combat move phase to before purchase.

Also it appears you do have events that give 6 movement still as you were describing you saw:

                        <attatchment name="triggerAttachmentKet_Event_15d" attatchTo="Ket" javaClass="games.strategy.triplea.attatchments.TriggerAttachment" type="player">
                                <option name="conditions" value="conditionAttatchmentbinary_switch_1_false:conditionAttatchmentbinary_switch_2_false:conditionAttatchmentbinary_switch_3_false:conditionAttatchmentbinary_switch_4_true"/>
                                <option name="conditionType" value="AND"/>
                                <option name="when" value="after:KetCombatMove"/>
                                <option name="unitType" value="Iuz_the_Old:Belvor_IV:Ivid_V:Archbold_III:The_Father_of_Obedience:Skotti:Beygraf_Zoltan:Cobb_Darg:Turrosh_Mak:Ingemar"/>
                                <option name="unitProperty" value="movement" count="6"/>
                        </attatchment>

Hope that clarifies both your issues.

PS - One more thing I noticed is that some of the territories don't get captured when battles are won. An example is 'Vast Swamp'. This is causing lots of issues for the AI as well. Not sure if that's intended and if so what you are trying to simulate.
Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

Black Elk
This post was updated on .
OK after a few hours of experimentation against HardAI Allies, I think some form the Allied Artillery bid for Russia might hold up alright.

To start I have given Russia 2 extra artillery pieces, 1 in Karelia and 1 in Caucasus. The British get an extra piece in Egypt. A reasonably standard bid for v5 at 12 ipcs total for Allies.

Elk_vs_Hard_AI_Allies_artillery_bid_is_better.tsvg

Russian HardAI makes an opening which begins to approach something that a Human might do at 8 ipcs for 2 artillery pieces. They don't commit as much to W. Russia as most players would, but at least they land their fighters safely in Caucasus.

This Artillery bid gives a much more standard attack into Ukraine, with the Russians risking only 2 tanks instead of 3, but bringing both fighters. Of course HardAI will not strafe, the way a human might, so 2 tanks is optimal, whereas 3 is just throwing your offensive forces away. The hit on Baltic might not be advisable, but at least all the battles are reasonable. This seems a better series of attacks than what it does with OOB unit set up.

Here is another Allied bid opening that seems to work pretty well., The same total amount 12 ipcs, but this time with everything going to Russia for 1 inf in Karelia, 1 inf in Caucasus, and 1 tank in Archangel.

Elk_vs_Hard_AI_Allies_Russia_bids_2_inf_1_tank.tsvg

HardAI Allies is more challenging if you give the Soviets some teeth. The standard bid against HardAI is an interesting question hehe, but Russia alone probably deserves somewhere between 12 and 18, just to have a prayer against Germany. This might be said of humans on the board too, so at least against the AI I should go higher.

Getting the HardAI to play v5 well is my goal, since its the flagship I think. Global and the 1940 games are way too rules intensive. The super simple v6 starter board just isn't very interesting (too much fighter camping and suffers from lack of artillery.) v5 or 1942 Second Edition is the go to I think. A simple 5 man, where the HardAI can shine and build off its expertise with Classic/Revised but taken to the new way of playing with the new unit values and the newer map divisions. Its cool to see that the same basic principles work for some of the other tripleA games as well. I think v5 is fun though.

Here is how the Russian HardAI opened when I gave them a bid of 18 ipcs, for 3 tanks. With a big press into Ukraine
Elk_vs_Hard_AI_Allies_Russia_bids_3_tanks.tsvg

Curiously, with a bid of 16 for an extra 4 artillery pieces (1 in each territory along the Eastern Front), the Russians open like this, which seems like it might be stronger overall than the 3 tank bid, even though it costs less in TUV. Here Russian HardAI takes a crack into Belo!
Elk_vs_Hard_AI_Allies_Russia_bids_4_artillery.tsvg

I think this last might provide some interest too. Giving them a 3rd fighter and 2 artillery pieces for 18 ipcs. They like to hit Ukraine with 3 fighters, and take a crack on Baltic. The like to land that extra fighter in India for some reason, but I kind of like it.

Elk_vs_Hard_AI_Allies_Russia_bids_1_fighter_2_artillery.tsvg

Russian HardAI seems a bit reluctant to stack W. Russia, but they certainly make stronger openings if you give them a bid for those extra artillery units. Otherwise Germany will surely just steamroll non-stop. I'm going to start at 18, just to see how Russia stacks up.

Left to its own decisions, HardAI will spend a bid of 18 for 3 inf, 2 artillery, and 1 ipc remaining. Then they do this, which is pretty solid...
Elk_vs_Hard_AI_Allies_Russia_bids_18.tsvg

Probably there is a number in bid IPCs for each Allied nation that will get them up and running for now, at least unit the transport thing is worked out. 18 for the Ruskies feels pretty entertaining. I think I'm going to stick with that for testing the center stack.

ps. OK I ran the Russian opening HardAI at 18 ipc bid a couple dozen times just to see what kind of variation was involved. Every now and again the HardAI soviets will make a reckless use of their Moscow fighter in the attack on Baltic. Most times they will send both fighters to Ukraine. Less often they will send 1 fighter to Ukraine and 1 to W. Russia. More often than not, they land both fighters in Caucasus, but when I see that Moscow fighter fly to Baltic better to just reload and play something more standard. Most of the variation in the Russian opening seems to come from how they use that second fighter.

Here is an example of the major HardAI fighter goof again...
Elk_vs_Hard_AI_Allies_Russia_bid_18_fighter_goof.tsvg

And here is a more normal HardAI play both at 18 ipcs on the bid, the former is disaster for Stalin, but something like this is decent...
Elk_vs_Hard_AI_Allies_Russia_bid_18_normal_fighter_move.tsvg

Finally a move where the Russian HardAI sends the Karelia Yak to London
Hard_AI_Allies_Russia_bid_18_fighter_to_London.tsvg




Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

Black Elk
Very pleased to report that HardAI Russia did quite well at the bid of 18! They fought hard at the outset and maintained steady pressure until Caucasus was cracked in the eleventh round.

Hard_AI_Allies_Russia_bid_18_ipcs_Victory_G12.tsvg

Stalin retained control of both fighters until the last, and made a strong showing on the eastern front and holding the center, while the Western Allies bounced around all over the place. HardAI Allies did a good job of swarming on Africa, and USA and UK traded fairly well in Europe. With a stronger red bear at the Center pushing against them from the outset, Germany was somewhat more challenging to play. Japan had to push steady on Kazakh for like 10 rounds to drive the Soviets out of Caucasus (destroying the US fighters they left behind in the process). By round 11 the JTDTM peaked and the Emperor nabbed Hawaii to clinch the honorable Victory.

18 ipc bid for Russia felt pretty solid. HardAI Allies did there best to hold off the advance, and had G sweating there for a little while, until Japan was able to link up. Fun stuff, I'd recommend it to a friend haha ;)
Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

panguitch
In reply to this post by redrum
redrum wrote
The error you are getting is due to this event: . . .
It is removing units that they AI think still exist as it plans its combat move in the purchase phase if purchase is before combat move. When it tries to move them and can't find them it errors out. I would suggest having all events fire before purchase rather than before combat move (looks like most of yours do) or move the combat move phase to before purchase.
Ah that makes sense and can be fixed. I'll think about whether to move the "when" for that particular trigger, or whether to move the entire purchase phase to later. Thanks for spotting it!

redrum wrote
Also it appears you do have events that give 6 movement still as you were describing you saw...
Thank you! I've looked for the source of this for a long time and couldn't find it. It was so perplexing because it seemed to manifest randomly--which it was since it's this random event that caused it. Obviously, I created this event (a flood which temporarily removes all movement for land units) before reducing all leader movement from 6 to 4, and failed to update the "reset" part of this event. I'm so glad you found this.

redrum wrote
One more thing I noticed is that some of the territories don't get captured when battles are won. An example is 'Vast Swamp'. This is causing lots of issues for the AI as well. Not sure if that's intended and if so what you are trying to simulate.
These are the territories where heroes and leaders can win magical treasure. New mobs spawn every round, giving the hero the chance to try for treasure every round. And yeah, it throws all the AIs off. Usually not to the point that it breaks the game, just causes them to waste some of their attention and resources.


redrum from earlier wrote
I'd suggest testing with the latest pre-release and uploading a save along with warnings/errors and feedback.
Here are two more saved games and error logs.
hardAIerrorR8.txt
hardAIerrorR8.tsvg
hardAIerrorR12.txt
hardAIerrorR12.tsvg

It does look like there are many fewer terrain-related errors, although there do still appear to be some involving mountains, perhaps related to the "unitsNotAllowed" option ("Territory Effects disallow some units into these territories"). Similarly, there are some "not all units can blitz" and "Not all units have enough movement" warnings that still seem related to terrains that allow some units to blitz and prohibit others.

The "no factory" warning still comes up a lot. By watching it closely, I'm fairly sure that it's caused by the AI planning to place units in a territory, then it moves the factory, and then it can't place the planned units in that territory. It then just looks for another factory with room for the additional units. Like the purchase planning isn't taking into account the movement planning. I don't know if it has this problem with all maps that have mobile factories, or if the fact that my factories are hybrid factory/support units is what's throwing it off.

Some of the other warnings may be unavoidable. I suspect (and can confirm in some cases) that they are caused by triggers in the game (much like the "removeUnits" trigger you found)--triggers that spawn new neutrals or change territory ownership between the purchase and movement phases (possibly causing "Can not blitz out of a battle further into enemy territory" or "Cannot advance to battle in non combat" or "Enemy units on path"). I suppose it's not surprising that these cause the AI consternation, and an AI certainly can't be flexible enough for every trigger a mapmaker might imagine up. At least they seem to generate warnings, not crashes. Perhaps many of these would be fixed by moving the purchase phase later.

But if those map-specific trigger-related problems can't really be accommodated by any AI, hopefully at least the info about the mobile factory warnings and the terrain have broad enough applicability that these reports are helpful to you.

In any case, you've certainly helped me with what you've found. Thank you!

Greyhawk Wars
TripleA in the original Dungeons & Dragons world

Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

redrum
Administrator
@Black Elk - Some interesting games. Were you using the pre-release from yesterday or the previous one? Looks like Russia plays fairly well most of the time with a poor decision every now and then. How did the other allies play?

@panguitch - Yeah, in general its a much better practice to put as many triggers as possible before the first phase since both the AI and humans tend to plan most of their moves all at once. Otherwise you'll end up with too much randomness with units disappearing or getting extra moves which is hard to account for.

The uncaptureable territories are causing some of the warnings around blitzing I believe. Its an interesting idea but definitely screws with the AI and don't think there is any way that it will ever be handled well.

The 'no factory' is definitely related to having the hybrid factories. The AI handles the mobile factories on Napoleonic since it properly classifies them as such. It doesn't classify the hybrids as factories which causes all the warnings as it tries to place units where it thought they would be.

When you release the next iteration with the trigger fixes then I'll try to test again to see if any of the warnings are easily fixed.
Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

Black Elk
This post was updated on .
Downloaded the jar from yesterday and played out another game. Returned to Allies vs HardAI Axis, since I'm more familiar with Axis AI, I wanted to see if the latest changes would feel different. Somehow it did! As HardAI seemed to fight even harder!

Though that could be completely in my head haha. Axis were steamrolling well in early rounds, it took a mean 9 rounds to finally force Germany from the North, after heavy KGF investment the entire game. Again Allied armor seemed to do the trick, though it took a while and Germany felt forward against me almost the entire time, taking Africa and committing a lot of force to defending Leningrad. Impala and D-Day in the same round, round 12, with Allies trading India for France.

v5_Hard_AI_Axis_round_12_D-Day.tsvg

Once the Karelia wedge was achieved, and it wasn't easy, the Anglo Americans finally made a dead drop at Normandy. Then I raced away from the German forces massed in Italy, to hide in Holland for a round. Took all the Ruskie fighters in just to make sure. Then USA dropped into France solo.

Robbed the Germans blind taking their purse twice in one round, first with the Russians and then UK. Allies are flush now. USA could have done it, but I wanted to see if HardAI would try to liberate their capital if I gave it to the Soviets. Which they did, and succeeded in reclaiming Berlin, only to have their hopes of resurgence dashed by Churchill, immediately.

Japan did pretty well in their drive on the center. I'm actually starting to get a little nervous, if that Panama Canal issue is ever resolved, just how much scarier Japan will be! They are sure to go even more monster than now, once those ships are let loose. Fun stuff. Axis HardAI plays solid until the 15th round, but no chance after the 16th ;)

v5_Hard_AI_Axis_round_16_Berlin_double_take.tsvg

 V for Victory!

ps. OK Here is another game using the latest jar, this time vs HardAI Allies, again giving Russia a bid like last game the same as I would offer a human. Then I went totally cut throat Tank drive!

No bs with German carriers or the like hehe. Germany bought 8 artillery and 3 infantry in the first round, all business. Then 5 tanks for the next two rounds, for a standard center crush strategy.

The Stalingrad pocket collapsed almost immediately. Japan took India in the second round with the full Burma push, and G took Caucasus in fairly short order thereafter. A three round set up to force center collapse. Basically I was playing the way I would against another human to see how quickly it could be done.

v5_Hard_AI_Allies_Russian_bid_G_takes_Moscow_round_5.tsvg

This is the sort of opener we need to prepare the HardAI Allies to defend against, and the sort of opener Hard AI Axis should try to emulate. Just going straight for the jugular with a potent tank drive. ;)
Until Hard AI Stalin learns to stack W. Russia properly, he will likely get punished this way by human players who know how to rush their armor with G, and push Burma with J.

one more using the same basic Axis strategy...
v5_Hard_AI_Allies_vs_German_Tank_Drive.tsvg

 This time Hard AI Axis did a bit better, owing mainly to their stronger starting position out of W. Russia. Brits still fell for the Burma push and Tank drive to Stalingrad was fairly quick, but here the Soviets stacked up better around Moscow. It didn't fall to German armor until the seventh round this time.

The Burma push is the Allies main problem right now. It's basically what happens when UK fails to destroy the second Japanese starting transport in sz61.

Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

Irinam
Black Elk wrote
 
Until Hard AI Stalin learns to stack W. Russia properly, he will likely get punished this way by human players who know how to rush their armor with G, and push Burma with J.
Now there is the main "problem" the AI will problably have forever:

For the AI every game is its first game.

It will never be able to learn from its mistakes or adapt to special stategies.
All it can do, is work with what redrum has implemented!
And it has never "seen" that map before.
In contrast to you, who has played the V5 map many, many times
and who knows by now the in and outs of the map and where the HardAI has its weaknesses...

So, to have a fair competiton against the HardAI,
you would have to play a map you never played before.

I've done this many times and i got chipped away all too often :-)
I like playing maps for the first time as it is something special
if you just don't know what will be the good opening moves...

EDIT:
As i usually don't like the WWII setting, i've never played the V5 map before.
So i know what to do with my evening :-)
Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

Black Elk
This post was updated on .
Its true, a lot of it comes down to the map design, the ipc/production spread, and how the starting units are distributes across the land and sea. Still, that said, I can imagine the HardAI would be quite good at this map, especially if it had a few pointers.

Like in this situation, again with a full German tank drive...

Here I gave the Allies each 12 ipcs, for 36 total, and let the HardAI distribute it the way it saw fit. There is a bit of variation in how the HardAI will spend its bid. With Russia it likes to go ground, clearly. Sometimes US/UK will go ground, other times ships. This time around, USA and UK spent their bid loot for Cruisers. And Russia got 2 inf and a tank with theirs. Again Moscow held until about round 7 vs the Axis Tank drive, but the Western Allies put more pressure on. Even snapping up some of the rich Pacific islands in the process. UK and the Allies in general do a good job of fanning out and maintaining income parity. The problem for them is more in how to manage an Axis blitz against India/Caucasus.

See here how, the Soviets got caught moving forces to defend India, and stretched to far from Moscow (moving into Kazakh and Persia.) The Persia move especially, prevented an effective Russian turtle up, and USA rather than sending all available air to Moscow to protect it, basically allows Germany to get in on the first wave, rather than forcing Axis to go with a 1-2 punch and take it with Japan.

Hard_AI_Allies_bid_36_ipcs_12_each.tsvg

So basically on any map, I think giving the HardAI a decent bid to start will help resolve some of the balance issues. But there are still some concepts like Capital control, and factory control at the center of the map, that the AI could benefit from. Right now I'm thinking some sort of "Air rescue" move maybe? Where if a teammates capital territory is bordered by territory with a large enemy stack, then the HardAI will send more Air to defend it. This might be good logic for bombers too, if a capital comes under threat, then all bombers in range fly there to provide the maximum defensive pips vs a big attack like from a tank wall. Stuff like that, which might not necessarily be specific to the v5 map, but could apply across all boards, for units with that sort of range.

In that save above, USA had a chance to send an extra fighter and bomber to Moscow, giving them better odds to prevail against the German tanks and maybe hold off the 1-2 punch. UK could have sent in a lot more, with 3 fighters and 5 bombers in range, more than enough to deter an attack in the first place. The Allies dominate the Atlantic and have superior naval TUV. Already USA is landing troops in the North and pushing across Africa, they even took Borneo. If they were to just devote more resources to preventing Moscow collapse, HardAI Allies could probably ride it out for a very long time. Once the center folds though, its fairly straightforward for Axis to redirect all their energy with a quickness.
Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

eurofabio
In reply to this post by Irinam
This is true...for all AI out there!!

For the last 2 decades I have been playing against computer. I played many games were the AI was very good like civilization, starcraft or warcraft. The AI never learned from its mistakes. But this never bothered me. Every time you start a new match, the AI plays as never had played before.

If games like I said, with many programmers, lots of money can't do it, why do you think that triplea with people working for free will?

Irinam wrote
Now there is the main "problem" the AI will problably have forever:

For the AI every game is its first game.

It will never be able to learn from its mistakes or adapt to special stategies.
Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

RogerCooper
Irinam wrote
Now there is the main "problem" the AI will problably have forever:

For the AI every game is its first game.

It will never be able to learn from its mistakes or adapt to special stategies.
This is not a problem. What we want is an AI that is the challenge in first game, but we can then have fun beating the second game.
Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

redrum
Administrator
Well I hope to develop an AI that beats you in your first game and then challenges you in the second game :)

Looking for feedback on air units landing safely. Anyone have any games with the latest pre-release where the AI lands planes in a poor place?
Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

panguitch
In reply to this post by redrum
@redrum

Thanks for helping me understand what was causing the errors for the Hard AI. I've released a new version (updated download link on original post) in which I've changed the game sequence. Now Purchase comes near the end, before Place, rather than near the beginning, before CombatMove.

Along with this, I've shifted the timing of many many many triggers, either to the beginning of the round before the AI starts planning, or to after NonCombatMove, before Purchase.

As a result, the Hard AI no longer crashes!
It may still give some warnings about terrain or factories (how do I even check this?), but it plays. In fact, moving the Purchase phase after all the movement and combat seems to have made it faster too. Still quite slow on Greyhawk compared to WWII maps, but a bit better now.

redrum wrote
The 'no factory' is definitely related to having the hybrid factories. The AI handles the mobile factories on Napoleonic since it properly classifies them as such. It doesn't classify the hybrids as factories which causes all the warnings as it tries to place units where it thought they would be.

When you release the next iteration with the trigger fixes then I'll try to test again to see if any of the warnings are easily fixed.
How do I check for warnings? I only know when it actually crashes.

In any case, I've made some other tweaks to try and help the Hard AI with my hybrid factories--to try and trick it into just thinking they're mobile factories--but only with mixed success.

First, I added some triggers that remove the support attachments from the leaders and heroes during movement phases, and bring them back for actual combat and purchase.

For reference, game sequence is:
- Politics
- UserActions
- CombatMove
- Battle
- NonCombatMove
- Purchase
- Place
- TechActivation
- EndTurn

My hope was that this way they would still fulfill their purpose in combat (for human players) and display correctly during purchase, but that the AI would no longer think of them as support units and include them in attacks. If it worked, the only drawback would be the battle calculator would underestimate the impact of heroes when it was used during the movement phase.

This little deceit seems to have partially fooled the AI. Rather than throw them into battle immediately, the AI holds back. But thinking they're infrastructure that needs protecting, it started bunching them all together. Which meant that with all its factories in one territory, the AI couldn't place many new units.

So I also added movement and attacking limits to the hero units. Only 1 hero per territory. This keeps the AI from bunching them together. And humans wouldn't want to put more than one in a territory at a time very often, so it might be a worthwhile sacrifice.

The current situation is that the Hard AI doesn't crash and it's less eager to throw its heroes to the wolves and commit suicide. However, even though I've tried to trick the AI into not thinking about them as combat units, it still sometimes puts them on the front lines (probably thinks it's protecting them with the units massed there), or even sends them along on weak amphibious landings. It does not place them where they can most effectively raise new armies the way I'd expect it to use a mobile factory.

Also, I don't think I've ever seen the AI buy a hero, only place ones it gets from events.

Bottom line is that these changes have made the Hard AI near-viable for Greyhawk. But Hard AI games still usually come down to which faction takes the longest to get its heroes killed, with a map nearly empty of units.

What I'm wondering is whether removing the support attachments during movement is enough to make the AI think the heroes are just mobile factories, or whether it's still confused by their hybridness.

Greyhawk Wars
TripleA in the original Dungeons & Dragons world

Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

redrum
Administrator
This post was updated on .
@panguitch - So 2 things:

1. If you want the AI to consider the hybrid units as factories then you need to remove their combat move ability during non-combat move:

final Match<Unit> match = new CompositeMatchAnd<Unit>(unitCanBeMovedAndIsOwned(player), Matches.UnitCanNotMoveDuringCombatMove, Matches.UnitIsInfrastructure);

2. The AI doesn't understand stacking limits currently so that doesn't really help and just causes more warnings. The engine will prevent the units from stacking but it causes the AI planned moves to just fail. It is currently still using them as defenders since they have support value during non-combat move.
                               
Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

panguitch
(1) Wait, mobile factories in other maps can't move during combat? Didn't occur to me. That's not part of isFactory. I know it's part of isAA. I'll add triggers giving mine "canNotMoveDuringCombatMove" during the non-combat move phase, removing it for other phases, and see how that changes behavior.

I didn't think mobile factories necessarily had this restriction, but it won't hurt mine to have it temporarily during non-combat move.

(2) Triggers are removing the support attributes from heroes and leaders at the start, restoring them after combat move, removing them again after battle, restoring them again after non-combat move:

                        <attatchment name="triggerAttachmentIuz_HardAI_CannonFodderFix" attatchTo="Iuz" javaClass="games.strategy.triplea.attatchments.TriggerAttachment" type="player">
                                <option name="conditions" value="conditionAttachmentIuzEveryRound"/>
                                <option name="when" value="before:IuzPolitics"/>
                                <option name="when" value="after:IuzBattle"/>
                                <option name="support" value="-supportAttachmenthero"/>
                                <option name="support" value="-supportAttachmentIuz_the_Old"/>
                        </attatchment>       
                        <attatchment name="triggerAttachmentIuz_HardAI_CannonFodderReset" attatchTo="Iuz" javaClass="games.strategy.triplea.attatchments.TriggerAttachment" type="player">
                                <option name="conditions" value="conditionAttachmentIuzEveryRound"/>
                                <option name="when" value="after:IuzCombatMove"/>
                                <option name="when" value="after:IuzNonCombatMove"/>
                                <option name="support" value="supportAttachmenthero"/>
                                <option name="support" value="supportAttachmentIuz_the_Old"/>
                        </attatchment>

So I hoped the AI wouldn't perceive any support role for them during either move phase.

Greyhawk Wars
TripleA in the original Dungeons & Dragons world

Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

captaincrunch
I have played 3 matches against the new AI.jar update (some hilarious matches) and lost the 1st, won the 2nd, and lost the 3rd so far and the AI is lookin good but I will post about it when I beat the Allies AI.

I just posted to comment to Eurofabio and RogerCooper that I have mentioned a "Learning AI" a bunch of times and it was a file of "WinnersCapturedTerritories" which tallied Winners captured territories per game adding up more and more as you/it played and was accessed and saved maybe every round. That file could influence the AI's direction of attack like for example the German AI would always go straight for Karelia territory instead of attacking areas around it because it would learn that its victory would result faster by taking Karelia based on the "WinnersCapturedTerritories" file.

That was something I basically threw at the Dev team here and could be considered an option is why I've discussed it.

Anyways, Panguitch made me wonder about another possible option for this game ... it's interesting Panguitch  has in his map where you purchase AT END of the round and that makes things so very different in these RTS games eh?



Is there an easy way to switch from Purchasing Start of Round to Purchasing End of Round?


This game rocks and I love all the complex elements to it to discuss.

Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

beelee
Hi Cap'n

It's pretty easy to change the purchase. It's under game sequense near the top of the xml.
Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

redrum
Administrator
In reply to this post by captaincrunch
@panguitch - So essentially I wrote the mobile factory selection logic based on Napoleonic and here is the general attachment:

<attatchment name="unitAttatchment" attatchTo="General" javaClass="games.strategy.triplea.attatchments.UnitAttachment" type="unitType">
<option name="movement" value="1"/>
<option name="attack" value="0"/>
<option name="defense" value="0"/>
<option name="transportCost" value="3"/>
<option name="isFactory" value="true"/>
<option name="destroyedWhenCapturedBy" value="UnitedKingdom:Spain:KingdomOfPrussia:Russia:AustrianEmpire:France:OttomanEmpire:Sweden"/>
<option name="canNotMoveDuringCombatMove" value="true"/>
</attatchment>

It essentially has 'isFactory' and 'canNotMoveDuringCombatMove' has the properties to identify it as a mobile factory. So the logic assumes that any unit that can move during combat move has combat value and isn't a true factory.
Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

Black Elk
This post was updated on .
In reply to this post by eurofabio
Check out this interesting position that HardAI Allies managed to swing in v5! Using the last jar

I again gave them a total bid of 36 ipcs (12each) and let them choose what to buy. Russia and UK both got themselves a pair of tanks, and USA took an extra Atlantic cruiser... which it eventually used to set up a nice Normandy Invasion!

Hard_AI_Allies_bid_36_ipcs_round_10_D_Day.tsvg

After an early non com goof by Germany (way to go human intelligence/Me haha!) by leaving their AAguns behind in France, USA launched into a D-Day mode in the 3rd round. First they went in light, then heavier in waves from UK/USA, until Germany had to withdraw their tanks from Caucasus to defend the Fatherland!

Rushed the tank column back towards the west, and put Rommel in command, I was able to intimidate the AI in a mass departure from France. The British died in great numbers in the last attack wave as our troops dug in deep, but now the following round the Americans are back in even greater numbers in Holland. Try to force a decision again on my tanks! I love it

Check the position, they got a pretty nice D-Day set up in the 10th round.

This game is also an example of what it the board normally looks like when two humans are playing. Germany takes the Center early but is too weak to take Moscow, then they build up for a few rounds while Japan pushes boots and armor to the territory to help free up the German tanks.

Here Axis will crush the center, but USA also has a strong position in the trade, and Africa is just a swarm of Allies haha. What will Churchill do next?!

Center Collapse, Deep Endgame! ...
Hard_AI_Allies_bid_36_ipcs_round_11_Center_Collapse.tsvg
Reply | Threaded
Open this post in threaded view
|

Re: AI Development Discussion

captaincrunch
@Black Elk, hey I wondered do you switch from controlling the countries your self to not controlling countries and letting the AI run for a round sometimes? Is that how you are playing these games I am reading? You describe them well but I read it like you off and on use the AI right?

I pick Axis or Allies and let the AI run against me that way is how I do it but you can do it however you like but I wondered and wanted to ask if you are using AI 50/50 or are you letting the AI run all the countries for every round or what.
1 ... 30313233343536 ... 63