All Gens Technical Machine update

obi

formerly david stone
is a Site Content Manager Alumnusis a Programmer Alumnusis a Senior Staff Member Alumnusis a Smogon Discord Contributor Alumnusis a Researcher Alumnusis a Top Contributor Alumnusis a Battle Simulator Moderator Alumnus
Hello everyone. Some of you may remember Technical Machine (old thread, older thread), the Pokemon AI. Well, it's on Pokemon Showdown now. There are still a couple of minor things left to fix with it on Pokemon Showdown (it just does random battles right now,it doesn't understand U-turn and Baton Pass when used by it, it doesn't quite understand Sleep Talk, it doesn't properly set IVs for Hidden Power), but for the most part, it works, and everything missing should be pretty straightforward to fix.

Technical Machine still only supports Gen 4. Fortunately, I am pretty much done with support for that generation, and I am pretty much done with Pokemon Showdown support.

For reference, if I say "Search to a depth of 2" or "depth = 2": Technical Machine evaluates all possible future positions (or else proves it does not need to) at least that many turns ahead. In other words, it looks at every move it can use and every move the foe can use (plus all random outcomes of those moves) not just on this turn, but also the next turn. Then it scores each position the game ends up in and determines the overall score for each move on the first turn. depth = 2 is my typical testing / debugging depth because TM plays faster than battle animations complete at that level. It seems equivalent in strength to a mediocre player at that depth, but with some teams it plays really bad and some it plays really good. At depth = 3, TM starts playing much stronger. TM can play depth = 4 in reasonable timelines if the opponent is patient (it should still stay within the PS time limits). When TM can support depth = 5, I suspect it could be the strongest player, assuming it understands the battle properly.

The roadmap consists of the following items:

1) Support all generations. I will probably do Gen 3 next due to its similarity with Gen 4. Then I will probably do Gen 1, due to its simplicity, followed by Gen 2. After that, I'll probably move forward in order.
2) Add a better way to manage understanding its data. Right now, TM is a command-line application. I want to expand on this to make it easy to explore TM's decision tree ("Why did it use Sludge Bomb there instead of Grass Knot? Oh it was afraid of you switching to Celebi. Why was it afraid of you switching to Celebi? Oh, because it was afraid of you using Leech Seed. Why was it afraid of you using Leech Seed? Oh, because it scored that branch at -630, but it only scored Recover at -100."), to be able to easily tell it who to challenge when, etc. Right now, the options are display everything in case you want to look at it (in which case it's overwhelming and hard to navigate) or print almost nothing.
3) Make it faster so I can search deeper.
4) Some other fun stuff to improve my evaluation function (translation: play better without searching deeper, possibly by being better at long-term thinking).

Anyway, as a teaser, while testing Technical Machine yesterday, I thought it battled fairly well: Gen 4 random battle with TM searching to a depth of 2. I think TM makes two major blunders this game (they should be fairly obvious), but still manages to remain competitive ;).

AI's team:
Electivire (100.0% HP) @ Focus Sash
Ability: Motor Drive
Nature: Hardy
84 HP / 84 Atk / 84 Def / 84 SpA / 84 SpD / 84 Spe
- Earthquake
- Ice Punch
- Flamethrower
- Thunderbolt
Delcatty (100.0% HP) @ Leftovers
Ability: Cute Charm
Nature: Hardy
84 HP / 84 Atk / 84 Def / 84 SpA / 84 SpD / 84 Spe
- Sing
- Return
- Thunder Wave
- Wish
Venusaur (100.0% HP) @ Black Sludge
Ability: Overgrow
Nature: Hardy
84 HP / 84 Atk / 84 Def / 84 SpA / 84 SpD / 84 Spe
- Hidden Power (remember that TM assumes this is Hidden Power Dark)
- Sleep Powder
- Power Whip
- Leech Seed
Qwilfish (100.0% HP) @ Black Sludge
Ability: Poison Point
Nature: Hardy
84 HP / 84 Atk / 84 Def / 84 SpA / 84 SpD / 84 Spe
- Thunder Wave
- Toxic Spikes
- Explosion
- Waterfall
Mightyena (100.0% HP) @ Leftovers
Ability: Intimidate
Nature: Hardy
84 HP / 84 Atk / 84 Def / 84 SpA / 84 SpD / 84 Spe
- Return
- Sucker Punch
- Super Fang
- Taunt
Mesprit (100.0% HP) @ Leftovers
Ability: Levitate
Nature: Hardy
84 HP / 84 Atk / 84 Def / 84 SpA / 84 SpD / 84 Spe
- Calm Mind
- Ice Beam
- Thunderbolt
- Psychic
 
From the website it sounds like TM's moves are completely deterministic. I suspect that will make it very bad at RBY..

But it seems like a mixed-strategy nash equilibria would completely turn that on its head and would be fairly straightforward to implement. Is there a reason you havent gone that way?
 
I just haven't done it yet. I've mostly been focusing on getting it to work on Pokemon Showdown since I've started up working on it again.
 
Had an interesting game while testing TM today. Overall, I felt like I got much luckier than TM, which TM had to play hard to overcome. TM was searching 2 turns ahead (which I would consider "easy mode" from a competitive standpoint, for testing purposes only, not serious play).

http://replay.pokemonshowdown.com/gen4ou-861086397
AI's team:
Infernape (100.0% HP) @ Choice Band
Ability: Blaze
Nature: Jolly
0 HP / 252 Atk / 4 Def / 0 SpA / 0 SpD / 252 Spe
- Close Combat
- Flare Blitz
- Stone Edge
- U-turn
Lucario (100.0% HP) @ Choice Specs
Ability: Steadfast
Nature: Timid
0 HP / 0 Atk / 0 Def / 252 SpA / 0 SpD / 252 Spe
- Aura Sphere
- Hidden Power
- Shadow Ball
- Vacuum Wave
Snorlax (100.0% HP) @ Choice Band
Ability: Thick Fat
Nature: Adamant
72 HP / 252 Atk / 32 Def / 0 SpA / 152 SpD / 0 Spe
- Body Slam
- Earthquake
- Fire Punch
- Pursuit
Scizor (100.0% HP) @ Choice Band
Ability: Technician
Nature: Adamant
252 HP / 252 Atk / 4 Def / 0 SpA / 0 SpD / 0 Spe
- Bullet Punch
- Pursuit
- Superpower
- U-turn
Scyther (100.0% HP) @ Choice Band
Ability: Technician
Nature: Jolly
0 HP / 252 Atk / 4 Def / 0 SpA / 0 SpD / 252 Spe
- Aerial Ace
- Brick Break
- Quick Attack
- U-turn
Primeape (100.0% HP) @ Choice Band
Ability: Vital Spirit
Nature: Jolly
32 HP / 252 Atk / 4 Def / 0 SpA / 0 SpD / 220 Spe
- Close Combat
- Ice Punch
- ThunderPunch
- U-turn

I was playing my paralysis "We are the Machampions" team.

To explain turn 2,
TM was looking two turns ahead to decide what to do. It was originally planning on switching in Lucario, then using Shadow Ball, but then once it actually brought in Lucario, it looked two turns ahead from there and decided that would be bad because I could bring in a predicted Gyarados or Heatran. So instead, it switches to CB Snorlax, where it predicts the worst I can possibly do is use Surf.

To explain turn 25,
TM's Infernape has a Choice Band. It sacrificed Snorlax so it could change Infernape's move from Flare Blitz to something else. I have not yet finished TM's EV predictor, so the rudimentary system I have in place predicted Starmie to be slower than Infernape, so TM thought it would just come in and kill Starmie if it stayed in. TM's analysis of this point of the game was that my team was bulky Starmie, Celebi, and Choice Scarf Heatran. It considered the principle variation (the way the game would play if both sides played ideally) to be Infernape uses Stone Edge, Starmie uses Thunderbolt (TM calculates that Thunderbolt is enough to KO). If Stone Edge gets a CH, foe replaces with Celebi. Otherwise, TM brings in Scizor.

To explain turn 28,
Notice when the fully paralyzed message appears. TM was using Pursuit.

So TM is mostly ready for real battles. There are just a couple of minor fixes left to make with regard to item and EV prediction, and a few parts of the evaluation function to tweak, but I feel like I have most of the bugs worked out. I am also now logging all of TM's battles, including TM's analysis of the battles, so that each new build of TM can work through all of the old battles to catch any new bugs.
 
Tomorrow (Wednesday) at 23:00 UTC (19:00 Eastern time), Technical Machine will be battling another Pokemon bot by pmariglia in a best of 3 random battle. Feel free to come watch (I will post another reminder here and in the Ruins of Alph chat when it happens). :)
 
Last edited:
Game 1: TM wins
Game 2: NiceNameNerd wins
Game 3: NiceNameNerd wins

Congratulations on defeating TM in the best of 3 randbat tournament, pmariglia!

I need to fix TM thinking Rest works when chosen by Sleep Talk, and I need to figure out why it uses Substitute always.
 
Back
Top