Skip to main content

High-performance card game environment

Project description

Essence Wars

A deterministic, perfect-information strategy card game designed for AI research

Quick StartFeaturesProject StructureDocumentationContributing


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, perfect for AI training and analysis.
  • Lane-Based Combat — Creatures occupy board positions, creating spatial strategy alongside card selection.
  • ML-Ready Design — 328-float state tensors, 256 discrete actions, and high-performance Rust engine (~33k games/sec).

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, Card2Vec
  • Training Infrastructure — Callbacks, experiment tracking, Elo ratings, HTML reports

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 ML Agents (Python)

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

# Train a PPO agent
essence-wars train ppo --timesteps 500000

# Benchmark against baselines
essence-wars benchmark --checkpoint model.pt

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

Art & Assets

ML & AI

Development

Performance

Metric Value
Random games ~33,000/sec
Greedy bot games ~4,300/sec
MCTS (100 sims) ~22ms/move
Engine state clone ~245 ns
State tensor encode ~158 ns

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.8.8.tar.gz (732.3 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.8.8-cp313-cp313-win_amd64.whl (971.2 kB view details)

Uploaded CPython 3.13Windows x86-64

essence_wars-0.8.8-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.8.8-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

essence_wars-0.8.8-cp313-cp313-macosx_11_0_arm64.whl (1.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.13macOS 10.12+ x86-64

essence_wars-0.8.8-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.8.8-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

essence_wars-0.8.8-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.8.8-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

essence_wars-0.8.8-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.8.8-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

File details

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

File metadata

  • Download URL: essence_wars-0.8.8.tar.gz
  • Upload date:
  • Size: 732.3 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.8.8.tar.gz
Algorithm Hash digest
SHA256 9ea46862929858bab5be522ff5f794c2a89cd84fd2d70a7e7b6a47454c9bec19
MD5 863753da9a87472034290e8352bbea43
BLAKE2b-256 9b28403a79bed239d38d6f15f05098195e5e521cc7fe5840a32ebcf886a1b8ea

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for essence_wars-0.8.8-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 d374cb204e53be9e4564dc5616da14c1ea9b768b8ca302a371238b79c6561c55
MD5 a1a0d9b057cbb3eba3573a70c6d5624d
BLAKE2b-256 6e6abc4bd36163317443760b30c509c04e3313b0341984d487a1620633d8e99d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for essence_wars-0.8.8-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7c91555bb3b000d28376ab932223164c51a5e9375dc6a9ee59704195278d1adb
MD5 1899fdbe691db7cb7a8c54bd7cdc8e2b
BLAKE2b-256 69f44ae33002ef19df74cc0f1675fc25eecd4fea7eaa598166af652e54dd99c7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for essence_wars-0.8.8-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 e1d0d82c4f9c4c128836ce7c4cac42d7a35731cd34b6c32784864f3747630b20
MD5 bff1e6ccaf41ece76960a69d8f576c99
BLAKE2b-256 d3f6a2163125777123471f668a8bed1600e6f566b0db222515152271651a7c61

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for essence_wars-0.8.8-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 80fa65b8ba87756c7821b17f1a4348b3cab4d6a4ad2b5adbf2f9f23b27f45fa6
MD5 d60f3a6f438e008b4f17ef34c3996ddc
BLAKE2b-256 febf5c0189b37a0474143be278ed3215cf2db5857d8b0abe595afe731b64b0cd

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for essence_wars-0.8.8-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 68b9d26219f4b701b86aa3ed8bbae17269dbb8fe8bfabc060ebf680d79d09c95
MD5 6ce625cbbc85a40e67b6dab34315772a
BLAKE2b-256 7435658d33653bdf2cc88f53eef0d67cfdceb05ab88dad3d47a5c3371d7e9446

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for essence_wars-0.8.8-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 179d4cd12ba7a47921cb35fe6af61414c0f1de0f08dc8cc12be0092d7fbaff55
MD5 2554676ed96d40314f26f1d3e571222b
BLAKE2b-256 0be3ab9c1f5e53e1b65addad5a5deaa532490a402b3c514fc8077277511c8c9d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for essence_wars-0.8.8-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 05630adb78388b8a59904bf91a14df1e685fef427295f70bd1d3f87ea1bb9a50
MD5 86b0d2c3449a614902b21f348acecae3
BLAKE2b-256 2ca66c5c506fea994d00d6bd02a697edb5b008ddab40836af5e91343f6ee425d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for essence_wars-0.8.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d0d181046180b86b1973390f73390365794524d0d95776331b6f1034935e42e5
MD5 09d97f9fe67427a2b76a11f54fcf4d14
BLAKE2b-256 0549820032c905044b799579723429ccc6e4e242e7e64621705f90b01cad542f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for essence_wars-0.8.8-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fefe40a163d3011e620e4aa4695d77affb9157e269e38a91e3472d6d05bfa971
MD5 412f1fcda4848b0b617742fac9636392
BLAKE2b-256 69204cd8ea9a58c21a3f190c5a7d28d41f2483d5a46599040c66182768b391a6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for essence_wars-0.8.8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f6480b0946c589862a90804f5fcf7dafbc73c9e6d133275d7b98eeb904ccd790
MD5 7a4fe73130107069fb5edc915e43cdb1
BLAKE2b-256 294a775c23c09b9ca920fc2db557dc1ea75b9fa5a4973800e2e40bae7d1d916e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for essence_wars-0.8.8-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b25f5121f812fccf803c7e3722ef38bd43a7abc7ea09a19a7ba7c36e9adf34bd
MD5 b6b1ae73f90b082055fa1ad9e0052161
BLAKE2b-256 8b2232bc2b0f2845547200e413688cd2fccf9ef54a0a0e79ab165027c5821b13

See more details on using hashes here.

Provenance

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