A real-time Pokemon battle simulator built with Next.js and WebSocket technology. This project implements the Pokemon Showdown battle mechanics using the official @pkmn/ps libraries, allowing players to engage in turn-based Pokemon battles with accurate game mechanics, stats, and move calculations.
- Real-time Battles: Utilizes WebSocket connections for instant battle updates and player interactions
- Pokemon Showdown Integration: Leverages
@pkmn/pslibraries for accurate battle mechanics: - Battle State Management: Client-side battle state synchronization with server
- Reconnection Handling: Graceful handling of disconnections with battle state preservation
- Real-time battle visualization and player interactions
- State management using Zustand
- Type-safe socket events with TypeScript
- Client-side battle state synchronization
- WebSocket server handling battle rooms and player connections using socket.io
- Battle engine implementation using Pokemon Showdown libraries
- Player decision processing and state management
- Battle protocol event handling and distribution
- Install dependencies:
bun install- Start the development server:
bun dev- Open http://localhost:3000 with your browser to start battling!
The battle system implements the core Pokemon battle mechanics including:
- Turn-based combat with move selection
- Pokemon switching
- Accurate damage calculations
- Status effects and weather conditions
- Type effectiveness and abilities
- Random team generation for quick battles
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.