Polytopia RL
A reinforcement learning platform for The Battle of Polytopia — a turn-based strategy game with complex decision spaces, multi-agent competition, and hundreds of possible actions per turn.
The project includes a Java game engine, a real-time Python bridge via Py4J, and a standard Gymnasium environment compatible with any RL algorithm. Built at HackMIT.
Architecture
- Java Game Engine Full headless simulation — units, cities, tech trees, combat, terrain, and resources.
- Py4J Bridge Real-time Java-Python interop. Actions in, observations out, every tick.
- Gymnasium Environment Standard reset() / step() / render() API. Compatible with PPO, DQN, and other RL algorithms.
- Web Visualizer Live game playback, step-through controls, video recording, and JSON export.
Tech Stack
Java
Python
Py4J
Gymnasium
PyTorch
CleanRL
Pillow
Docker
Open the simulator →