Follow our Instagram!
Curious about what we're currently doing about bots? Check out the latest updates from staff in this thread.
Welcome to Smogon! Take a moment to read the Introduction to Smogon for a run-down on everything Smogon, and make sure you take some time to read the global rules.

Ninjask: an open-source Champions VGC simulator with exact Showdown parity, for training bots and research

Hi folks! I've been working on a VGC bot, and the first thing I needed was a battle simulator that's both fast enough to train on and faithful to Showdown. A few people here have mentioned building something like that as part of similar projects, but as far as I can tell nobody has posted a public repo. So I'm publishing mine, and I'd love to build it out with the community.
Quick start
Code:
pip install ninjask
Python:
import ninjask
from ninjask.policy import RandomPolicy

team1, team2 = ninjask.verification_teams()[:2]   # bundled test teams (Showdown packed format)
result = ninjask.play_engine_game(
    "gen9championsvgc2026regmc", 1, team1, team2, RandomPolicy(1), RandomPolicy(2)
)
print(result.winner, result.turns)
A policy is anything with choose(request, log) -> str. It reads Showdown's request JSON and answers in Showdown's choice syntax ("move 1 1, move 2 2"). The README has the full loop, the Rust API, and how to run the parity checks yourself.

What it is (and isn't)
Ninjask is a simulator, not a bot. It can't play a game on its own: there's no agent, no policy and no weights in the repo. It's the environment underneath one. You can use it to train an agent with self-play, run search, or answer questions that take millions of battles (team matchups, how often a line works, damage and speed odds). I'm sympathetic to the concerns about posting trained weights publicly, and this deliberately stays on the tooling side of that line. I know

It's a Rust port of Showdown's battle code for Champions doubles (Reg M-C, with M-B and the custom game bundled), with Python bindings. Besides the battle itself it has:
  • Showdown's request JSON and choice syntax throughout, so code written for a Showdown bot carries over with little change
  • a per-player tracker that builds what one side knows from the protocol, and reads Showdown's live logs the same way
  • "worlds": battles consistent with one player's view, with the foe's hidden sets filled in by your assumptions, for search under hidden information
  • an exact damage and turn-order calculator that runs the battle's own damage code

Parity first
Other projects have traded some parity for speed. For example, PokaiEngine in Max Yu, "PokaiTrainer: Scaling Equilibrium Search to Competitive Pokémon VGC" (arXiv:2608.29197) enumerates each joint action's full outcome distribution in one pass, at about 99% parity with Showdown. Right now, Ninjask takes the other side of that trade-off and matches Showdown exactly.

In reference mode it uses Showdown's own random number generator and makes the same draws in the same order, so a seeded game produces the same log, the same requests and the same state after every input. That's checked game by game against Showdown at a pinned commit. Before release it matched 10,000 of 10,000 games on 766 teams players have shared publicly, most with tournament results (collected by VGCPastes, thank you!), and 10,000 of 10,000 games of random legal teams under a fresh seed, and CI checks every change against Showdown.

Even at exact parity it's about 6,000 random games (roughly 60,000 turns) per second on one CPU core, about 200 times Showdown on the same machine. It may well be slower than an engine that gives up some parity, but there's no public engine to compare against, so I don't know. Measuring that trade-off, and finding out how much parity actually matters for training, seems like a great area for further research.

Where I'd love help
  • Divergences from Showdown. Any mismatch is a bug, however small. scripts/check_reference.py --verbose prints both simulators' logs and random draws at the first difference, which is usually all that's needed for a report.
  • New regulations as they launch. Most of a regulation is data exported from Showdown; only new mechanics need code.
  • Exact chance-outcome enumeration for search and endgame solvers, kept at full parity.
  • Speed: faster batched bindings for training loops, and benchmarks against other engines.
  • Bindings for other languages.
Issues and pull requests are welcome; the CONTRIBUTING file covers the setup and the checks a change has to pass. I'd also just like to hear what you're building with it.

A note on how it was made
Most of the code was written with AI, with me directing, reviewing and testing it. But fast development at this quality is only possible because Pokémon Showdown itself is a precise, human-written spec to port and test against. So the majority of the credit belongs to the Showdown developers, whose engine this reproduces log line for log line. The repo ports their code (MIT) and credits it in its NOTICE file.
Back Top