"True Double" AI

Post Reply
User avatar
RXFADEZ
Pokémon Trainer
Posts: 121
Joined: Sun Nov 09, 2014 6:32 pm
Contact:

"True Double" AI

Post by RXFADEZ » Mon Apr 04, 2016 2:18 pm

Recently in the Pokémon Emerald Discord channel, me and Shiru were discussing the AI of the True Double fight. With the help of Dabomstew, we looked into the battle's AI code and discovered that Tabitha was set to ".4byte 0x1 ; AI flags", while Maxie was set to ".4byte 0x7 ; AI flags". This means that Tabitha's AI is set to have AI flag 0 set, while Maxie's is set to AI flags 0, 1 and 2. Here is a list of AI flags and their effects:

Code: Select all

0    won't use moves that have no or a negative effect
1    will actually create some difference in viability scores based on basic calculations
2    starts understanding things like type effectiveness, damage and fainting
3    with a chance of about 3/10, some status moves will get priority on the first turn (list of move scripts at 081DBAA7)
4    with a chance of about 5/10, move effects in this list will get priority: http://pastebin.com/raw.php?i=TP5gCBHp
5    with a chance of about 4/10, non-damaging moves will get priority
6    if there are other pokes left on the ai's team, with a chance of a bit more than 6/10 it will give priority to non-damaging moves. chance raises to a bit more than 9/10 if the user (possibly also its ally) has baton pass
7    nop
8    ai will start looking at health percentages and decide using moves based on that
9    broken/unfinished, does nothing
10-28    nop
29    roamer; will attempt to flee on the first turn
30    safari
31    unused; will flee on 20% health and lower
However, this is now how Tabitha behaves in battle. Shiru pointed out that he was consistently getting Amnesia from Tabitha's Camerupt and Exarion stated the Tabitha's Golbat would ALWAYS go in for the kill if it could. This didn't make sense. Tabitha shares the exact same AI flags with Aqua Pooch, but was seemingly abiding by good AI. After theorising about the potential of type effectiveness and dual target moves being at play and ruling those hypotheses out, we were all thinking that perhaps Tabitha's AI took no affect here and the whole battle was controlled by Maxie's, this looked good in theory, but it had to be tested.

I chose Expert Timothy and Ninja Boy Jaiden as my test subjects, due to their ability to be fought singularly or in a double battle, Jaiden's ability to use both non-damaging and damaging moves and the fact that Timothy shared AI with Maxie, while Jaiden shared AI with Tabitha. The tests were a massive success. As seen in the video I will link below, when fought him singularly, Jaiden would pick random moves, despite being able to kill Abra, but, when fought alongside Timothy, Jaiden would always attempt to Fury Cutter (and faint) Abra, meaning that Timothy's AI had taken over and they were both using "smart AI", despite Jaiden being programmed on "dumb AI". This means that although there is still a random element, there are certain factors of the True Double fight making both opposing trainers more easily predictable, e.g. Pokémon will always target down a Pokémon they can kill.

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

~RXFADEZ
Last edited by RXFADEZ on Mon Apr 04, 2016 10:00 pm, edited 1 time in total.

User avatar
Amoeba
Cooltrainer
Posts: 280
Joined: Thu Apr 24, 2014 12:26 am
Contact:

Re: "True Double" AI

Post by Amoeba » Mon Apr 04, 2016 8:45 pm

Neat, good find.
~

Post Reply

Return to “Pokémon Emerald”

Who is online

Users browsing this forum: No registered users and 1 guest