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, Deck Builder, and Tutorial.

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

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.2.tar.gz (682.0 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.2-cp313-cp313-win_amd64.whl (930.6 kB view details)

Uploaded CPython 3.13Windows x86-64

essence_wars-0.9.2-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.2-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.2-cp313-cp313-macosx_11_0_arm64.whl (1.0 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

essence_wars-0.9.2-cp313-cp313-macosx_10_12_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

essence_wars-0.9.2-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.2-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.2-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.2-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.2-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.2-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.2.tar.gz.

File metadata

  • Download URL: essence_wars-0.9.2.tar.gz
  • Upload date:
  • Size: 682.0 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.2.tar.gz
Algorithm Hash digest
SHA256 1b33b81b5a2a85ace8a28a31d5e1747383105a7fb935f253feda707b692b87ae
MD5 84249f4ca48a1260adb617482a3e8d1f
BLAKE2b-256 9149e70d2d9dc51e68af8868202d59c9269c42cf4614975694d823afa0c0c4cd

See more details on using hashes here.

Provenance

The following attestation bundles were made for essence_wars-0.9.2.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.2-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for essence_wars-0.9.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 ae18b68fe4052d0a2791408cf20e3415ff0c0c28d76b1b48f92c424f5dc14ae1
MD5 e11eed720ee4202b632834df673388df
BLAKE2b-256 7f486afce8243866b18b151f13fa9f0487954579bd6abb86909af8f4052705d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for essence_wars-0.9.2-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.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for essence_wars-0.9.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 99fe5b35c7424df1bece5ad6539115f4c8069c80e6b94b2fc0c8c3ccdfebb7fd
MD5 248579c96c20c257f331c8ad020c38f5
BLAKE2b-256 e185201b5c8ccd58bee1e6b481e350641d2e34018d8663d9e523fb71d7154cbd

See more details on using hashes here.

Provenance

The following attestation bundles were made for essence_wars-0.9.2-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.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for essence_wars-0.9.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e5b7624da7aa6f0eee04a3771780c8d43a83d7d3f833931a0e355f1f642ff50e
MD5 7eaf5a1e12ec29fe1af650e9e671c0d8
BLAKE2b-256 c7ac90932c345e6a49b9cd92f11913f2a921ff9eefb63183b3e1af7893cacd69

See more details on using hashes here.

Provenance

The following attestation bundles were made for essence_wars-0.9.2-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.2-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for essence_wars-0.9.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cebdedfe5c41cab508dd5a95b907efe40fd09a845828fe5e7dcb978af448a3f6
MD5 8c7fc41d39022488b25c20c579cb0c17
BLAKE2b-256 48d28fb715abba611e3eb278ffbce8c42b5989524e0f7d5eebb87c71990abee2

See more details on using hashes here.

Provenance

The following attestation bundles were made for essence_wars-0.9.2-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.2-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for essence_wars-0.9.2-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 04aa68c0cbd68c3ba8b5fccbd711cdf584dfe079fe2a1c924b2555f488e9534c
MD5 c379fe265caf701f71e1933d417486e7
BLAKE2b-256 c039c0f74250874319e9042ed6fec7a9c02ca551943f6954519e24c12657950c

See more details on using hashes here.

Provenance

The following attestation bundles were made for essence_wars-0.9.2-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.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for essence_wars-0.9.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c8c924f7a58d9f881a06911768be5da34e1a16d2ff15aa57911e88a1f8de3577
MD5 d3cc06d8b25d0813172fffccebd581c9
BLAKE2b-256 add1e9b68e7bc4fa99147829bc200ce9ab566e789fbe52c822ce09354aaba28b

See more details on using hashes here.

Provenance

The following attestation bundles were made for essence_wars-0.9.2-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.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for essence_wars-0.9.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 57519aa3ffc57362fecce40ca5afa0bf799f36f73d8c4a77b434d92cac3464fb
MD5 77bf85e26c27b47b682b3b5cf377b75c
BLAKE2b-256 efaeef2ed0f835a326d3fdd6f45482cc6840bb8c5e34012c452ddd070638fdc2

See more details on using hashes here.

Provenance

The following attestation bundles were made for essence_wars-0.9.2-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.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for essence_wars-0.9.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d59056b35b9976d73e7b9fc5da22a9859ff4551b47947aa4cb88d3c31435f09d
MD5 35f9ecf7a3d81c13cc6b2c0b2174ebb3
BLAKE2b-256 d6f5cac98a725c581d4bb57b7294bafdf0818b1601019f91c5984d2019f51b92

See more details on using hashes here.

Provenance

The following attestation bundles were made for essence_wars-0.9.2-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.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for essence_wars-0.9.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6c893ef577d094f8558526832a4444ba678114ee9ccafd49369d16e37bd9eaff
MD5 6dcb98ae98c89b93a58df7dfb32d17f6
BLAKE2b-256 b3db199427e898cdebf2f95ce8530c48c4f9bfae05cc46678df183f5ee07ffd4

See more details on using hashes here.

Provenance

The following attestation bundles were made for essence_wars-0.9.2-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.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for essence_wars-0.9.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9ea4519cf34c818af55f98549b2b6a463f0d071b908268db77a6afb5db2d6825
MD5 669022444a012514e7badce00a6e0ee4
BLAKE2b-256 962bba1b246f99e868f6e5a5995c0f3af2e872cef136e98375b9f978786105f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for essence_wars-0.9.2-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.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for essence_wars-0.9.2-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ff37c9d255fc373d5d97fd410d81f56e79058c6851e41f4d36712005670dc946
MD5 c3e220e39cf2d5d65c06d3ca409b49ba
BLAKE2b-256 a077d67b31d7644e03ed5ae78701f2491c4f33b0ad45ba108f6f08f2b71f242d

See more details on using hashes here.

Provenance

The following attestation bundles were made for essence_wars-0.9.2-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