reikhelm/README.md
Parley Hatch 5055feb4c3 feat(combat): deterministic combined-pool combat engine + sim + analysis
Build the full combat-system experiment from its spec, no slices deferred.

combat-core — pure, headless, deterministic engine (the single source of truth):
- One combined Vigor pool (HP+mana+stamina merged) with the two-axis
  (fill, ceiling) cost model; offense spends survival.
- Stagger cascade (absorbed/dazed/unconscious/dead), capacity = current fill,
  ceiling collapse via fatigue as the real loss condition; revive-on-recovery.
- Unified ability model (skills == spells) with the delivery+effects+potency+
  targets cost composer and a full effect library (fill/ceiling damage, DoT/HoT,
  regen-sabotage, fatigue-amp, mitigation buff/debuff, recovery).
- Ordered mitigation pipeline, config-driven con curve, competency/fizzle/resist,
  loadout/memorization, active-defense windows.
- Symmetric actors; pluggable controllers (SwingOnCooldown, ScriptedPlayer{skill},
  HoldAndPunish). Fixed-tick loop with the canonical within-tick resolution order;
  decisions are simultaneous within a tick so mirror matches are fair.
- Determinism is load-bearing: vendored order-independent RNG fork (+ integer
  chance_bp so no f64 touches the hot path) and integer fixed-point magnitudes
  with banker's rounding. 48 tests incl. bit-reproducible event-log integration.

combat-sim — batch harness: loads the config "table", runs con-tier x skill and
archetype sweeps (tens of thousands of fights), exports per-fight CSV, an
aggregated summary, and one fight's full event log.

analysis — pandas/matplotlib layer: difficulty curve, duration tent, anti-turtle
guardrail, stagger frequency, and one fight's fill/ceiling time series.

The sim did its job: the first default numbers produced a one-tick cliff and 82%
mutual-KO draws and surfaced the spec's deepest risk live (a poke skill strictly
worse than free auto-attack, so auto-only out-won the full kit). Tuning the table
moved it to the intended shape — duration tent peaking ~22s at even con, a
monotone skill->win-rate gradient (auto ~3% -> skill100 44% at even con), and a
green anti-turtle guardrail. That sim->measure->tune loop is the deliverable.

Own Cargo workspace, fully decoupled from the root reikhelm workspace.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 12:13:04 -06:00

2.8 KiB
Raw Permalink Blame History

reikhelm

A sandbox for game-system experiments. No single end goal — each idea is its own self-contained system, built to learn and to see something cool run. The best ones might get blended into an actual game someday; until then it's just shipping for fun.

How this repo works

  • One experiment per top-level folder. Each is meant to stand on its own.
  • Mix and match freely. When two systems are worth mashing up, write glue code between them. It doesn't have to be pretty.
  • Rust or Python, whatever fits the idea. Rust experiments can be standalone Cargo projects or join the workspace below for easy path-dependency glue.

What's here so far

Procedural dungeon generator (Rust)

A deterministic 2D map generator built from small composable passes over a shared context (BSP → rooms → caves → connect → corridors → doors → pools → pillars → entities). Towns/dungeons are different recipes drawn from one primitive vocabulary (Partitioner / Shaper / Connector / Placer / Decorator).

  • reikhelm-core/ — pure generation library, no rendering deps (the Map struct is the contract; renderers own all art).
  • reikhelm-wasm/wasm-bindgen bridge that compiles core to wasm32.
  • reikhelm-viz/ — original macroquad renderer (frozen — kept, not maintained).

Browser playground & first-person explorer (JS + Canvas)

  • reikhelm-web/ — live procgen playground (reroll / seed / config sliders / per-pass scrubber) in an atmospheric torch-lit style, plus a top-down and a first-person (Eye-of-the-Beholder style) renderer and a walkable explorer.

AI-render → pixel-art pipeline (Python)

  • tools/ — depth map → local diffusion render (Z-Image on the LAN workstation) → FloydSteinberg dither through a 256-color palette → signature pixel art. See tools/README.md.

Combined-pool combat system (Rust + Python)

  • combat/ — a deterministic, headless combat engine built on one combined Vigor pool (HP + mana + stamina merged), so offense literally spends your survival. Sim-first: a pure Rust core (combat-core) + a batch sweep harness (combat-sim) that runs tens of thousands of fights and exports metrics, plus a Python analysis layer that measures "feel" (difficulty curve, fight duration) instead of eyeballing it. Its own Cargo workspace. See combat/README.md.

Building

# Rust workspace (host-native crates)
cargo build            # builds reikhelm-core + reikhelm-viz
cargo test

# Browser playground (wasm)
wasm-pack build reikhelm-wasm --dev --target web \
  --out-dir ../reikhelm-web/pkg --out-name reikhelm_wasm
python3 -m http.server 8011 --directory reikhelm-web

~/.cargo/bin may not be on the non-interactive shell PATH — prepend export PATH="$HOME/.cargo/bin:$PATH" to cargo commands if they're not found.