Combat Kernel

Deterministic tick-stepping combat — physics-grounded weapon dynamics, skill contests, injury accumulation, and formation resolution.

What this uses

src/sim/combat.ts src/sim/kernel.ts src/sim/weapon_dynamics.ts src/sim/injury.ts src/sim/skills.ts src/sim/grapple.ts src/sim/formation.ts src/sim/formation-combat.ts src/sim/ranged.ts src/sim/morale.ts src/sim/mount.ts src/sim/seeds.ts docs/use-case-validation.md

Combat resolution is pair-based and deterministic. Given the same worldSeed and command sequence, every fight produces identical tick-by-tick outcomes. Injury is physical — based on energy transfer, region coverage, and anatomical tolerances — not a simple HP pool.

Tick step phases

Intent resolve action queue,
stance, target lock
Skill contest attack vs defence,
resolveHit()
Energy calc weapon KE,
armour absorption
Injury surface / internal /
structural damage
Vitals shock, fatigue,
consciousness
Conditions bleeding, fracture,
morale, grapple

Each tick advances all entities simultaneously. There is no turn order — simultaneous resolution is inherent to the fixed-point tick model at 20 Hz by default. Adjust tickRateHz in session config for tactical vs real-time resolution.

Your saved archetypes

Archetypes created in the Body Plan Editor or Species Forge are persisted to localStorage and shown here. Import a saved archetype to inspect its combat parameters, or create a new one.

+ Body Plan Editor + Species Forge

To add a new archetype to the codebase: export as JSON from Species Forge, add it to src/archetypes.ts, write a test in test/archetypes.test.ts, then open a pull request ↗ with the title feat: add [NAME] archetype.

Archetype explorer — built-in profiles

Select an archetype to view typical combat parameters. Values derived from built-in archetypes. For a live 1v1 duel, see the Playground →

Fighter
🏹Archer
👊Brawler
🛡Knight
strength
q(0.72)
speed
q(0.65)
skill
q(0.70)
armour (chest)
q(0.35)
ParameterValueNotes
mass_kg80 kgaffects KE at charge
weaponarming_sword800 g, 30 J typical strike
reach_Sm80 0008 m max (incl. weapon)
fearThreshold_Qq(0.35)morale break threshold

Try this

  1. Open the Playground for a live pre-computed 1v1 duel with configurable archetypes, weapons, and seeds.
  2. Step through a fight in the Visual Debugger to inspect per-tick entity state.
  3. Run npm run run:trace-attack in the repo to trace a single attack through the full kernel pipeline.
  4. See src/sim/combat.ts:resolveHit() for the skill-contest resolution and energy-transfer calculation.
  5. Vary worldSeed in createSession to explore outcome distributions — same archetypes, different results per seed.