Skip to main content

High-performance card game environment

Project description

Essence Wars

A deterministic, perfect-information strategy card game

Try in ColabQuick StartFeaturesProject StructureDocumentationContributing


Try it in Google Colab

Want to build an AI agent for Essence Wars? Jump right in — no setup required:

Notebook Description
Open In Colab Quickstart — Explore the game engine, play games, see the API
Open In Colab Train a PPO Agent — Build and train a neural network to play
Open In Colab Evaluate & Benchmark — Test agents against built-in bots

What is Essence Wars?

Essence Wars is a strategic two-player card game engine with a focus on:

  • Perfect Information — Both players see all cards, including hands and decks. Victory comes from outthinking your opponent, not luck.
  • Deterministic Execution — Seeded RNG ensures every game is reproducible.
  • Lane-Based Combat — Creatures occupy board positions, creating spatial strategy alongside card selection.

Gameplay

Features

Desktop Application

Full-featured Tauri desktop client with Human vs AI, Spectator mode, Replays, and Deck Builder.

Main Menu Spectator Mode Deck Builder

AI & Machine Learning

  • Multiple Bot Types — Random, Greedy (28 tunable weights), MCTS, Alpha-Beta search
  • Python ML Framework — Gymnasium/PettingZoo environments, PPO, AlphaZero, Game Transformer
  • Training Infrastructure — Callbacks, experiment tracking, W&B integration

Claude Code Integration

Play Essence Wars directly in Claude Code via MCP (Model Context Protocol):

  • Natural language game control
  • AI move recommendations with analysis
  • Live game visualization in Tauri UI (Launch the Essence Wars UI App, and ask Claude to sync, watch her play the game live in the App!)

Quick Start

Play the Desktop App

# Clone and build
git clone https://github.com/christianWissmann85/essence-wars
cd essence-wars
cargo build --release

# Launch the UI
cd crates/essence-wars-ui
pnpm install && pnpm tauri:dev

Train Your Own AI Agent

The fastest way to get started is the Colab notebooks above. For local development:

# Install Python package
uv pip install essence-wars[train]

# 1. Train a PPO agent
uv run python python/scripts/training/ppo.py --timesteps 500000

# 2. Export to ONNX (the training script prints the exact command to use)
uv run python -m essence_wars.agents.export_onnx \
  experiments/ppo/<your_run>/best_model.pt \
  ~/.essence-wars/agents/my_agent.onnx

# 3. Play against it in the CLI
cargo run --release --bin arena -- \
  --bot1 greedy --deck1 architect_fortify \
  --bot2 "neural:$HOME/.essence-wars/agents/my_agent.onnx" --deck2 archon_burst \
  --games 100

Exported .onnx agents in ~/.essence-wars/agents/ are also automatically available in the desktop app's bot selection menu. See the Python README for the full guide.

Play via Claude Code (MCP)

Add to your .mcp.json:

{
  "mcpServers": {
    "essence-wars": {
      "command": "./target/release/essence-wars-mcp"
    }
  }
}

Then in Claude Code: "Start a game with the Iron Wall deck against Swarm Aggro"

Project Structure

essence-wars/
├── crates/
│   ├── cardgame/           # Core game engine (Rust)
│   ├── essence-wars-ui/    # Desktop app (Tauri + Svelte)
│   └── essence-wars-mcp/   # MCP server for Claude Code
├── python/                 # ML agents & training (PyTorch)
├── data/
│   ├── cards/              # Card definitions (YAML)
│   ├── decks/              # Deck definitions (TOML)
│   └── weights/            # Bot weight files
└── docs/                   # Documentation
Component Description README
cardgame High-performance game engine, bots, CLI tools README
essence-wars-ui Cross-platform desktop client README
essence-wars-mcp MCP server for Claude Code README
python ML agents, training, benchmarking README

Three Factions

Faction Identity Keywords
Argentum Combine Defense & durability Guard, Shield, Fortify, Piercing
Symbiote Circles Aggressive tempo Rush, Lethal, Regenerate, Volatile
Obsidion Syndicate Burst damage Lifesteal, Stealth, Quick, Charge

Plus Neutral cards and 12 unique Commanders with passive abilities.

Documentation

Game Design

ML & AI

Development

Performance

Metric Value
Random games ~23,700/sec
Greedy bot games ~1,500/sec
MCTS (100 sims) ~18.6 ms/move
MCTS parallel (8 trees) ~9.3 ms/move
Alpha-Beta depth 6 ~1.4 ms/move
Engine state clone ~404 ns
State tensor encode ~157 ns
Greedy evaluate ~5.6 ns
Zobrist hash ~6.8 ns
Apply action (attack) ~190 ns

Run cargo bench -p cardgame for the full suite.

Commands

# Build & Test
cargo build --release                    # Full workspace
cargo nextest run --status-level=fail    # Rust tests
uv run pytest python/tests               # Python tests

# Lint
cargo lint                               # Rust (clippy)
uv run mypy python/essence_wars          # Python types
pnpm run check                           # Svelte/TS (in UI crate)

# Game Tools
cargo run --release --bin arena --       # Bot matches
cargo run --release --bin validate --    # Quick balance check
cargo run --release --bin benchmark --   # Thorough analysis
cargo run --release --bin swiss --       # Tournament mode

Contributing

Contributions are welcome! This project uses:

  • Rust for the core engine and desktop backend
  • Svelte 5 (with runes) for the desktop frontend
  • Python for ML agents and training

Each crate has its own CLAUDE.md with AI-developer context and README.md with human contributor documentation.

Development Setup

# Rust
cargo build --release

# Python (using uv)
uv sync --all-groups
uv run pytest python/tests

# UI (using pnpm)
cd crates/essence-wars-ui
pnpm install
pnpm tauri:dev

Citation

If you use Essence Wars in your research, please cite:

@software{essence_wars,
  title = {Essence Wars: A High-Performance Card Game Environment for RL Research},
  author = {Wissmann, Christian},
  year = {2025},
  url = {https://github.com/christianWissmann85/essence-wars}
}

License

MIT License — see LICENSE for details.


Built with Rust, Svelte, and PyTorch
Designed for humans and AIs alike

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

essence_wars-0.9.4.tar.gz (693.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

essence_wars-0.9.4-cp313-cp313-win_amd64.whl (927.1 kB view details)

Uploaded CPython 3.13Windows x86-64

essence_wars-0.9.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

essence_wars-0.9.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

essence_wars-0.9.4-cp313-cp313-macosx_11_0_arm64.whl (1.0 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

essence_wars-0.9.4-cp313-cp313-macosx_10_12_x86_64.whl (1.1 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

essence_wars-0.9.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

essence_wars-0.9.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

essence_wars-0.9.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

essence_wars-0.9.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

essence_wars-0.9.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

essence_wars-0.9.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

File details

Details for the file essence_wars-0.9.4.tar.gz.

File metadata

  • Download URL: essence_wars-0.9.4.tar.gz
  • Upload date:
  • Size: 693.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for essence_wars-0.9.4.tar.gz
Algorithm Hash digest
SHA256 4a52f0eb25fa7c0f728f3257d014825c09ea74f41ec274e39b141a0d7878d581
MD5 a4ee02609566e081d1d892a60b30a51f
BLAKE2b-256 1ef37b7faf64d300a279203c68be2616f5a72342d00974748a65c190f9eae2f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for essence_wars-0.9.4.tar.gz:

Publisher: publish.yml on christianWissmann85/essence-wars

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file essence_wars-0.9.4-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for essence_wars-0.9.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 dde2f15a3fefebd21167fcaaec8cae7a2cca4a6d0b060aeb798385940af5a0c7
MD5 2b370393f03b1e3f97a7ffd7e331b2c9
BLAKE2b-256 087dabaac1c7ffa62207e7dd7e8895c4b290cd012cee63bfb7d6ea80bb3f19a7

See more details on using hashes here.

Provenance

The following attestation bundles were made for essence_wars-0.9.4-cp313-cp313-win_amd64.whl:

Publisher: publish.yml on christianWissmann85/essence-wars

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file essence_wars-0.9.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for essence_wars-0.9.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7bb73fe7edcaa82bc17012163208803d8c9bce81d6d9f5595fa6518543b10e62
MD5 b04afac7d8d9c8d138b3d623452698cd
BLAKE2b-256 6989ca18a932bbb7a126732e4c3675aad15dcbd28e66bed22f8482196dd3a37e

See more details on using hashes here.

Provenance

The following attestation bundles were made for essence_wars-0.9.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on christianWissmann85/essence-wars

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file essence_wars-0.9.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for essence_wars-0.9.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 14a8ee0187d14b454fb44d6e36d0a346211e2e6da4825020a647774e6914a1cb
MD5 b4d7bf34bb35b73f1ab4e8b68016f4e5
BLAKE2b-256 6641e577ee9d64b79b08d361a15f0d3f6028651591f95515371a2cb1e143008d

See more details on using hashes here.

Provenance

The following attestation bundles were made for essence_wars-0.9.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: publish.yml on christianWissmann85/essence-wars

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file essence_wars-0.9.4-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for essence_wars-0.9.4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 359d0922996c77e01e87f440d8000828539ee7c19d4c7ff32c89152851c5a855
MD5 efdc4248fc0c1afd8c265886dfce1ba3
BLAKE2b-256 dd95e08a78c07c25742a90ec1348982a1c80e0b161fbd29364787995788860ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for essence_wars-0.9.4-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: publish.yml on christianWissmann85/essence-wars

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file essence_wars-0.9.4-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for essence_wars-0.9.4-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 f23fc181626f27beb923ad7092570e7fd75b3b71b775746b2bc8975314d43e72
MD5 aca16ad02f6ee7b2eed07f14320764a9
BLAKE2b-256 152a7cf4e7950c39417b16413fc8d3e67c7f42f2555ea98ab180e97751e6bb1f

See more details on using hashes here.

Provenance

The following attestation bundles were made for essence_wars-0.9.4-cp313-cp313-macosx_10_12_x86_64.whl:

Publisher: publish.yml on christianWissmann85/essence-wars

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file essence_wars-0.9.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for essence_wars-0.9.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0fe0635b84a741fff4bcd84f292c96795c666dad2feefca93ddab1680429a042
MD5 84078717cee318f0626bb94012953cc7
BLAKE2b-256 e7e1ddbeb89609a353b677fde51cc6ce91c87165247d43a03594eda7b8200ec1

See more details on using hashes here.

Provenance

The following attestation bundles were made for essence_wars-0.9.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on christianWissmann85/essence-wars

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file essence_wars-0.9.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for essence_wars-0.9.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 7ca1b5a6b8c1523d85921040c0e607e9a5c3e1116e1c5d702f7797ebe47ca0d2
MD5 9cd3dfb0da7ea405922272b7deb07854
BLAKE2b-256 5bb1d033c1af027a45016ea9d3738e739d6173e6e30bf20fda867e13611ca474

See more details on using hashes here.

Provenance

The following attestation bundles were made for essence_wars-0.9.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: publish.yml on christianWissmann85/essence-wars

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file essence_wars-0.9.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for essence_wars-0.9.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 21bfb05ac2e897774d50ddd42ce797d938ae7b86a164c3f475666efa40cdff10
MD5 c99d0e04cd8bb441a67d23f1ac2bf49d
BLAKE2b-256 81ff4ab81b00c92258a3a26de0a0f79a42e17fcff156c4ef705977bb1939289d

See more details on using hashes here.

Provenance

The following attestation bundles were made for essence_wars-0.9.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on christianWissmann85/essence-wars

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file essence_wars-0.9.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for essence_wars-0.9.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 793dfb39bc6f7389643b5e0e47de04d545b60c49d4be5b5b8773507759f7ce40
MD5 bc3b80e780a7af41ccb7a5e212eb9776
BLAKE2b-256 52b4e8720700aae72c123b8ea10d7e5a2259c5385cd8a9fcfad5ee20963afd81

See more details on using hashes here.

Provenance

The following attestation bundles were made for essence_wars-0.9.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: publish.yml on christianWissmann85/essence-wars

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file essence_wars-0.9.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for essence_wars-0.9.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9f63aee57d3a27af181833e85a43f5225d743232c3243d25ad0ca124441f6a77
MD5 93a02594db8dcd1eead7c1788d7e2099
BLAKE2b-256 8a56460340021ad2082e51cb66e9badb701e180cb4495d9605f79f117b9d47ea

See more details on using hashes here.

Provenance

The following attestation bundles were made for essence_wars-0.9.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish.yml on christianWissmann85/essence-wars

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file essence_wars-0.9.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for essence_wars-0.9.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 839fb16c4a692ca420d8c0d876a84916be7ad19b894cc648ef65a2737e8283b1
MD5 a3b7fa8e953d8a297aef492c6cc6bf5c
BLAKE2b-256 5785bd71347b981eeae8e79a103968820088ed7b6ed8a5680255f32fd3e751d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for essence_wars-0.9.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: publish.yml on christianWissmann85/essence-wars

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page