docs(protocol): P_StandardUpdate detail page (per-tick movement broadcast)#286
Merged
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Environment_Fly. The conditional predicates that select between them.ClampWorldCoord#on all 5 floatsAI\Rider = NullpreconditionAI\IgnoreUpdate = 0preconditionUpdateDistance/UpdateFarDistance) and theAlsoUpdateMiddleRangealternation that halves mid-range bandwidth.Acceptance criteria
.bbsource changescompile.bat -tcleantest.bat— 25/25 passTest plan
./scripts/gen_packet_index.sh --checkidempotent (verified before commit)Mid$calls in ServerNet.bb:1773-1780 and ClientNet.bb:1491-1538 — offsets and widths matchcompile.bat -t+test.bat— passTrade-offs / deferred
P_AttackActor— combat math + damage + faction gatingP_SpellUpdate— multi-sub-code spell lifecycleP_ChatMessage— multi-prefix dispatch (Chr$(252/253/254) channels)P_VerifyAccount— the auth state machine (PRs P_VerifyAccount: close username/ban/presence enumeration oracle #264-Extend LoginAttemptOk throttle to 4 sibling auth handlers #268 history)🤖 Generated with Claude Code