Installation
Install the Pokemon Showdown package from npm:Key Features
Stream-Based API
The simulator uses an ObjectReadWriteStream architecture for battle I/O
Multiple Formats
Support for all official Pokemon formats including Random Battles, OU, Ubers, and VGC
Team Management
Generate, validate, and convert teams between multiple formats
Language Agnostic
Access via Node.js API or command-line interface for any programming language
Architecture
The battle simulator is implemented as anObjectReadWriteStream where:
- Write: Player choices (strings) are written to the stream
- Read: Protocol messages (strings) are read from the stream
Core Components
Battle
The internal battle state engine that processes moves, calculates damage, and applies game mechanics
Quick Example
Here’s a minimal example of starting a battle:In random formats like
gen9randombattle, teams are automatically generated if not provided.Message Protocol
All messages written to the simulator start with> followed by a command:
>start OPTIONS- Initialize a battle with format options>player PLAYERID OPTIONS- Set player information>p1 CHOICE/>p2 CHOICE- Submit player choices
Use Cases
Battle Simulation
Run automated battles for testing, AI development, or analytics.Team Building Tools
Validate team legality and convert between team formats.Bot Development
Create bots that can play Pokemon Showdown battles programmatically.Research & Analytics
Analyze battle mechanics, test strategies, and gather statistics.Command-Line Interface
For non-JavaScript languages, the simulator is accessible via standard I/O:Next Steps
Usage Guide
Learn how to use the simulator API in detail
BattleStream API
Explore the BattleStream interface and player streams
Team Formats
Understand team formats and conversions
Battle Formats
Browse available battle formats
