A research-oriented framework combining high-performance systems programming and deep learning to build a real-time autonomous decision agent.
See the Comparative Study for a survey of existing Clash Royale AI projects and related deterministic simulation systems, including positioning relative to OpenAI Five, AlphaStar, and Mortal
βΆ See it run β Interactive Telemetry Dashboard β 7 real gameplay recordings processed through both pipeline modes. Frame-synced video playback with real-time latency graphs, per-slot inference decisions, and cumulative performance stats. All telemetry captured from actual Rust pipeline runs on M-series silicon.
Two Rust binaries, same model β different strategies for when to run inference. Batch mode classifies all 5 card slots every frame. Gatekeeper mode tracks pixel-level changes per slot and skips inference on cards that havenβt changed.
| Β | Batch Mode | Gatekeeper Mode |
|---|---|---|
| Throughput | 22.3 FPS | 11.6 FPS |
| Inferences/frame | 5 (fixed) | 0β5 (variable) |
| Inferences skipped | 0 | 21,304 (49%) |
| Overlay color | White (all slots inferred) | Green = locked (cached), White = unlocked |
| Live telemetry | βΆ Dashboard | βΆ Dashboard |
| Batch Track 1 | Batch Track 2 | Batch Track 3 |
| Gatekeeper Track 1 | Gatekeeper Track 2 | Gatekeeper Track 3 |
Why is gatekeeper slower for offline video? CoreML compiles optimized execution plans for fixed tensor shapes. Batch mode sends a consistent
[5, 3, 224, 224]every frame β compiled once, runs on the ANE. Gatekeeper varies the batch size dynamically, forcing recompilation. The gatekeeper targets live real-time streams where skipping 49% of inference calls saves compute, not batch processing.
π Full writeup β β architecture details, model training history, systems optimizations (Python β Rust), and build instructions.
A tick-deterministic, integer-only combat simulation engine in Rust, modeling 125+ heterogeneous agent types from 8 data-driven JSON definitions. Exposes a Python API via PyO3 for AI agent integration, replay recording, and RL training pipelines.
| Metric | Value |
|---|---|
| Agent types modeled | 178 characters, 89 buildings, 81 spells, 92 projectiles |
| Tick rate | 20 tps (50ms budget), integer-only arithmetic |
| Stress test | 3,000 concurrent agents at 29ms/tick (single M1 Pro core) |
| Parallel sims | 10,000 instances at 23.7ms batch latency (1.5ΞΌs/instance) |
| Determinism | 100Γ identical runs, bit-identical after 9,600 ticks |
| Test coverage | 28 batches, 1,900+ assertions, ~95% pass rate |
Built a hierarchical domain knowledge architecture (Global physics laws β System mechanics β Entity behaviors) layered on an AST-derived code graph, enabling systematic verification against ground-truth game data. This reduced debugging complexity by localizing faults to the correct abstraction layer (e.g., a system-level rule violation affecting 20+ entities identified once at L1 instead of repeated per-entity debugging), significantly accelerating root-cause analysis.
Complete function, struct, and call-edge graph over 38,000 lines of Rust β maintained via codebase-memory-mcp.
Engine subsystems tested: attack timing (windup/backswing state machine), splash damage, charge mechanics (Prince/Dark Prince/Battle Ram), shield absorption, death spawns (GolemβGolemites, Lava HoundβPups), building spawners (Witch, Tombstone, Furnace), champion abilities (Skeleton King graveyard, Archer Queen rapid fire, Monk deflect, Golden Knight dash, Mighty Miner lane switch), evolution abilities (Evo Knight passive shield, Evo PEKKA heal-on-kill), spell interactions (Freeze, Rage, Poison DOT, Tornado pull, Lightning top-3 targeting), projectile mechanics (homing, multi-projectile Hunter/Princess, chain lightning E-Dragon), collision separation (mass-based N-body), bridge pathing, river jumping, and full match lifecycle (regular β double elixir β overtime β sudden death).
| Writeup | Focus |
|---|---|
| Charge & Poison Modeling β | Distance-triggered charge activation, pulsed DOT with movement debuff |
| Collision & Bridge Pathfinding β | Mass-based N-body collision separation, cost-based bridge selection |
| Simultaneous Hits & Convergence β | Tick-deterministic trade resolution, collision convergence proof |
| Performance & Observability β | Scaling to 3,000 agents, 10K parallel sims, 12ΞΌs state capture |
cr-perception/: Hand-card classification β MobileNetV3 training, Rust inference pipeline (batch + gatekeeper), ONNX/CoreML deployment.cr-data-engine/: Dataset sanitization (Rust temporal deduplication engine), super-resolution upscaling (Real-ESRGAN), 4-stage augmentation suite.cr-rudy-sim/: Deterministic Rust simulator β tick engine, PyO3 Python API, 28 test batches, champion/evolution systems.cr-deck-synergy/: Attribute-based deck composition β pairwise/triple synergy measurement, cluster discovery, hierarchical deck assembly.data/: (Symlinked/Local) 309GB dataset storage (excluded from VCS via .gitignore).