Skip to content

feat(hands): injuries that change the fight, FINISH HIM, fatalities, dismemberment and death - #296

Merged
user1303836 merged 1 commit into
mainfrom
feature/hands-carnage
Nov 17, 2026
Merged

user1303836 merged 1 commit into
mainfrom
feature/hands-carnage

Conversation

@user1303836

Copy link
Copy Markdown
Owner

Summary

Hands gets gameplay-affecting injuries, a blood supply, a FINISH HIM phase with eight fatalities, and death. The engine decides every injury; the client shows it on the body, in what pours and flies from it, in how the fighter moves, and in the HUD, commentary, sound and haptics. Protocol version 6.

Engine

  • 24 discrete injuries (Injury, rules in combat-manifest.json section injuries): broken nose, broken jaw, jaw torn off, an eye out (each side), an ear torn off, a cheek flayed, skull fractured, shoulder dislocated, arm snapped, forearm severed, arm torn off, ribs caved in, liver ruptured, disembowelled, knee blown. Each is caused deterministically from accumulated wear and the punch that lands (one a punch, worst first, no dice) and changes how its owner fights: punch startup, impact and reach, guard leak, poise taken and its ceiling, stamina regeneration and maximum, foot speed, accuracy. A punch asked of a torn-off arm is thrown with the other hand; with both gone he cannot punch, guard, clinch or hit low. A dislocated shoulder is put back at the rest.
  • Blood volume (1000) drains every second from bleeding and open injuries, half as fast between rounds, and slows stamina regeneration in three stages. At zero the fighter bleeds to death; both at once is a draw.
  • FINISH HIM: the knockdown that would be a fighter's third leaves him out on his feet for 3.5 s (MatchPhase.FINISH). The first punch the other fighter lands kills him with the fatality that punch earns (head: jab eyes out, straight head burst, hook decapitation, uppercut spine rip; body: jab heart punched out, straight gutting, hook bisection, uppercut blown to pieces). If none lands he collapses and it is a TKO.
  • Death (FinishMethod.DEATH): a fatality, bleeding out, more heavy shots on a fractured skull (brain), or a power body shot on an open gut (gutted). A death counts as a knockout in ratings.
  • New events: injury, injury_healed, vomit, finish_him, fatality, death, armless; a knockdown with detail collapse. Snapshots carry injuries and blood_volume, both in the checksum.
  • The computer finishes a man stood up for it, boxes with the arms it has left, and reads its own injuries the way the engine applies them (reach, startup, vision, poise ceiling come from the same functions in rules.py).

Client

  • injuries.ts mirrors the engine's rules from the manifest; prediction.ts mirrors hand swap, injury startup, foot speed and the armless fighter's missing guard, checked against engine-generated fixtures (test/injury-table.json, movement traces).
  • render/carnage.ts reads each fighter's injuries from the shown snapshot every frame (late spectators and replays are right) and shows an injury's moment once, as its punch lands on the render clock: the injury stays off the body from the snapshot that lists it until then, so what it tears off is still there to be thrown.
  • render/mutilation.ts + render/injury.ts: the skin shader stops drawing what is gone (jaw, forearm, arm, top of the skull, everything above the waist, a hole through the chest) and the cuts are closed with flesh and bone built from their rims; exposed brain, ribs, knee and elbow bone; ears, flayed cheek; skin drains to grey with blood loss.
  • render/effects.ts + render/viscera.ts: baked body parts thrown under physics with their owner's skin, injuries and cross-sections, organs, gut lengths, bone, vertebrae, fat, ears; wounds that keep pouring per site in the colour of what they pour (blood, bile, brain, urine); a gut that hangs as a rope and drags; a heart that keeps beating on the canvas; a spine that leaves with the head; flies over a corpse; boot prints, smears and pools on the canvas.
  • render/graph.ts + render/ragdoll.ts: a dislocated arm hangs, a snapped forearm swings from the elbow, a blown knee limps, an open belly is held shut; retching, fainting from blood loss, the FINISH HIM daze; death falls by cause and death throes.
  • render/renderer.ts: injuries, FINISH HIM, fatalities and deaths on the render clock; the kill replayed in slow motion (the body is put back together for the lead-up); prediction through the finish phase.
  • HUD: injury tags, a blood bar, the FINISH HIM banner and timer, a death result card. Commentary, captions, generated sound and haptics for every injury, fatality and death.
  • Explicit gore is drawn only at blood full with motion not reduced; reduced, off and reduced motion keep every body whole and only name the injuries.

Dependencies and CI

CI's two dependency audits had started failing on main since its last run (advisories published in the month since), so this PR clears them:

  • Python: aiohttp floor raised to 3.14.4 (locked 3.14.5); certifi, filelock, msgpack, pyasn1, setuptools, soupsieve and yarl refreshed in uv.lock. pip-audit is clean.
  • Frontend: vite 8.1.5 to 8.3.8, vitest 4.1.11 to 4.1.12, undici 7.30.2 through the lockfile.
  • One advisory has no fix to install: GHSA-mrhx-c7xc-m3w5 in zod 3, which @discord/embedded-app-sdk 2.5.0 (its latest release) requires; only zod 4.6.6 is patched. It is a memory-exhaustion bug when validating oversized arrays, and here zod only validates the Discord client's messages in the player's own tab. npm audit --audit-level=high cannot ignore a single advisory, so CI now runs npm run audit:high (web/hands/scripts/audit.mjs): it fails on any high or critical advisory that is not in a reviewed list, and on a reviewed entry npm no longer reports. This changes a security gate and deserves a second look.

Verification

  • uv run ruff check ., uv run ruff format --check ., uv run mypy src/, uv run pip-audit, uv run bandit -r src/ -c pyproject.toml: clean. uv run pytest: 2417 passed.
  • scripts/hands_replay.py --check (the golden bout now runs on through a second get-up to FINISH HIM and a decapitation at tick 941) and scripts/hands_parity_fixtures.py --check pass.
  • web/hands: npm run typecheck, npm run test:run (71 files, 1557 tests), npm run audit:high, npm run build, npm run scan:build; scripts/check_hands_wheel.py on the built wheel. Bundle 2.89 MB (1.45 MB gzip).
  • Engine: every surviving mutant found in review now has a killing test (43 mutants killed); a fuzz of 600 bouts found no exception or bound violation; checksums are identical under three hash seeds.
  • Balance (scripts/hands_balance.py, 24 bouts a matchup): mirror matchups stay near even (champion 11-13, contender 11-13, rookie 11-12-1); skilled play still beats aggression; rookies still go to the cards with no deaths.
  • End to end against the real engine in headless Chromium with a GPU (scripts/hands_e2e_scenarios.js): finish (three knockdowns, FINISH HIM, a fatality, death final, 405 replay frames with no jump), ko and cpu, with no client or server errors.
  • Dev fixture: every injury inflicted live, all eight fatalities and the three other deaths, each also at blood reduced and off: no console errors. The production bundle served by the Python server loads and reaches its outside-Discord state with no console errors.
  • Five independent reviews (engine, client logic, renderer integration, effects, and a final pass on the fixes); every finding addressed.

Known limits

  • A fatality bakes the parts it throws in one frame: total_gib costs tens of milliseconds once, and once more at the replay's impact.
  • The computer picks its finishing punch without regard to reach; half-blind (flayed face, swollen eyes) it misses the kill about one finish in ten and the bout ends by TKO instead.
  • A thrown skin piece's shadow still covers what its shader discards, and a thrown torso keeps the neck skin it was baked with.
  • The announcer's shouted FINISH HIM and fatality lines are untested on real speech engines (headless browsers have no voices).
  • The golden replay is still a single bout.

…dismemberment and death

- Engine: 24 deterministic injuries with gameplay effects, a blood supply, the FINISH HIM phase
  with eight fatalities, death as a finish, a computer that fights with what it has left.
  Protocol version 6.
- Client: injuries shown on the body (shader cuts, closed cross-sections, thrown parts, organs,
  pouring wounds, hanging eyes and gut), in the pose (dead arms, limp, daze, death throes), in
  the HUD, commentary, sound and haptics; the kill replayed in slow motion.
- Explicit gore only at blood full with motion not reduced.
- Dependencies: aiohttp 3.14.5 and refreshed locks for new advisories; vite 8.3.8, vitest 4.1.12.
- CI: npm audit runs through a reviewed-advisory gate, for a zod 3 advisory with no fix that the
  Discord SDK pins.
@greptile-apps

greptile-apps Bot commented Nov 17, 2026

Copy link
Copy Markdown

Your organization has run out of review credits. Add credits to resume code reviews.

@user1303836
user1303836 merged commit 91872a9 into main Nov 17, 2026
6 checks passed
@user1303836
user1303836 deleted the feature/hands-carnage branch November 17, 2026 04:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant