# Pokemon Battle System A.I

For my newest project, a Pokemon fan-edition, I need to collect much information on the game mechanics. So I need to know a few things about the A.I. implemented in the games. For the sake if simplicity here are my questions:

1. Do today's Pokemon games (Diamond, Pearl, Platinum, HeartGold, SoulSilver, Black, White) include an A.I. or is everything more or less random?
2. Has anyone information or even resources on that topic so that I can reuse this to build my battle system?

It's not exactly Pokemon, but I think I've got just the thing for you. There are a couple of Final Fantasy VII FAQs down at GameFAQs that might be useful for understanding how this sort of behavior might work. In particular:

The first one is probably the most interesting for you, because it presents (in pseudocode) the AI for every enemy in the game. For instance, here's part of the AI for one of the enemies (as you can see, it's a mix of scripting with random probabilities):

AI: Main
{
If (Stage == 0) Then
{
Choose Random Opponent
1/4 Chance: Use <Bodyblow> on Target
3/4 Chance: Nothing
} Else If (Stage == 1) Then {
Choose Random Opponent
1/6 Chance: Use Bubble on Target
1/6 Chance: Use <Bodyblow> on Target
1/3 Chance: Nothing
} Else If (Stage == 2) Then {
Choose Random Opponent
1/4 Chance: Use Bubble on Target
1/4 Chance: Use <Bodyblow> on Target
1/2 Chance: Nothing
} Else If (Stage == 3) Then {
Choose Random Opponent
1/2 Chance: Use Bubble on Target
1/2 Chance: Use <Bodyblow> on Target
} Else {
Choose Random Opponent
Use Bubble on Target
Choose Random Opponent
Use <Bodyblow> on Target
}
}


The second one is mostly about the formulas used in the game. Damage formulas, elemental weakness formulas, etc, which you might also be interested in. For instance:

Base Damage = Att + [(Att + Lvl) / 32] * [(Att * Lvl) / 32]
Damage = [(Power * (512 - Def) * Base Damage) / (16 * 512)]


If anything, I think at least these will serve as inspiration.

• +1. To be honest, I already have all formulas from the Pokémon games concerning damage computations and stats etc. But nevertheless I will have a look at the documents to find some clues how Squaresoft did implement A.I. in FF, although I do not want to script every pokemon with unique actions... Jan 3 '12 at 1:01
• Like I said at the end, the idea here was to give you inspiration. Sit down with the pokemon games, get into a battle, and try to think like the computer. Is there any pattern to the computer's actions? Does he seem to target your weaknesses or does he seem to just choose an attack randomly? If the enemy knows a healing move, does he only use it when low in health? From there you should be able to deduce a system that acts similarly. This could be as simple as giving a random probability to each move, creating a set of rules and placing moves in categories, or completely scripting the AI. Jan 3 '12 at 1:54
• Perhaps someone has figured out the Pokemon's AI mechanics before but unfortunately I'm not aware of such resource being available. If you happen to find it, let us know too! Jan 3 '12 at 1:57
• I'll mark this question as answered until someone has more information on that topic! Jan 7 '12 at 21:48