The AI analysis topic

Talk about Advance Wars DS. Debate, laugh, cry, argue about everything to do with our favourite tag game here.
User avatar
ALAKTORN
Location: Italy

The AI analysis topic

Postby ALAKTORN » Sat Apr 16, 2016 7:34 am

I don’t know how to write up such a thing but I want to see it done so… disclaimer: most or all things written here aren’t to be taken as 100% correct as they’re mostly educated guesses.

Preface: The AI has multiple settings ??(Defense, General, Assault, Strike)?? which determine how it behaves. Pre-deployed units will have their AI randomized at every turn start, built units I have no idea maybe they’re given a setting at build. Built units also have a bug(?) that skews their position in the units list (read: Movement), making them move after units they ought to be moving before.

—MOVEMENT—
The AI moves its units based on an internal units list (?maybe? you can see your own list under Intel → Unit, but not the AI’s). I believe it goes by unit type (Infantry first, then idk, etc.). The AI makes decisions in “waves”, of which there are 3 at most. A wave is a single go-through of the units list from the top to the bottom. If the AI hasn’t decided what to do with certain units on the first wave, it will go onto the 2nd wave, at most going through 3 waves before ending the turn.

—ATTACKING— *STL will have to chime in and help me out here*
When selecting a unit that can attack, the AI will calculate a single battle against all attackable units in range(*), if there are multiple positions from which the AI can attack it’s not clear which one is used in the calculation. We call this calculation an “estimation”. If the estimation ends in the AI’s favor in terms of G (G dmg dealt − G dmg taken in counter) it will attack (sidenote: the RN used for the estimation is the same as the one used for pathdrawing, it seems). While that may seem straightforward, there are tons of variables and special cases. For example, the G of your unit isn’t its actual cost for some of them, an Infantry has a ×2 modifier (so 10HP damage isn’t estimated as 1,000G, but 2,000G), read below for the “full” (not yet) list. Another variable is whether or not the unit the AI estimates against is within range of another player unit, which makes the attack less likely but I don’t know the details. Then there are “limits”, of 10% HP damage and 70% HP counter damage; if the AI estimates ≤ 10% damage dealt it will only attack if the (G − counter G) ends up in its favor 4-fold. If it takes ≥ 70% damage counter, it will not attack. Exceptions to these limits are when you’re about to finish capturing an HQ, and the 70% limit doesn’t apply if the AI is estimating against a Mega Tank or is in Strike behaviour. Another variable is fuel, if the AI is low on fuel it will try to refuel instead of attacking. I’m probably missing something else as well but I’m gonna post this for now.

Player unit value list
Infantry = ×2
Mech = ×1.5
Mega = ×2
APC = ×0.5
Edit: Wow f** this each individual AI unit type has a different values list. Would be great if someone actually extracted this stuff from the ROM…

(*)—Infantry exception— (This hasn’t been tested a lot)
If a ≥ 5HP Infantry has a capturable property in range, it will capture over estimating against non-soldier direct units, but it will still estimate/attack indirect units and soldiers. With 2–4HP it will estimate/attack all units, with 1HP it will run away trying to heal.
Last edited by ALAKTORN on Sat Apr 16, 2016 10:57 am, edited 2 times in total.

User avatar
Xenesis
Tri-Star CO
Tri-Star CO
Rank: Hydrocarbon Inspector
3DS Code: 2535-4646-7163
Location: 0x020232DD
Contact:

Re: The AI analysis topic

Postby Xenesis » Sat Apr 16, 2016 10:25 am

ALAKTORN wrote:(*)—Infantry exception— THIS IS TERRIBLY NOT WELL-UNDERSTOOD
If an Infantry has a capturable property in range, it will capture over estimating against non-soldier direct units, but it will still estimate/attack indirect units and soldiers.


This is almost certainly to do with the AI's turn order. I've mapped out AW2's one (it's here):

Code: Select all

0x080576738 - List of AI Unit Phases (1)
   Phases
   0x1 - Turn Start                        0805CE21*Start Turn COP
   0x2 - Capture with Infantry                  0805CA61
   0x3   - Dunno                     (0x3)      0805CB1D
   0x4   - Fire With Indirects   (0x4)            0805CBCD
   0x5   - 085DB71                           0805CE21
   0x6   - Attack with Fighters and Bombers         0805CC89
   0x7   - Attack with Directs   (0x5)            0805CD35
   0x8   - Attack with Directs   (0x5)            0805CD35
   0x9   - 085DB65                           0805CDF1
   0xA - Attack with Infantry    (0x1)            0805CF0D
   0xB   - Position with Transports (0x2)         0805CE51
   0xC   - (0x2)                              0805CFBD
   0xD - Position with Inf. Transport (2)         0805D079
   0xE   - Position with Indirects      (0x4)      0805D135
   0xF   - Position with Landers   (0x6)            0805D1F1
   0x10 - Position with Landers   (0x6)         0805D1F1*End Turn COP
   0x11 - Appears to be Dummied Code            0805D2A1
   0x12 - 085DB71                           0805CD35
   0x13 - Attack with Directs (0x5)            0805CD35
   0x14 - Ends Turn    (Str 5 at 0x3004780)      0805D339


AWDS has a similar setup, but I haven't mapped it out yet. It's likely that this would give you the answer to that question. I don't know if each AI type has a different turn order progression, but I mapped that for the "Standard" AI, if I recall. Once the AI has committed to moving a unit, it'll get ignored for later phases (in AW2). I'm pretty sure AWDS is a bit more dynamic on the whole, however.
IST wrote:Even the worst individual needs to discover the joys of a chicken statue that is also a pregnant blonde housewife.

User avatar
ALAKTORN
Location: Italy

Re: The AI analysis topic

Postby ALAKTORN » Sat Apr 16, 2016 10:57 am

^I’m not sure what you mean. I updated a little the OP though.

User avatar
Xenesis
Tri-Star CO
Tri-Star CO
Rank: Hydrocarbon Inspector
3DS Code: 2535-4646-7163
Location: 0x020232DD
Contact:

Re: The AI analysis topic

Postby Xenesis » Sat Apr 16, 2016 11:32 am

ALAKTORN wrote:^I’m not sure what you mean. I updated a little the OP though.


Right, I didn't really explain it at all.

During an AI's turn it'll go through a list of checks in order. I've called them "AI Phases". It'll check whether a unit meets criteria for action during those instances, if it does it'll perform an action with those units. If not, it'll ignore it. Because I've only delved into the AW2 one I'll use it as an example:

Turn starts, AI has an Infantry not in range of a city
Phase 0x1: Capture can't be fulfilled so the Infantry is not moved.
The Infantry is ignored until
Phase 0xA: Attack with Infantry - if there's enemy targets in range it'll attack, if not it'll move. If its HP is low it'll retreat.

In the AWDS case from what you report, it'll do an Inf-attack phase (specifically vs some unit types), do the capture check and then do the standard check. Basically it's an order of operations. This ties in directly to your idea of 'waves' for movement - AW2 only had two 'waves' based on the way it was set up.

Edit: I've started digging into the ASM and can definitely confirm that the basic function is the same, although AWDS' is much more complex than AW1/2's. AWDS generates a unit queue that will perform actions with some other variables taken into account. Pretty sure it has an AI table like AW2, just need to find the relevant information. The data from a unit's entry in the AI table is (in order) Max Counter Damage, Min Attack Damage, Minimum Fuel, Minimum HP, Aggressiveness (multiple) and Build Rate. If you guys could fill in anything you know about the various AI types (and whether individual COs have differences in these behaviours!) it'd be really helpful in pulling out the rest of the AI information.

Edit 2: ALAKTORN, another thing which would be useful is how you're figuring out the multipliers? That'd probably help me too.
IST wrote:Even the worst individual needs to discover the joys of a chicken statue that is also a pregnant blonde housewife.

User avatar
ALAKTORN
Location: Italy

Re: The AI analysis topic

Postby ALAKTORN » Sat Apr 16, 2016 11:43 pm

Xenesis wrote:Edit: I've started digging into the ASM and can definitely confirm that the basic function is the same, although AWDS' is much more complex than AW1/2's. AWDS generates a unit queue that will perform actions with some other variables taken into account. Pretty sure it has an AI table like AW2, just need to find the relevant information. The data from a unit's entry in the AI table is (in order) Max Counter Damage, Min Attack Damage, Minimum Fuel, Minimum HP, Aggressiveness (multiple) and Build Rate. If you guys could fill in anything you know about the various AI types (and whether individual COs have differences in these behaviours!) it'd be really helpful in pulling out the rest of the AI information.

Edit 2: ALAKTORN, another thing which would be useful is how you're figuring out the multipliers? That'd probably help me too.

Individual COs have no differences in behaviours. Not much is known about AI types… STL says War Room only has “General”, but who knows. In some pre-deployed Campaign maps you can see that the AI type is set on a unit-type basis at the start of each turn, for example in Max Attacks the 2 Tanks will always either both move into your BCs range, or both don’t. In Snow Hunters the Cruiser will either move into your Cruiser’s range or not. This is all manipulable by tapping away the “DAY” sign at the start of the AI’s turn, it’s based on the frame the AI turn starts.

About the multipliers I honestly don’t know if they’re even a thing, but STL always took them for granted. We just design maps with stuff like 50 COM Towers and an AI Bomber or Mega Tank, then put into its range various units. The AI mostly destroys in order of G value, but sometimes it doesn’t so that’s where the multipliers idea came from.

Edit:
The data from a unit's entry in the AI table is (in order) Max Counter Damage, Min Attack Damage, Minimum Fuel, Minimum HP, Aggressiveness (multiple) and Build Rate.

So let me see if I understand, these are all values that the AI takes into consideration when moving each of its units? Sounds cool! STL is teling me the 10% dmg and 70% counter limits may be Infantry only.

User avatar
Xenesis
Tri-Star CO
Tri-Star CO
Rank: Hydrocarbon Inspector
3DS Code: 2535-4646-7163
Location: 0x020232DD
Contact:

Re: The AI analysis topic

Postby Xenesis » Sun Apr 17, 2016 12:11 am

ALAKTORN wrote:Individual COs have no differences in behaviours.

Oh thank fudge for that. AW2 had one for each CO, for each type of map (Land, Land/Air, Land/Sea and Land/Air/Sea) plus one for each Campaign map.

Not much is known about AI types… STL says War Room only has “General”, but who knows. In some pre-deployed Campaign maps you can see that the AI type is set on a unit-type basis at the start of each turn, for example in Max Attacks the 2 Tanks will always either both move into your BCs range, or both don’t. In Snow Hunters the Cruiser will either move into your Cruiser’s range or not. This is all manipulable by tapping away the “DAY” sign at the start of the AI’s turn, it’s based on the frame the AI turn starts.

Does it pull RNG values? If it does, it's likely the aggressiveness rating that's set on unit creation. If it's just frame counter then it might be something different.

About the multipliers I honestly don’t know if they’re even a thing, but STL always took them for granted. We just design maps with stuff like 50 COM Towers and an AI Bomber or Mega Tank, then put into its range various units. The AI mostly destroys in order of G value, but sometimes it doesn’t so that’s where the multipliers idea came from.


IS use multipliers in all kinds of weird places, so I'd be pretty unsurprised if they used them here. AW2 had a simple concept of a 'counter-unit', which I imagine they expanded in AWDS.

So let me see if I understand, these are all values that the AI takes into consideration when moving each of its units? Sounds cool! STL is teling me the 10% dmg and 70% counter limits may be Infantry only.


Yeah. They're basically thresholds that the AI uses to choose actions.
IST wrote:Even the worst individual needs to discover the joys of a chicken statue that is also a pregnant blonde housewife.

User avatar
ALAKTORN
Location: Italy

Re: The AI analysis topic

Postby ALAKTORN » Sun Apr 17, 2016 12:23 am

Xenesis wrote:
Not much is known about AI types… STL says War Room only has “General”, but who knows. In some pre-deployed Campaign maps you can see that the AI type is set on a unit-type basis at the start of each turn, for example in Max Attacks the 2 Tanks will always either both move into your BCs range, or both don’t. In Snow Hunters the Cruiser will either move into your Cruiser’s range or not. This is all manipulable by tapping away the “DAY” sign at the start of the AI’s turn, it’s based on the frame the AI turn starts.

Does it pull RNG values? If it does, it's likely the aggressiveness rating that's set on unit creation. If it's just frame counter then it might be something different.

Yeah, it pulls from RNG. This is at every turn start on a pre-deployed map, though, so it’s not at unit creation.

STL is teling me the 10% dmg and 70% counter limits may be Infantry only.

The 70% limit has maybe just been proven universal by a test I did with 10 Towers Grimm Tank vs. 10 Towers Grimm Neo Tank, would be favorable in G but the Tank doesn’t suicide.

User avatar
Xenesis
Tri-Star CO
Tri-Star CO
Rank: Hydrocarbon Inspector
3DS Code: 2535-4646-7163
Location: 0x020232DD
Contact:

Re: The AI analysis topic

Postby Xenesis » Sun Apr 17, 2016 12:36 am

ALAKTORN wrote:Yeah, it pulls from RNG. This is at every turn start on a pre-deployed map, though, so it’s not at unit creation.

Alright, I'll dig in tomorrow. Knowing it pulls from the RNG makes my job easier because I can just breakpoint reads from it.

The 70% limit has maybe just been proven universal by a test I did with 10 Towers Grimm Tank vs. 10 Towers Grimm Neo Tank, would be favorable in G but the Tank doesn’t suicide.


Do the General, Defensive and Assault AI all have the same ratio? I know the Strike AI ignores counter-damage.
IST wrote:Even the worst individual needs to discover the joys of a chicken statue that is also a pregnant blonde housewife.

User avatar
ALAKTORN
Location: Italy

Re: The AI analysis topic

Postby ALAKTORN » Sun Apr 17, 2016 12:44 am

Xenesis wrote:Do the General, Defensive and Assault AI all have the same ratio? I know the Strike AI ignores counter-damage.

Yeah, same ratio.

User avatar
DxDyDzD
Rank: Blue Bomber
Location: War Room

Re: The AI analysis topic

Postby DxDyDzD » Sun Apr 17, 2016 12:59 am

AI unit "destiny"
Once an AI unit is built, it will always move the same way. If a unit is built on D3 for example, it will always move the same way on D4 (and D5, D6, etc) no matter how long you delay the A press to cancel "DAY 4" on the AI's D4.

In short, delaying the A press on D4 will affect:
1) damage RNs on D4
2) units built, and their destinies, on D4
3) order of unit movements on D5 (see example below)
4) which tile a unit will capture/attack from, if there are multiple choices

It will NOT affect:
1) the "destinies" of units built on D3

I did a test on Twin Isle, since I know that that map has a lot of enemy movements that can go wrong. Here's what I did: play my strat until D3 (note that the Inf must capture N on D2). Save a state on the AI's D3, preferably on the first frame you can cancel "DAY 3". Continue playing and watch what happens on the AI's Day 4.

On AI D4 the Neotank will always move either N or S, and you can't change this except by going back to the AI D3 state and delaying the A press.

Go back to AI D3 and save a state on D4 where the Neotank's "destiny" is to move N. (save state on D4, check AI's D4: if the Neo moves S, reload from D3, otherwise keep the D4 state.) Make your D4 moves, then save a state on the AI's Day 4. Then:
1) make your D5 moves
2) watch what the AI does on D5
3) load D4 state, advance 1 frame, save state, repeat

The following Tank moves are possible:
- Inf + Neo move, N Tank 1N 5W, S Tank 2N 4W.
- Inf + Neo move, N Tank 1N 5W, S Tank 1S 5W.
- Inf + Neo move, N Tank 1N 5W, S Tank 2S 4W.

- Inf + Neo move, N Tank 2S 3W, S Tank 2N 4W.
- Inf + Neo move, N Tank 2S 3W, S Tank 1S 5W.
- Inf + Neo move, N Tank 2S 3W, S Tank 2S 4W.

- Inf + Neo move, N Tank 3S 3W, S Tank 2N 4W.
- Inf + Neo move, N Tank 3S 3W, S Tank 1S 5W.
- Inf + Neo move, N Tank 3S 3W, S Tank 2S 4W.

- Inf + Neo move, N Tank 1N 5W, Inf + Inf move, S Tank 2N 4W.
- Inf + Neo move, N Tank 2S 3W, Inf + Inf move, S Tank 2N 4W
- Inf + Neo move, N Tank 3S 3W, Inf + Inf move, S Tank 2N 4W.

- Inf + Neo move, S Tank 2N 4W, Inf + Inf move, N Tank 1N 5W.
- Inf + Neo move, S Tank 2S 4W, Inf + Inf move, N Tank 1N 5W.
- Inf + Neo move, S Tank 1S 5W, Inf + Inf move, N Tank 1N 5W.

- Inf + Neo + Inf + Inf move, N Tank 1N 5W, S Tank 2N 4W.

Observations:
1) D2 Inf + Neo always move one after another, similar groups are the 2 Tanks and the 2 D1 Infs. The APC always moves last. Note that one of the D2 Infs is inside the APC. Not sure if this is important, probably not.
2) If the D1 Inf group moves before any of the Tanks, the remaining Tank(s) will always make the same moves: N Tank 1N 5W, and/or S Tank 2N 4W.

Go back to AI D4 and save a state on D5 where the Tanks' "destiny" is to move N. Make your D5 moves, then save a state on the AI's Day 5. Now there's a few things that are worth watching on AI D6:
1) Whether the Neotank goes N or S. In the video it went S even though I moved both Tanks E. On my current savestate the Neotank is really aggressive and moves N unless I move the S Tank <=2 spaces and the N Tank <=3 spaces.
2) What the Art does. Most of the time it'll go on the HQ, meaning you can't complete the map unless you reload the D5 state and manipulate a different Art movement. Sometimes it'll move 1N of the HQ which is what you want. Sometimes it will go 2N 3W.
3) Where the Tanks move. In the video they moved onto the Plains, but on my savestate they moved onto the road, even when I moved the my Tanks E. On another state they moved even further N, onto the city + plains.
Again, all of the above cannot be manipulated by delaying the "DAY 6" cancel.

AI build manipulation
- The AI builds Mechs if you build Recons. Example: Spann Island (probably the easiest to see this happening)
- The AI will build units to attack units that are within X squares of the base even if the terrain is impassable ,where X is the # of tiles the built unit can move. Example: Moji Island Tank, The Trident money COs AA
- For some reason the AI can be tricked into building away from its bases if you put a Black Boat near one of their ports. Could work with more units, other than BBs. Example: Kita Straight Cruiser strat, Egg Islands N port
- Sometimes the AI has enough funds to build Inf or Mech. I think I read somewhere that it was 3/4 Inf, 1/4 Mech. Example: Four Acres YC, Final Battle YC

Still not fully understood:
- The AI builds Mechs instead of Recons if you have AAs/Tanks. Example: HC Pincer Strike, if you delete OS's AA the AI builds Recon instead of Mech consistently. Twin Isle D5, AI builds Mech + Art instead of Recon + Art if you have 2 Tanks.
- The AI builds Art if you have Tanks. Example: Twin Isle, if you build Tank on D4 the AI builds Tank+Art, while if you don't build anything, the AI builds 2 Tanks.
- Toil Ferry 7/300 Missiles manipulation: The AI builds Missiles if you build a Tank. At that point you have 1 Inf, 1 Fighter, 1 TCop (another TCop got killed on the AI's turn), 1 BCop, and 1 Tank. Also, the AI Mech attacks your TCop instead of Inf.
- Stamp Islands no-Inf manipulation. Try this: choose Kanbei. D1 build Inf + BB, and TCop on the S airport. D2 load, BB 7E, TCop 6E. D3 BB 6E, now try out different TCop movements. I found that GE will build 2 Infs if your TCop ends on a sea/reef tile, while it skips the 2 Infs if your TCop ends on a land tile. If you build a D3 TCop/BCop, GE builds 2 Infs no matter where the first TCop ended.
If you move BB 1S 6E on D3 the AI builds BCop instead...wtf
Last edited by DxDyDzD on Wed Apr 20, 2016 3:32 pm, edited 2 times in total.

User avatar
ALAKTORN
Location: Italy

Re: The AI analysis topic

Postby ALAKTORN » Sun Apr 17, 2016 1:12 am

I’m pretty sure the Twin Isle Neotank movement is determined by the “bug” I explained in my OP when it’s built. If it moves after the Tanks, the Tanks will have covered the space the Neo would normally move over, so instead of going N it goes S, or something like that. It’s all about the “bug” that can happen when a unit is built. The other movement differences you’re seeing are probably the AI setting (Defense/Assault/etc.?) that are given at unit build?

Also, the AI Mech attacks your TCop instead of Inf.

I think I remember in Toil Ferry that the Port near AI’s HQ is bugged and units on it (like an Inf) are pretty much never attacked? I have this vague memory.

I just noticed in your Kanbei Fortress Isle 6/300 video that soldiers will suicide on 200 Defense HQ cap, but non-soldiers (Tanks for example) will ignore the capture and attack something else. That’s one more weird difference in unit behaviour…

Xenesis wrote:
ALAKTORN wrote:Individual COs have no differences in behaviours.

Oh thank fudge for that. AW2 had one for each CO, for each type of map (Land, Land/Air, Land/Sea and Land/Air/Sea) plus one for each Campaign map.

I should probably mention that I’m not sure about that, I just never noticed it being a thing.

Edit:
DxDyDzD wrote:- Sometimes the AI has enough funds to build Inf or Mech. I think I read somewhere that it was 3/4 Inf, 1/4 Mech. Example: Four Acres YC, Final Battle YC

Not sure what you mean with this btw.

User avatar
DxDyDzD
Rank: Blue Bomber
Location: War Room

Re: The AI analysis topic

Postby DxDyDzD » Sun Apr 17, 2016 1:24 am

ALAKTORN wrote:
DxDyDzD wrote:- Sometimes the AI has enough funds to build Inf or Mech. I think I read somewhere that it was 3/4 Inf, 1/4 Mech. Example: Four Acres YC, Final Battle YC

Not sure what you mean with this btw.
If the AI has enough funds to build Inf or Mech, it will build Inf 3/4 of the time and Mech 1/4 of the time.

User avatar
ALAKTORN
Location: Italy

Re: The AI analysis topic

Postby ALAKTORN » Sun Apr 17, 2016 1:34 am

DxDyDzD wrote:If the AI has enough funds to build Inf or Mech, it will build Inf 3/4 of the time and Mech 1/4 of the time.

That’s from the RNG topic.

viewtopic.php?f=12&t=11380#p371322
ALAKTORN wrote:so we found a little something more, when AI asks the RNG on what unit to build, if the choice is between Inf and Mech, the current RN will be advanced once and the last 2 digits of the advanced RN will be considered, 0-19 is Mech, 20-99 is Inf (ex. RN 0 before build, advances once to 1, 1 is between 0-19 so Mech built)

btw congratulations to STL who figured it out by himself


That topic also has this:
viewtopic.php?f=12&t=11380#p371401
-STL- wrote:Anyway so capping Nmost City is 0-49 and Smost City is 50-99 of the last 2 number of advanced RN.

User avatar
DxDyDzD
Rank: Blue Bomber
Location: War Room

Re: The AI analysis topic

Postby DxDyDzD » Sun Apr 17, 2016 2:51 am

Ah, I see. So it's 1/5 and 4/5.

The port on Toil Ferry isn't special. In my 7/300 video I drop the Inf on a Plains.

User avatar
ALAKTORN
Location: Italy

Re: The AI analysis topic

Postby ALAKTORN » Sun Apr 17, 2016 2:59 am

DxDyDzD wrote:The port on Toil Ferry isn't special. In my 7/300 video I drop the Inf on a Plains.

That’s just because Mech v TC is a better G outcome. 4 TC HP are 1kG even after × 0.5. It would need to estimate > 5HP damage to the Inf while taking no counter for it to be better. The Port thing is something I posted about somewhere, I don’t remember what the specifics were.
Last edited by ALAKTORN on Wed Apr 20, 2016 8:58 am, edited 1 time in total.

User avatar
Xenesis
Tri-Star CO
Tri-Star CO
Rank: Hydrocarbon Inspector
3DS Code: 2535-4646-7163
Location: 0x020232DD
Contact:

Re: The AI analysis topic

Postby Xenesis » Sun Apr 17, 2016 11:08 am

Oh good, that's a lot of comprehensive information that confirms what I thought they'd pull forward from AW2.

DxDyDzD wrote:AI unit "destiny"
Once an AI unit is built, it will always move the same way. If a unit is built on D3 for example, it will always move the same way on D4 (and D5, D6, etc) no matter how long you delay the A press to cancel "DAY 4" on the AI's D4.


This basically confirms that they're still using individual on-build aggressiveness settings for the AI. Great. :D

Observations:
1) D2 Inf + Neo always move one after another, similar groups are the 2 Tanks and the 2 D1 Infs. The APC always moves last. Note that one of the D2 Infs is inside the APC. Not sure if this is important, probably not.
2) If the D1 Inf group moves before any of the Tanks, the remaining Tank(s) will always make the same moves: N Tank 1N 5W, and/or S Tank 2N 4W.


This goes back to what I posted up earlier in regards to the AI's order of operations. I partially annotated some of it yesterday and the basic setup matches AW2. I think I'll dig through that and see if I can put it all together today.

AI build manipulation


Seems like this is more complex and the AI directly responds better to what you have on the field. This is probably gonna take the longest to figure out, to be honest.

ALAKTORN wrote:http://forums.warsworldnews.com/viewtopic.php?f=12&t=11380#p371322
so we found a little something more, when AI asks the RNG on what unit to build, if the choice is between Inf and Mech, the current RN will be advanced once and the last 2 digits of the advanced RN will be considered, 0-19 is Mech, 20-99 is Inf (ex. RN 0 before build, advances once to 1, 1 is between 0-19 so Mech built)

btw congratulations to STL who figured it out by himself


Is that percentage static, or does it increase over the course of the map - x0_000 discovered some data for AW2 where the value would increase by a set percentage every day after day 1, so that after about 10-15 days, the AI would mostly produce Mechs vs. Infantry.
IST wrote:Even the worst individual needs to discover the joys of a chicken statue that is also a pregnant blonde housewife.

User avatar
ALAKTORN
Location: Italy

Re: The AI analysis topic

Postby ALAKTORN » Sun Apr 17, 2016 11:31 am

Xenesis wrote:Is that percentage static, or does it increase over the course of the map - x0_000 discovered some data for AW2 where the value would increase by a set percentage every day after day 1, so that after about 10-15 days, the AI would mostly produce Mechs vs. Infantry.

Hmm no idea. That stuff is only for when the AI actually wants to build either unit, it can have the money for both but only want to build one of the two and that RN stuff doesn’t count then.

User avatar
Xenesis
Tri-Star CO
Tri-Star CO
Rank: Hydrocarbon Inspector
3DS Code: 2535-4646-7163
Location: 0x020232DD
Contact:

Re: The AI analysis topic

Postby Xenesis » Sun Apr 17, 2016 5:28 pm

Alright, I've worked out a good chunk of the AI Unit Action Phase setup:

Code: Select all

0x0229E17A - Progress through the Unit Movement Phase

0x0229E1F0 - Base pointer for unit actions
List of units to enact actions with
Format: Unit Number (Full number), 0x0 = End List, 0x40 = Run subroutine at 0x0229E170

0x0208DAD4 - Loads and runs the AI unit phases.
0x02161A68 - Pointer Table for Unit Phases (First List - No Fog of War)
0x02161AE8 - Pointer Table for Unit Phases (Second List - Fog of War)

Unit Action Phases (List 1 - No Fog)
0208DB90      00       - Oozium: Action
0208DB90      01       - Oozium: Action
0208E83C      02       - CO Power Use Check (Subroutine 0x20995C4)
0208F43C      03      - Foot Soldiers: Continue Capture
0208DF34      04      - Black Bombs: Explode
0208E170      05      - ??? (1)
0208E050      06      - Black Boat: Supply/Repair Low Units?
0208EA94      07      - Indirect Units: Action
0208E83C      08       - CO Power Use Check (Subroutine 0x20995C4)
0208F308      09      - Foot Soldiers: Action
0208ED48      0A      - Direct Combat Units: Action
0208ED48      0B      - Direct Combat Units: Action
0208E89C      0C      - Clears 0x0229E1B0 (0x40 Bytes)
0208F1D4      0D      - Foot Soldiers: Action (2nd Type, Less Favourable Attacks?)
0208EBC8      0E       - Direct Combat Units: Action (2nd Type)
0208E7DC      0F      - Run Subroutine (0x20A37DC)
0208E644      10      - Air Units (T-Copters?) (Unit Class 0x2): Action
0208E77C      11      - Run Subroutine (0x20A363C)
0208E8FC      12      - Run Subroutine (0x208C560)
0208E50C      13      - Transporting Air Units: Unload
0208E3D4      14      - Transporting Air Units: Action
0208E95C      15      - Indirect Combat Units: Move
0208E2A0      16      - Landers/Black Boats: Action
0208E2A0      17      - Landers/Black Boats: Action
0208F1D4      18      - Foot Soldiers: Action (2nd Type, Less Favourable Attacks?)
0208DCAC      19      - ??? (2)
0208E83C      1A       - CO Power Use Check (Subroutine 0x20995C4)
0208EEEC      1B      - Direct Combat Units (Unit Class 0x5): Action (2nd Type)
0208E95C      1C      - Indirect Combat Units: Move
0208DF34      1D      - Black Bombs: Explode
0208DE18      1E      - Black Bombs: Action
0208DB78      1F      - End Unit Actions

Action: Seems to encompass Move/Capture/Attack/Repair/Load

Unit Action Phases (List 2 - Fog of War)
0208DB90      00       - Oozium: Action
0208DB90      01       - Oozium: Action
0208E83C      02       - CO Power Use Check (Subroutine 0x20995C4)
0208F43C      03      - Foot Soldiers: Continue Capture
0208DF34      04      - Black Bombs: Explode
0208E170      05      - ??? (1)
0208E050      06      - Black Boat: Supply/Repair Low Units?
0208EA94      07      - Indirect Units: Action
0208E83C      08       - CO Power Use Check (Subroutine 0x20995C4)
0208F308      09      - Foot Soldiers: Action
0208F060      0A      - Direct Combat Units: Action (3rd Type) *This one is unique to FoW
0208ED48      0B      - Direct Combat Units: Action
0208ED48      0C      - Direct Combat Units: Action
0208E89C      0D      - Clears 0x0229E1B0 (0x40 Bytes)
0208F1D4      0E      - Foot Soldiers: Action (2nd Type, Less Favourable Attacks?)
0208EBC8      0F       - Direct Combat Units: Action (2nd Type)
0208E7DC      10      - Run Subroutine (0x20A37DC)
0208E644      11      - Air Units (T-Copters?) (Unit Class 0x2): Action
0208E77C      12      - Run Subroutine (0x20A363C
0208E8FC      13      - Run Subroutine (0x208C560)
0208E50C      14      - Transporting Air Units: Unload
0208E3D4      15      - Transporting Air Units: Action
0208E95C      16      - Indirect Combat Units: Move
0208E2A0      17      - Landers/Black Boats: Action
0208E2A0      18      - Landers/Black Boats: Action
0208DF34      19      - Black Bombs: Explode
0208EA94      1A      - Indirect Units: Action
0208EEEC      1B      - Direct Combat Units (Unit Class 0x5): Action (2nd Type)
0208E95C      1C      - Indirect Combat Units: Move
0208F308      1D      - Foot Soldiers: Action
0208DCAC      1E      - ??? (2)
0208E83C      1F       - CO Power Use Check (Subroutine 0x20995C4)
0208EEEC      20      - Direct Combat Units (Unit Class 0x5): Action (2nd Type)
0208E95C      21      - Indirect Combat Units: Move
0208F1D4      22      - Foot Soldiers: Action (2nd Type, Less Favourable Attacks?)
0208DF34      23      - Black Bombs: Explode
0208DE18      24      - Black Bombs: Action
0208DB78      25      - End Unit Actions


This only creates a list of units that fit that criteria. The checks whether the units will actually enact any actions seem to come after, the AI will iterate through the list it's generated. This isn't currently comprehensive and is likely to have a few mistakes that will remain until I dig in more deeply...there's just a crapload of things to dig through.

A unit will only be added the candidate list if it is not in wait mode, it is not in a transport, etc etc.

Edit: Crap, there's a second list of phases I'm gonna have to pore through. Woo. :(

Edit 2: The second list has additional phases, but is only used when Fog of War is active. The list I've annotated up there applies to Fog of War off only.

Edit 3: I can match most of these up, the FoW list has been annotated.

Edit 4: Okay, I've been at this for 6 hours, I'm gonna leave it for a day or two. I'll post again when I figure out some more stuff.
IST wrote:Even the worst individual needs to discover the joys of a chicken statue that is also a pregnant blonde housewife.

User avatar
ALAKTORN
Location: Italy

Re: The AI analysis topic

Postby ALAKTORN » Sun Apr 17, 2016 9:15 pm

Image

Edit: But seriously that looks really cool. I’m curious to see what the full thing will be to apply it to the game.

User avatar
ALAKTORN
Location: Italy

Re: The AI analysis topic

Postby ALAKTORN » Mon Apr 18, 2016 4:21 am

Guys… something fudged up is going on.

On Fortress Isle I’m getting the Infantry to attack my Tank from either W or E randomly, with FROZEN RNG (I’m cheating it). The only random factor that could come from a frozen RNG is the frame advance at the start of the AI’s turn, which takes the in-game time in frames as a variable (I’m not freezing the IGT value). The frame advance is thought to affect aggressiveness for pre-deployed units, but this Infantry is a built unit and I saved after it was already built… what the heck is going on??? Image of W attack: http://i.imgur.com/bgZe0hZ.png

User avatar
ALAKTORN
Location: Italy

Re: The AI analysis topic

Postby ALAKTORN » Tue Apr 19, 2016 6:33 am

Here is what the RNG looks like in Fortress Isle 2.5 sitting a Recon on Hawke’s HQ on D2 (AI D1 makes 2 Infs obviously):

Legend: [RN] [(steps from previous RN)] [Total: # at] [in-game time] [my explanation of what it is]
279273312 (1) Total: 1 at 146841 North Infantry is selected. It does nothing.
677145825 (1) Total: 2 at 146842 South Infantry is selected. It does nothing. This ends wave 1.
166238058 (1) Total: 3 at 146852 North Infantry is selected. Start of wave 2 (notice how it took 10 frames to start this wave).
170618341 (3) Total: 6 at 146853 Two steps: estimate a battle from Road (step 1: attacker’s positive luck, step 2: defender’s positive luck). One step: decide it’s not worth fighting, move 2E 1S (pathfinder algorithm); it starts from the goal position (2E 1S), there are 2 possibilities: 1N or 1W. Picks 1N. The only next possibilities are 1W, 1W, no need for more RNG calls.
725901534 (1) Total: 7 at 146869 South Infantry is selected.
669218248 (2) Total: 9 at 146870 Estimate a battle from Base and attack (step 1: attacker’s positive luck, step 2: defender’s positive luck).

I don’t know why the RNG is called when the AI selects a unit to move. Do you know anything about that, Xen? Another oddity is that it seems the AI only does 2 waves, it doesn’t bother trying another estimation on wave 3 for the North Infantry and goes straight towards the neutral properties instead.

Edit: I think the AI’s day 1 is hard-coded to be Inf spam. I tried cheating and moving a bunch of units near the AI on D1, but it still spammed Infs. Meanwhile day 2 build manipulation happens all over the place.

User avatar
ALAKTORN
Location: Italy

Re: The AI analysis topic

Postby ALAKTORN » Wed Apr 20, 2016 7:32 am

DxDyDzD wrote:- The AI will build units to attack units that are within X squares of the base even if the terrain is impassable ,where X is the # of tiles the built unit can move. Example: Moji Island Tank, The Trident money COs AA

Edit: Below text is only about the ranged-type manipulation.
(small note: not only impassable terrain is ignored, but units that would block the way too)
Addendum: this only happens if you have at least 2 units of specific unit-type within said range. A single unit alone can never manipulate the AI’s builds. Also, soldiers are special. It requires 3 of them to manipulate the AI’s builds; but if paired with a 2-units-manipulation unit-type, 1 is enough. Transport units will never manipulate the AI’s builds (4 APCs didn’t manipulate a single Tank in Fortress Isle).

Tests made on Fortress Isle against Green Earth, put units of specific unit-type within 6 squares of the Bases and the AI will build Tanks. I think there are only really 3 unit-types: basically everything (2 will manipulate), soldiers (3 will manipulate; 1 if paired with the other unit-type), transport (will never manipulate). Note: the TCs manipulate the AA builds on The Trident because they’re loaded with an Infantry; they wouldn’t manipulate anything otherwise. Edit: Though I did just notice that there is an AA there, so the AA + the HQ capping Inf should be enough manipulation for the AA build. Maybe the AA doesn’t actually count as part of the manipulation because the AI wouldn’t counter an AA with an AA, not sure. So the actual manipulation may be coming from the 3 Infs: HQ capping Inf, 5HP Inf that gets the kill for Power, loaded Inf into TC.

What is weird though is that sometimes you can manipulate the AI’s builds with very far away units as DxD already mentioned. I think that is a different type of manipulation compared to the range-based one.
Last edited by ALAKTORN on Fri Apr 22, 2016 1:00 am, edited 2 times in total.

User avatar
DxDyDzD
Rank: Blue Bomber
Location: War Room

Re: The AI analysis topic

Postby DxDyDzD » Wed Apr 20, 2016 3:42 pm

Eh, that doesn't seem right.

https://youtu.be/J1KXfpxuCRo?t=1m2s

A Tank on the S base can reach 2 Recons. A Tank on the W base can only reach 1. Yet the AI builds the Tank out of the W base.

User avatar
Xenesis
Tri-Star CO
Tri-Star CO
Rank: Hydrocarbon Inspector
3DS Code: 2535-4646-7163
Location: 0x020232DD
Contact:

Re: The AI analysis topic

Postby Xenesis » Wed Apr 20, 2016 5:31 pm

ALAKTORN wrote:I don’t know why the RNG is called when the AI selects a unit to move. Do you know anything about that, Xen?


01FFA1B4
This obtains the RNG value (but does not update it), and appears to use it as a basis of selecting between 4 branches. The branch purpose seems to be to pick which tiles to pathfind by.

The game uses a temporary map (02186510) for a variety of functions, including calculating paths. It seems that the RNG is called by the AI as a means of choosing between pathing in otherwise identical-length path lengths.

Whether this particular bit of code is just for Infantry I don't know, but otherwise.

Edit: Hehe, the build algo even generates an ASCII Bean Island :P

Image

(This one is pathfinding from the NW BM Base)

There's also the code at:
0208FFEC
This seems to pull the RNG value (without updating) and calculates a percentage that's stored at 0x0229E17B. The percentage is later compared to another value but I don't know what it's for.

Both of these are my most likely guesses to why pathfinding is pulling the RNG, based on what's hitting breakpoints.
IST wrote:Even the worst individual needs to discover the joys of a chicken statue that is also a pregnant blonde housewife.

User avatar
ALAKTORN
Location: Italy

Re: The AI analysis topic

Postby ALAKTORN » Wed Apr 20, 2016 11:12 pm

DxDyDzD wrote:https://youtu.be/J1KXfpxuCRo?t=1m2s

A Tank on the S base can reach 2 Recons. A Tank on the W base can only reach 1. Yet the AI builds the Tank out of the W base.

Strange. The Pivot Isle and Frozen Fortress Tanks also supported my theory. I don’t know what’s going on there… I may have noticed something obvious though: I think the AI builds in the same order it does its estimations: like reading a western book (top-left to bottom-right). Edit: By the way, the non-ranged kind of manipulation is possible by a single unit, even a soldier. FI GE NW Inf will manipulate a D2 BC. It’s weird because an AA will do the same thing, and BC is totally not a counter to an AA…

@Xen: I’m not sure if we understood each other but I didn’t mean the pathfinding, the AI calls the RNG when selecting a unit. In my example in wave 1, it selects 2 units without doing anything and calls the RNG twice.

User avatar
Xenesis
Tri-Star CO
Tri-Star CO
Rank: Hydrocarbon Inspector
3DS Code: 2535-4646-7163
Location: 0x020232DD
Contact:

Re: The AI analysis topic

Postby Xenesis » Thu Apr 21, 2016 9:24 am

ALAKTORN wrote:@Xen: I’m not sure if we understood each other but I didn’t mean the pathfinding, the AI calls the RNG when selecting a unit. In my example in wave 1, it selects 2 units without doing anything and calls the RNG twice.


The AI is still going to do some pathfinding when it considers to move a unit or not.

I figure it's probably the RNG call that generates a percentage, but I'm not sure specifically you mean otherwise, because there's only so many things tripping the RNG.
IST wrote:Even the worst individual needs to discover the joys of a chicken statue that is also a pregnant blonde housewife.

User avatar
ALAKTORN
Location: Italy

Re: The AI analysis topic

Postby ALAKTORN » Sun Apr 24, 2016 2:05 am

Just found out that Inf v Inf has ×0.5 and ×2 multipliers. Jelly Island 2.0 was thought to be possible with Jugger/Flak/Nell/Sonja/Lash because it was thought AI Inf was 1×, but at least in the Inf vs Inf case it’s 0.5× which makes it impossible for even Jugger to scare the Inf away from a battle (4.0–7.4 best result).

Jelly Island 2.0 tests:
3.7 7.4 wave 2 attack 630G 260G Jugger with +20 Def, Luck, Mountaineer
5.1 8.1 no attack 490G 190G Von Bolt with +20 Def Edit: WATCH THE VIDEO THIS IS RETARDED

Kanbei +12 Def gets attacked on wave 2 very rarely (2/14 or even worse).

[22:34:19] STL: so maybe with 20% or less the Multiplier is the npormal 2.0
[22:34:25] STL: with more and wave 2 we have 2.5

https://www.youtube.com/watch?v=dJSvgof ... e=youtu.be

WHAT THE FU CK IS GOING ON

Edit: Good post by STL from 5 years ago:
viewtopic.php?f=12&t=247&p=368854#p368854
STL wrote:Ok some test about AI attack priority:
I let AI the choice between my full HP Units while he had a Mega/Neo so was sure of the kill.
I tested all ground units (except the Piperunner), the order is as follows:

Megatank
Rockets
Neotank
Missiles
MD Tank
AA
Tank
Recon
Mech
APC
Inf

Then i made a test Tank against Silo'd Art, 7HP Art (4200G) was prefered over 10HP Tank while 10HP Tank was prefered over 4HP Art (2400G), so i guessed that Indirects are seen with double worth for the AI.
Note that this doesn't match for Missiles and Neotank, but that's the next point.

There are "tiers". When AI can attack (ofc only if the attack is positive G wise) a unit of a higher tier, it prefers attacking it, no matter the damage in comparision.
1HP Tank was prefered over full HP Recon, Mech, APC and Inf.
1HP Recon and 1HP Mech were prefered over full HP APC and Inf.

Then finally we see that APC is seen as half of its price, so 2500G
10HP Inf attacked over 7HP APC over 8HP Inf
Since we know that Inf is seen as 2000G this adds up well.

Now the consequences, i suspect that T-Cop is the same as APC for the AI. This would explain why B-Copter attacked even low HP Recon over T-Cop while it has a far higher base damage on T-Cop and T-Cop costs more. It also means we don't have to be sad that late B-Cop doesn't exist, because even if the Tank would hit our Recon to 1HP first, B-Cop still would prefer 1HP Recon over T-Cop.
Then when Mech is in a higher "tier than Inf (But it might be that different attackers, have different "tiers") , so the E Inf would always prefer Mech over Inf.
That means that if we want an Inf suiciding into Mech we don't have to worry about any of ours Inf in his range. It should also confirm that FI 2.0 with Jugger is possible since the requirement i had was that Inf prefers full HP Tank over 4HP Recon.
Also for Risky Duo, it means your Mech must be strong enough to fear Flak's Inf if you want him prefering to attack Inf over Mech. (IIRC that would eliminate some COs in Risky Duo 2.5?)

So finally in case of a tie, when AI does the same damage (like when it kills more than 1 unit of the same type and HP).
The unit which will be attacked is the unit which is the most South (and then east). The reason for that is that appearantly checks all attackable units from NW to NE and then continues from line by line west to east and in case of a tie takes overwrites the unit to attack in case of a tie.
Ofc does AI not "love to waste fuel" =P
After deciding the unit to attack it takes the place which uses the fewest fuel when the defense (or attack bonus) from the terrain is the same, in case of "fuel tie" the attack place is chosen random, like we saw often.

And furthermore fidel, i was right. You lied =P I checked the old topic and you mention Moji 2.0 with Kanbei in a 10-6 and not 10-4 cap, so you took in fact +12 Def and Cap+ 2 not Cap +3.
Under this condition your Inf can keep 5HP, the 6HP Recon min damage is 18% so 360G from the point of view of the AI and the counter is 10% at max when the Recon attacks from Plain, so 400G.
So it means that Enemy units can be feared even if you capture the HQ.
The question are the conditions, we know that Infs and Mechs will always attack you even if you just capture a Base and have 200+ Def (Money Map 10!)
Furthermore i know from Money Map 9, that full HP AA does attack 190 Def, while Tank does not(since it cant do 1HP damage) and neither does attack 200 Def Mech.

So i would guess from all that info that only non-Soldier with less than 10HP can be feared, if they could stop the Soldier from being able to finish the cap by attacking but ending bad G wise.

Now the use, if we think of Jelly 2.0 again, we could damage the Enemy Tank with Art, Colin (Dir Def + 20, Cap+2, Luck) but since Colin is so weak he can only do 5Hp damage to the Tank, 7HP Tank makes 30% min attack on Inf (600G) and our max counter is 7% when he attacks from City (490G) so it doesnt work here.

User avatar
Dragonite
Rank: My face is beaming.
Location: the netherlands(mostly)

Re: The AI analysis topic

Postby Dragonite » Sat May 28, 2016 7:32 am

I just randomly read on tvtropes somewhere Juggler actually gets a better AI protocol if his power is active, as the CO profile. Is that actually true they bothered with that? :P

User avatar
x0_000
Rank: Clothes shopping is NP-Complete.
Location: a thing

Re: The AI analysis topic

Postby x0_000 » Mon May 30, 2016 3:14 pm

I doubt it's true. Xen can figure it out eventually if he's got any interest in figuring it out.
Only in math can you buy 600 cantaloupes and not look like a nutter.

User avatar
ALAKTORN
Location: Italy

Re: The AI analysis topic

Postby ALAKTORN » Sat Jan 28, 2017 4:35 am

After having played Kita Straight 2.0 6/276 I have a few new observations:

EUR AI is slightly different from USA/JPN: EUR http://i.imgur.com/f7FWEcm.png (only Mech built) — USA/JPN http://i.imgur.com/eRjaRYm.png (Mech + Inf + Tank built)

The range-independent build manipulations are based on HP of your units, probably:
ALAKTORN wrote:AI deciding whether or not to build the D5 Inf is determined by how many soldier HP you have on the field. If your soldiers total up 35 or more HP, the AI builds the Infantry. All these tests had a 10HP Mech that’s uncounted:
No D5 Inf
7771 = 22HP
6666 = 24HP
7736 = 23HP

D5 Inf
7477 = 25HP
6667 = 25HP


Return to “Dual Strike General”

Who is online

Users browsing this forum: No registered users and 1 guest