Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ A disconnect pauses the bout and shows the connected opponent a live reconnect c
- A close-range clinch has vulnerable startup and can be denied or interrupted. A successful finite hold cancels attacks, lets both regain a little stamina while spending conditioning, and ends in referee separation.
- Low blows and headbutts are deliberate, costly fouls: misses still cost resources; a landed foul causes a recovery pause and warning, warning two deducts a point, and warning three disqualifies the offender.
- Head/body and left/right eye trauma persist. Hooks intensify eye damage; damaged eyes reduce reach/accuracy. Cuts increase bleeding, bleeding adds head trauma and fatigue, swelling accumulates, and cut/swelling thresholds can cause a doctor stoppage. Blood event amounts are authoritative, while spray, pooling, audio, and shake are cosmetic only.
- Poise depletion or a sufficiently damaging head shot causes a knockdown. During the ten-count, the downed fighter alone sees a seeded private left/right rhythm prompt. Press the shown direction inside its timing window: centered timing gains more meter, while early, late, wrong, or spam inputs lose progress. Repeated knockdowns and head trauma raise the requirement; failure by ten is a KO.
- Poise depletion or a sufficiently damaging head shot causes a knockdown. During the ten-count the downed fighter alone sees a large arrow on his get-up panel, left or right, with the side after it small and dim beside it. From the count of two, each number of the count is one prompt: a ring closes on the arrow and reaches it on the beat, the moment the number changes, turning green while a press would be in time and gold at its perfect middle. A prompt takes one attempt, the first press from the end of the one before (within a server tick, the first of its presses): on the beat (one tick either side) is PERFECT and counts two, within three ticks is GOOD and counts one, before that is EARLY and up to three ticks after it LATE (neither scores), and the wrong side costs one. The next prompt takes over as soon as the attempt is made. A press before a prompt's attempt can be made (during the fall, or after the last attempt and before that prompt's late ticks end) does nothing and draws no verdict, so mashing gets nowhere. He rises when the meter reaches four for each knockdown so far plus one for each 300 of head trauma; failure by ten is a KO. The panel is drawn for the moment a press made now reaches the server (the earliest recent snapshot's clock plus the measured round trip); a press that makes an attempt is answered on the panel at once with the client's guess and then with the server's verdict, which stands, and a tick and a haptic pulse mark each beat. While the bout is paused the panel goes away and the beats stop. `scripts/hands_get_up.py` plays the count many times through the engine with scripted players and the computer levels and prints how often each gets up.
- **Injuries.** Damage ends in discrete, permanent injuries the server decides from accumulated wear and the punch that lands, one a punch, worst first, with no dice. Each is listed in the snapshot and changes how its owner fights:
- Head: a broken nose (bleeds, 75% stamina regeneration), a broken jaw and then the jaw torn off (25% and 50% more poise lost), an eye punched out of a swollen socket (that eye is as good as shut for the rest of the bout), an ear torn off (slower poise recovery), a cut cheek flayed to the muscle (worse accuracy), and a fractured skull (poise ceiling 60%). More heavy shots on a fractured skull kill.
- Body: caved-in ribs (35% more damage from body shots on that side, less maximum stamina), a ruptured liver (60% stamina regeneration, and he vomits every eight seconds, which stops him for a moment), and disembowelment (75% foot speed, less maximum stamina, 50% more body damage). Another power shot to an open gut kills.
Expand Down Expand Up @@ -483,7 +483,7 @@ Keyboard controls use physical key positions (`KeyboardEvent.code`):
| Clinch / switch stance | `B` / `N` |
| Taunt | `M` |
| Low blow / headbutt (deliberate fouls) | `Shift+1` / `Shift+2` |
| Private get-up rhythm | `Left Arrow` / `Right Arrow` |
| Get up when knocked down | `Left Arrow` / `Right Arrow`, the side the big arrow shows, as the ring closes |
| Corner instruction, between rounds | `1` close the cut · `2` bring down the swelling · `3` catch your breath |
| Style, in the pick before the bout | Arrow keys choose, `Enter` settles; `1`–`5` settle on that card at once |
| Camera | `K` cycles broadcast, close and over the shoulder |
Expand All @@ -501,7 +501,7 @@ Standard-controller controls are:
| Weave / pull | D-pad up / down |
| Clinch / switch stance | Left-stick press / right-stick press |
| Low blow / headbutt | View/Back / Menu/Start |
| Private get-up rhythm | While down, press D-pad left / right; it registers immediately rather than waiting for release |
| Get up when knocked down | While down, press D-pad left / right, the side the big arrow shows; it registers immediately rather than waiting for release |
| Corner instruction, between rounds | Left (`X`/Square) close the cut · top (`Y`/Triangle) bring down the swelling · right (`B`/Circle) catch your breath |
| Style, in the pick before the bout | D-pad or left stick choose; bottom (`A`/Cross) settles |

Expand Down Expand Up @@ -618,7 +618,7 @@ git diff --exit-code -- src/intelstream/hands/static

The fixed three-file deployment contract embeds the mesh-only Boxer rig and its five source textures (re-encoded as JPEG by the generator) in `hands.js`; the resulting production script is about 2.94 MB (about 1.46 MB gzip). This startup-cost tradeoff keeps the Activity self-contained and avoids runtime asset requests. `scripts/hands_pose_strip.js` renders a pose frozen at a list of times into one frame strip for motion review. `npm run dev` also serves `?model-lab=1&pose=<name>&cam=<angle>&trauma=<light|heavy|cut>` as a pose lab for reviewing the runtime animation and injury shading without a match (poses include punches, guards, slips, knockdown, seated, celebrate and wave_off), and `?fixture=1` with `&finisher=head|hand`, `&phase=rest`, `&pin=1|corner`, `&blood=reduced|off` or `&platform=mobile` for presentation review. Both take the engine's injuries: `&injuries=<ids>` carried from the start, `&inflict=<ids>` happening one after another, `&bloodvol=<0..1000>`, and `&fatality=<id>` (the fixture runs FINISH HIM, the kill, its replay and the result card). The lab also takes `&dead=<bled_out|brain|gutted>`, `&dazed=1` and `&vomit=1`; the fixture takes `&death=<bled_out|brain|gutted>` and `&injuries1=<ids>` for the other fighter. For judging how the boxers stand and move, both take `&gap=<engine units between the two>`; the fixture takes `&calm=1` (both standing in their stances, nothing scripted) or `&calm=walk` (circling), `&guard=high|low`, `&styles=<one>,<two>`, `&wear=1` (bodies marked by the fight from the start) and `&referee=count|break`; the lab takes `&speed=<m/s>` for the walks, `&xray=<bone>` to play a bone break's cut-in and `&wear=<blows>`.

For a standalone presentation fixture, run `npm --prefix web/hands run dev` and open the printed URL with `?fixture=1`. For the real two-process localhost flow, terminal one runs the Python bot/Hands server with valid Discord credentials:
For a standalone presentation fixture, run `npm --prefix web/hands run dev` and open the printed URL with `?fixture=1`. Add `&getup=1` to play a knockdown from the downed fighter's side with no server: the arrow keys, or with `&platform=mobile` on a touch screen the two get-up pads, press, and each press is scored by the engine's rules; `&knockdowns=2` and `&head=<0-1400>` make it harder. For the real two-process localhost flow, terminal one runs the Python bot/Hands server with valid Discord credentials:

```bash
HANDS_ENABLED=true HANDS_DEV_MODE=true HANDS_HOST=127.0.0.1 HANDS_PORT=8080 uv run intelstream
Expand All @@ -641,7 +641,7 @@ HANDS_DEV_BACKEND=http://127.0.0.1:8091 npm --prefix web/hands run dev -- --port

Open `http://localhost:5174/?e2e=1&instance_id=<any id>&player=<name>` in two browser windows (different names) to fight. The `e2e` switch only exists in Vite development builds; the development server authenticates anyone who can reach its port, so never expose it.

`scripts/hands_e2e_scenarios.js` automates this with Playwright: `ko` (power punches until a knockdown, private get-up rhythm, stoppage), `finish` (the floored player gets up twice, so the knockdown that would be his third stands him up for FINISH HIM; the bout must end in his death or his collapse, and a punch that killed him must be replayed), `reconnect` (one client's link goes silent mid-round through a TCP proxy, with no close in either direction as a lost network has none; it times how long the room takes to pause the other player, then restores the link and checks both resume), `rest` (two rounds with the corner rest), `spectator` (a third client joins read-only), `touch` (one player on an emulated phone), `mash` (hundreds of key presses per second) `latency` (a TCP proxy delays every frame 110 ms each way, and the clients report their measured input acknowledgement latency, which the fighter HUD also shows) `soak` (a full three-round bout sampling heap size, latency and render scale every twenty seconds) `background` (one player's page is frozen through the DevTools lifecycle state for eight seconds, as a backgrounded phone app would be, then resumed) `rematch` (both players use the Rematch button after the result and fight a second bout in the same instance) `rematchloop` (four bouts back to back while sampling heap size and GPU object counts for leaks) `clinch` (both players close in and one ties up; the harness reads the fighters' separation from the client state through the engine's draw-in, the hold and the referee break) and `response` (key press to first rendered frame for the player's own punch and step, when the opponent sees them, and whether the predicted punch ever jumps back, behind a delay proxy set with `E2E_DELAY_MS`, 60 ms each way by default). It spawns the development server itself and prints the clients' status text plus any client or server errors. The default software renderer keeps runs reproducible on machines without a GPU; set `E2E_GPU=1` to render on the machine's GPU for real frame pacing, input latency and screenshots.
`scripts/hands_e2e_scenarios.js` automates this with Playwright. A floored player answers each get-up prompt from inside his page when his own panel's ring reaches its target, as a player watching it would. The scenarios: `ko` (power punches until a knockdown, the get-up, stoppage), `finish` (the floored player gets up twice, so the knockdown that would be his third stands him up for FINISH HIM; the bout must end in his death or his collapse, and a punch that killed him must be replayed), `getup` (knockdowns bout after bout behind the delay set with `E2E_DELAY_MS` and `E2E_JITTER_MS` until the floored player has pressed 60 times, or `E2E_GETUP_PRESSES`; it fails unless at least 95% of the server's verdicts are good or perfect), `reconnect` (one client's link goes silent mid-round through a TCP proxy, with no close in either direction as a lost network has none; it times how long the room takes to pause the other player, then restores the link and checks both resume), `rest` (two rounds with the corner rest), `spectator` (a third client joins read-only), `touch` (one player on an emulated phone, who gets up with the get-up pads), `mash` (hundreds of key presses per second, then a floored player hammering the arrows, who must be counted out) `latency` (a TCP proxy delays every frame 110 ms each way, and the clients report their measured input acknowledgement latency, which the fighter HUD also shows) `soak` (a full three-round bout sampling heap size, latency and render scale every twenty seconds) `background` (one player's page is frozen through the DevTools lifecycle state for eight seconds, as a backgrounded phone app would be, then resumed) `rematch` (both players use the Rematch button after the result and fight a second bout in the same instance) `rematchloop` (four bouts back to back while sampling heap size and GPU object counts for leaks) `clinch` (both players close in and one ties up; the harness reads the fighters' separation from the client state through the engine's draw-in, the hold and the referee break) and `response` (key press to first rendered frame for the player's own punch and step, when the opponent sees them, and whether the predicted punch ever jumps back, behind a delay proxy set with `E2E_DELAY_MS`, 60 ms each way by default). It spawns the development server itself and prints the clients' status text plus any client or server errors. The default software renderer keeps runs reproducible on machines without a GPU; set `E2E_GPU=1` to render on the machine's GPU for real frame pacing, input latency and screenshots.

`HANDS_DEV_BACKEND` is a Node/Vite development-process setting, not a browser `VITE_*` value and not a production origin. Real OAuth still needs a valid Activity instance; the fixture is only recorded presentation data. Keep `HANDS_DEV_MODE=false` in production.

Expand Down
4 changes: 2 additions & 2 deletions scripts/hands_balance.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def decide(self, engine: BoxingEngine) -> InputCommand | None:
if engine.phase is MatchPhase.KNOCKDOWN:
window_middle = (me.get_up_window_start_tick + me.get_up_window_end_tick) // 2
prompt = me.get_up_prompt
if prompt is not None and not me.get_up_prompt_resolved and tick + 1 >= window_middle:
if prompt is not None and tick + 1 >= window_middle:
return InputCommand(self._sequence, tick, actions=(MovementAction(prompt),))
return InputCommand(self._sequence, tick)
if engine.phase is MatchPhase.REST:
Expand Down Expand Up @@ -275,7 +275,7 @@ def decide(self, engine: BoxingEngine) -> InputCommand | None:
if engine.phase is MatchPhase.KNOCKDOWN:
window_middle = (me.get_up_window_start_tick + me.get_up_window_end_tick) // 2
prompt = me.get_up_prompt
if prompt is not None and not me.get_up_prompt_resolved and tick + 1 >= window_middle:
if prompt is not None and tick + 1 >= window_middle:
return self._command(tick, actions=(MovementAction(prompt),))
return self._command(tick)
if engine.phase is MatchPhase.REST and self.kind == "counter":
Expand Down
Loading
Loading