Train a reinforcement learning agent to play a Polytopia-style strategy game from scratch.
Run large-scale self-play training using the PufferLib environment for speed.
Watch or play against already-trained AI agents directly in a web browser.
Study how a game engine can be verified for correctness against a reference implementation.
| pham-tuan-binh/tribes-rl | freertos/freertos-cellular-interface-reference-quectel-bg96 | sgkdev/ptrace_may_dream | |
|---|---|---|---|
| Stars | 11 | 11 | 11 |
| Language | C | C | C |
| Last pushed | — | 2026-05-28 | — |
| Maintenance | — | Maintained | — |
| Setup difficulty | hard | hard | hard |
| Complexity | 4/5 | 4/5 | 5/5 |
| Audience | researcher | developer | researcher |
Figures from each repo's GitHub metadata at analysis time.
Training requires PufferLib and a capable GPU, the web build needs Emscripten to compile to WebAssembly.
tribes-rl is an open-source rebuild of the strategy game The Battle of Polytopia, written in C, and built specifically to train reinforcement learning agents to play it. The game rules are ported from an existing academic Java project called Tribes, and the author checked that the new C version matches it move for move using recorded reference games. The project centers on one game engine that serves two purposes. First, it runs as a fast, headless training environment using a library called PufferLib, letting many copies of the game run in parallel so an AI agent can learn by playing itself repeatedly. Second, the exact same engine is compiled to WebAssembly so it can run inside a browser, powering a website where visitors can watch trained agents play each other or play against them directly, with no server needed. The game itself is simplified on purpose: only the conquest win condition is used, maps are a fixed size with two to four players, fog of war is on, and matches end in a draw after 200 turns if nobody wins outright. The AI's decisions are broken into small steps, like picking a tile then choosing an action such as move, attack, build, or research, and the system only ever offers the agent choices that are actually legal at that moment. Training rewards are tuned to encourage winning quickly and discourage stalling or wasting resources, and performance numbers show that on a high-end graphics card, a large training run can finish in a couple of hours. The engine's correctness is checked automatically against the original Java version using stored test cases. The website itself needs no special framework, just plain JavaScript, and one trained model file works for every player count. Character sprites for the game are produced through a separate image generation pipeline included in the project. The whole project is released under the MIT license, and the game rules were ported from the Tribes project rather than copied wholesale, though the author credits it as essential to this project's existence.
A from-scratch C rebuild of the game Polytopia, built to train AI agents to play it and to let people watch or challenge them in a browser.
Mainly C. The stack also includes C, PufferLib, WebAssembly.
MIT license: use, modify, and share freely, including commercially, as long as you keep the copyright notice.
Setup difficulty is rated hard, with roughly 1h+ to a first successful run.
Mainly researcher.
This repo across BitVibe Labs
Don't trust strangers blindly. Verify against the repo.