Pokemon Trainer AI analysis (for a game in development)

Hi, didn't have any idea where to put this (feel free to move this if you need to, Mods), but basically in short I'm developing a Pokemon Port for blind people, and I need a review for Trainer AI. Actually, any ideas would help at this point because I'm tired and haven't been into competitive battling for a while now. No it's not a ROM hack, it's being developed in GM8.1 because I'm a lazy bum.

Some notes about this game:

Since it is going to eventually expand with all regions, I have a mixed bag in terms of moves, Pokemon and mechanics. Here's the basic laydown:

Pokemon are Gen I. Pokemon can't hold items (yet. The variable's there but there's no code that handles it at all yet)

Moves are Gen II. Most effects are gen III+ however (except for low kick but that's gonna change eventually)

Stat calculation is Gen III+.

Moves are split with Physical/Special, like in Gen IV+.


Anyways, here's what I got thus far:

Code:
AI tiers:

All tiers can use items.

Tier 0:
Random moves only. Never switches.

Tier 1:
Random, but if a stalemate between two attacking moves, will choose the attacking move that is more powerful. Will not inflict status effects if already suffering from status effects. Never switches.

Will not use substitute or belly drum if HP is too low.

Tier 2:
If Pokemon has higher defenses than offenses, begins with first a status inflicting move, then a status lowering move. Once both have been implemented, will attack normally.

If Pokemon has higher offenses, will skip status lowering abilities unless enemy defenses/offenses are unusually high, using the status inflicting move to lower the stat. Will use a move that inflicts paralysis to lower speed, or a speed dropping move, but will not use status effecter if misses more than twice.

Both examples will use foresight or Odor sleuth if player has used Double Team or Minimize more than twice. If they lack this move, will use a 100% accuracy move instead.

Will use recovery moves if 33% or less.

Will not use substitute or belly drum if HP is too low.

Will only switch to counter Perish Song, and only on the last turn.

Tier 3:
If Pokemon has higher defenses than offenses, begins with first a status inflicting move, then a status lowering move. Once both have been implemented, will attack normally.

If Pokemon has higher offenses, will skip status lowering abilities unless enemy defenses/offenses are unusually high, using the status inflicting move to lower the stat. Will use a move that inflicts paralysis to lower speed, or a speed dropping move, but will not use status effecter if misses more than twice.

Both examples will use foresight or Odor sleuth if player has used Double Team or Minimize more than twice. If they lack this move, will use a 100% accuracy move instead.

Will use recovery moves if 50% or less.

Will switch if no moves are super effective and another character in the party has a super effective offensive move, or if the trainer has no moves that will hit the enemy Pokemon (for example, if a pokemon has all normal type moves, and sing, and is facing gastly, then will switch if gastly is under a status effect). Will also switch if affected by perish song. Will not use baton pass if affected by perish song.

Tier 4:
Highest tier.


Will have the following strategies implemented, checking for moveset.

Baton Pass + Status Booster
Will boost a stat up two stages then attempt to Baton Pass.

Baton Pass + Substitute
Will set up a substitute, then attempt to Baton Pass.

Mean Look/Spider Web + Perish Song
Will use the trapping move, then perish song away.

Super Fang + Quick Attack
Will use Super Fang to half HP, then use quick attack.

Spikes + Whirlwind/Roar
Will use spikes to set up, then whirlwind or roar to cause damage onto opponents. If a status effect move is in the moveslots, such as Toxic, will try to inflict a status effect before whirlwinding again (unless already has a status effect).

Endure + Reversal/Flail
Will use endure, then use reversal for a strong final attack.

Substitute + Leech Seed
Will use substitute, then Leech Seed.

Substitute + Pain Split
Will use Substitute, then pain split (if effective).

Reflect + Light Screen
Will use both moves first, then attack. Once one goes down, will put it back up.

Broad move combinations:

If has a paralysis and flinching move, will inflict paralysis, then try to flinch.

If has a paralysis and confusing move, will inflict paralysis, then try to confuse. After confusing, will attack.


Will focus on using attacks that are the same kind (physical or special as the attacking stat of the user. If Super Effective or STAB causes more damage, then will use that move.

If User uses an attacking move twice in a row, will use counter/mirror coat depending on that move.

Will use whirlwind/Roar if user is using stat booster to set up.

Will use Heal Bell if any Pokemon has a status effect, but will not use the move every turn.

Will use recovery move if HP is below 50%, but will not use a recovery move three times in a row.

FROM THERE

If Pokemon has higher defenses than offenses, begins with first a status inflicting move, then a status lowering move. Once both have been implemented, will attack normally.

If Pokemon has higher offenses, will skip status lowering abilities unless enemy defenses/offenses are unusually high, using the status inflicting move to lower the stat. Will use a move that inflicts paralysis to lower speed, or a speed dropping move, but will not use status effecter if misses more than twice.

Both examples will use foresight or Odor sleuth if player has used Double Team or Minimize more than twice. If they lack this move, will use a 100% accuracy move instead.

Will switch if no moves are super effective and another character in the party has a super effective offensive move, or if the trainer has no moves that will hit the enemy Pokemon (for example, if a pokemon has all normal type moves, and sing, and is facing gastly, then will switch if gastly is under a status effect). Will also switch if affected by perish song. Will not use baton pass if affected by perish song. Will switch out if trainer has a strong defensive pokemon with at least a 0.5x damage multiplier from the current move, if Pokemon is below 33% HP. Will switch out if an initially fast pokemon has paralysis, or an initially physically strong pokemon has a burn. Will automatically switch out if Pokemon is frozen. If Pokemon does not have Snore or Sleep Talk, will switch out if Asleep. Will switch out from Toxic Poison after three turns or if HP is below 33%.
Since you guys are totally into Competitive battling I would assume you guys would be really good at helping develop the AI for my game. Feel free to add more AI tiers, and add explanations onto whatever this or that strategy that you have. I really appreciate any input that I can get. Thanks!
 
I have a few suggestions for the AI to use (note that my various levels of use are just for that move, you may have them coincide with your AI levels however you want):
Level 1: May use rapid spin randomly if it or its side is affected by something it removes.

Level 2: Will only use Rapid Spin if affected by a partial-trapping move or entry hazards, or if it wants to attack and rapid spin is its only attacking move that can deal damage.

Level 3: Will always use rapid spin if affected by a partial-trapping move or entry hazards. It will switch to a pokemon that can use rapid spin if the foe is lawing down entry hazard, or upon being released by a partial-trapping move, getting hit again, and released again. Will Baton Pass, U-turn, or Volt Switch out if it can.

Level 4: Will always use rapid spin if affected by a partial-trapping move or entry hazards. It will switch to a pokemon that can use rapid spin if the foe is lawing down entry hazard, or upon being released by a partial-trapping move, getting hit again, and released again. Will Baton Pass, U-turn, or Volt Switch out if it can. If the foe has a pokemon with Rapid Spin and there are entry hazards/partial trapping moves, it may (high chance) switch to a Ghost-type.

Level 1: May randomly use entry hazards. Won't try to lay down 2 stealth rocks, 4 spikes, or 3 Toxic Spikes.

Level 2: Will use entry hazards unless the foe's active pokemon has magic bounce, the foe has one pokemon left, or there already is the maximum amount of layers present on the foe's side of the field.

Level 3: Uses entry hazards unless the foe's active pokemon knows rapid spin or has magic bounce, or the entire foe's team has Magic Guard, or the foe has only one pokemon left. Will not use toxic spikes if all of the foe's remaining pokemon are immune to being poisoned, flying-types or levitating, or have Magic Guard, or if there are already two layers of toxic spikes. Will not use Stealth Rock if the foe has one pokemon left, or the foe's active pokemon has magic bounce, or if the foe's entire team has magic guard, or if there is already stealth rock. Will not use Spikes if all of the foe's remaining pokemon are flying-types or levitating, or if there are already 3 layers of Spikes, or if the foe has only one pokemon left, or the foes active pokemon has Magic Bounce.

Level 4: Same as level 3, but it will also switch in a pokemon with Magic Bounce if the foe is laying down entry hazards. It may also skip a turn and use an attack if the foe has an Espeon, Natu, or Xatu.

Level 1: Is completely ignorant.

Level 2: If the pokemon has one ability, it knows the ability. If its hidden ability is unreleased, it rules out the hidden ability. Beyond that, it assumes that all foes have no ability.

Level 3: If the pokemon has one ability, it knows the ability. If its hidden ability is unreleased, it rules out the hidden ability. Beyond that, it assumes that all foes have all abilities until an ability gets revealed, at which point it assumes that the foe has only that one ability.

Level 4: If the pokemon has one ability, it knows the ability. If its hidden ability is unreleased, it rules out the hidden ability. Beyond that, it assumes that all foes have their best ability (Magic Guard on Espeon, Justified on Lucario, Huge Power on Azumarill, etc.) unless it is revealed otherwise.


Level 1: May randomly use it.

Level 2: Will use it if the foe knows a move that does a lot of damage to it.

Level 3: Same as level 2, but will not use it if the foe is slower, or the move has negative priority.

Level 4: Will not use Metal Burst if the user outspeeds unless the foe's best move has raised priority, or if the foe's active pokemon can KO it. Also won't use Metal Burst if the foe's move has negative priority or if it has an attack that can do as much or more damage. Furthermore, it will intentionally use Sturdy with Metal Burst (Aggron and Shieldon evolutionary lines only) against pokemon with strong fight or ground-type moves.


I also suggest that higher-level AIs should be able to identify FEAR users and not go for straight-out attacks against them, but instead use indirect damage to break sash/sturdy before attacking unless the active pokemon knows a negative priority move, in which case it will use the negative-priority move, or if the active pokemon moves after the FEAR user, or if the active pokemon knows a multi-hit move. Furthermore, it will intentionally use FEAR correctly if there are no entry hazards (spikes/toxic spikes ignored for flying-type FEAR users) or other residual damage (Sandstorm ignored for Archen and Aron, all weather ignored for Swinub), and if the foe lacks a multi-hit move.
 
Good ideas, Mulan. The game only has G/S/C's moves right now but I plan to extend it to B/W eventually.

Right now I only have Level 1 up which is simply making sure it doesn't use a move that won't work (recover at full HP, stun spore if already having a status effect), and if using an attack, to blindly use the most powerful option (meaning they will likely never even use rapid spin). But these are really good suggestions for higher tiers. I'm doing other things at the moment but I'm taking note of this. I especially like your note on FEAR users, I think identifying those shouldn't be too hard (since they usually are at level 1 and are usually specific Pokemon).
 
Good ideas, Mulan. The game only has G/S/C's moves right now but I plan to extend it to B/W eventually.

Right now I only have Level 1 up which is simply making sure it doesn't use a move that won't work (recover at full HP, stun spore if already having a status effect), and if using an attack, to blindly use the most powerful option (meaning they will likely never even use rapid spin). But these are really good suggestions for higher tiers. I'm doing other things at the moment but I'm taking note of this. I especially like your note on FEAR users, I think identifying those shouldn't be too hard (since they usually are at level 1 and are usually specific Pokemon).
FEAR users do not have to be level one. They just have to be significantly lower than level 100 for it to work. However, there are specific pokemon, so it could just be any of those pokemon around or below level 75 or so and it could be FEAR.

I have used a FEAR pokemon at a higher level, and it turned out like normal FEAR would.
 
Oh, okay. I haven't been competitively battling for a loooong time so I guess I missed a common misconception or something. Thanks!
 
How about making the level one AI switch as frequently as in-game opponents do? Just randomly switching, not using strategy or anything.
 
How about making the level one AI switch as frequently as in-game opponents do? Just randomly switching, not using strategy or anything.
Umm...I don't recall in-game opponents switching much, unless it's really strategic. That's why Toxic stall and stuff is so effective in-game.
 
Umm...I don't recall in-game opponents switching much, unless it's really strategic. That's why Toxic stall and stuff is so effective in-game.
Yeah, I think (outside of battle areas) they only switch very rarely, and never because of a strategic reason. That is what I was talking about. In battle areas, though, they will switch if they lack an effective attack or status move, or are locked into a move the opponent is immune to by a choice item or encore, or have their only effective move disabled, etc.

Also, toxic stall isn't very viable as you have completed almost, if not more than, half of the main story before you get toxic (unless you do a lot of grinding) in every game, and most users aren't too bulky until much later.
 
Hi, didn't have any idea where to put this (feel free to move this if you need to, Mods), but basically in short I'm developing a Pokemon Port for blind people, ...
Oh, really? I'm blind, and I'm more or less able to play the "normal" Pokemon games. Never tried the simulators, though (being "just" an online app, Pokemon Showdown should work with screen readers, I suppose. I was able to watch some battles, but never tried battling myself). I'm interested in your game. How are you going to handle the game text? Recorded spoken messages?

No it's not a ROM hack, it's being developed in GM8.1 ....
A quick Google search showed me that Gamemaker 8 games can run on Wine under non Windows systems (I use Linux). I hope your game does, too.
 
Oh, really? I'm blind, and I'm more or less able to play the "normal" Pokemon games. Never tried the simulators, though (being "just" an online app, Pokemon Showdown should work with screen readers, I suppose. I was able to watch some battles, but never tried battling myself). I'm interested in your game. How are you going to handle the game text? Recorded spoken messages?
I'm doing a ton more updates on the thread on Audiogames.net if you're interested, but fixing the bugs are top priority.

A quick Google search showed me that Gamemaker 8 games can run on Wine under non Windows systems (I use Linux). I hope your game does, too.
I haven't tested it in Wine, but if Wine is compatible with SAPI5 and DLLs it should work.
 

Users Who Are Viewing This Thread (Users: 1, Guests: 0)

Top