Skip to content

docs(protocol): P_StandardUpdate detail page (per-tick movement broadcast)#286

Merged
CoreyRDean merged 1 commit into
developfrom
docs/p-standardupdate-detail-page
May 26, 2026
Merged

docs(protocol): P_StandardUpdate detail page (per-tick movement broadcast)#286
CoreyRDean merged 1 commit into
developfrom
docs/p-standardupdate-detail-page

Conversation

@CoreyRDean
Copy link
Copy Markdown
Collaborator

Summary

Second per-packet detail page after #285 (P_InventoryUpdate). Documents the highest-network-volume packet in the protocol — every connected player sends one to the server per movement-tick, and the server broadcasts every visible actor's position to every nearby player.

Non-technical

P_StandardUpdate is the per-frame heartbeat of the game's network surface. Understanding it is required for ANY perf or anti-cheat work. The doc captures the full anti-cheat rationale (speed-hack delta clamp, backward-running prevention, mount-rider sync) which has accreted across many PRs and was previously only readable from the source.

What's documented

Acceptance criteria

  • C→S 22-byte layout documented (DestX/Z, NewY, NewX, NewZ, IsRunning, WalkingBackward)
  • S→C variable-length layout with conditional tails documented
  • Every validation requirement linked to specific source line
  • Server broadcast scheduler explained
  • Catalog index regenerated; Detail column links to new page
  • No .bb source changes
  • compile.bat -t clean
  • test.bat — 25/25 pass

Test plan

  • ./scripts/gen_packet_index.sh --check idempotent (verified before commit)
  • Spot-check 4 sub-fields against the actual Mid$ calls in ServerNet.bb:1773-1780 and ClientNet.bb:1491-1538 — offsets and widths match
  • Local compile.bat -t + test.bat — pass

Trade-offs / deferred

🤖 Generated with Claude Code

…cast)

The highest-network-volume packet in the protocol -- every connected
player sends one per movement-tick, and the server broadcasts every
visible actor's position to every nearby player. Second per-packet
detail page after P_InventoryUpdate (PR #285); sets the bar for the
remaining 53.

## What the doc covers

* **No sub-codes**, but two distinct field layouts (C->S and S->C)
  with documented per-byte offset / width / type / field tables.
* **Five conditional fields** on the S->C tail (mount RuntimeID,
  self-Energy passback, flying-actor Y) with the exact predicates
  that trigger each.
* **Six validation requirements** tied to specific source lines:
  - ClampWorldCoord on all 5 floats (PRs #237-#239)
  - Speed-hack delta clamp (per-packet MoveDist vs Speed*Elapsed)
  - WalkingBackward forces IsRunning = False (anti-cheat)
  - Rider-mount synchronisation
  - AI\Rider = Null precondition
  - AI\IgnoreUpdate = 0 precondition
* **Server broadcast scheduler** with the three distance bands
  (UpdateDistance / UpdateFarDistance + AlsoUpdateMiddleRange
  alternation) and its connection to PR #283's FirstOnlinePlayer
  + FirstInZone chain walks.
* **Historical PR references**: #237-#239 (float clamp), #270/#272
  (per-Area chain), #277 (Null-guard zero-sentinel), #282 (O(1)
  sender resolution), #283 (broadcast-loop chain conversion).

## Why this is high-value

P_StandardUpdate is the per-frame network surface; understanding it
is required for ANY perf or anti-cheat work. The doc captures the
full anti-cheat rationale (speed-hack delta clamp, backward-running
prevention, mount-rider sync) which has accreted across many PRs
and was previously only readable from the source.

The doc also captures the non-obvious dual-purpose field at offset
23 (Energy stat when A2=AI; Y-float when Environment_Fly) with the
predicate clarifying when which appears -- a likely source of
"why is this offset different than the field layout suggests?"
confusion in the future.

## Verification

* No source .bb changes.
* compile.bat -t clean.
* test.bat -- 25/25 pass (no flake this run).
* gen_packet_index.sh regenerated to link the new detail page.
* Spot-check 4 sub-fields against the actual Mid$ calls in
  ServerNet.bb:1773-1780 (C->S layout) and ClientNet.bb:1491-1538
  (S->C layout): offsets and widths match.

## Deferred

53 packet detail pages remain. Recommended next picks:
* P_AttackActor -- combat math, damage calculation, faction gating
* P_SpellUpdate -- multi-sub-code spell lifecycle (cast/charge/free)
* P_ChatMessage -- multi-prefix dispatch (Chr$(252/253/254) channels)
* P_VerifyAccount -- the auth state machine (already half-documented
  in modules/servernet.md but deserves a dedicated page)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@CoreyRDean CoreyRDean requested a review from a team as a code owner May 26, 2026 16:22
@CoreyRDean CoreyRDean merged commit 6016ef8 into develop May 26, 2026
1 check passed
@CoreyRDean CoreyRDean deleted the docs/p-standardupdate-detail-page branch May 26, 2026 16:25
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