The gap Stage 1 left open: snapshots were encoded once and broadcast to every peer in an instance, so clients were handed enemies the fog then hid. Fog is a rendering rule -- a modified client draws whatever it holds -- so that was no defence at all. Snapshots are now encoded per peer, and actors beyond ACTOR_INTEREST_RADIUS (800u) are never sent. Measured cost of four filtered encodes against one shared: 95.6us vs 24.9us, or 0.032 ms/tick amortised over the snapshot interval. Two asymmetries worth keeping: - The observer's own player record is never filtered, however far out the arithmetic puts it. The client reconciles its prediction against that record, so dropping it breaks the player's own movement rather than hiding someone. - Only bullet SPAWNS are filtered, never despawns. A client told about a bullet must always be told it died, or it keeps a phantom. Bullet spawns use a much wider radius (2200u) than actors, deliberately. An enemy appearing at the edge of sight is cosmetic; a bullet withheld at spawn that later flies into view is invisible damage. The floor is longest bullet travel + fog radius -- 1500 for the Warden's Collapse snipe -- and test_interest.gd recomputes that from live content, so adding a faster or longer-lived bullet fails a test instead of producing bullets that wink into existence. Also clamped bosses to their room. A no-op today since every boss is stationary, which is exactly when the invariant is cheap to establish: boss rooms have no door that locks, so the only thing keeping a fight in the boss room is the boss, and Stage 5's movement work would otherwise break it quietly. 146 tests (was 137). check.sh, test.sh and smoke.sh pass. Stage 1 has no partials left; docs/ROADMAP.md now records the three interest radii and the floor each must respect.
This commit is contained in:
@@ -117,6 +117,26 @@ const DUNGEON_CLEARED_EXIT_TICKS := 1800 # 30 seconds
|
||||
## always holds the terrain it is about to reveal.
|
||||
const FOG_VIEW_RADIUS := 460.0
|
||||
|
||||
# --- Interest management ----------------------------------------------------
|
||||
## Actors further than this from a player are not sent to that player at all.
|
||||
## Comfortably beyond FOG_VIEW_RADIUS so nothing visibly pops in at the edge of
|
||||
## sight, but far short of a dungeon, so a modified client cannot read enemy
|
||||
## positions across the map.
|
||||
const ACTOR_INTEREST_RADIUS := 800.0
|
||||
|
||||
## Bullet spawns are filtered far more generously than actors, and deliberately
|
||||
## so. A bullet is announced once, at spawn, and then simulated locally -- if we
|
||||
## withhold it and it later flies into view, it is invisible damage, which is a
|
||||
## gameplay bug rather than a cosmetic one. An enemy appearing at the edge of
|
||||
## sight is neither.
|
||||
##
|
||||
## The floor is (longest bullet travel + FOG_VIEW_RADIUS): a bullet spawned
|
||||
## further away than that cannot reach visible ground before it expires.
|
||||
## test_interest.gd computes that from the real content and asserts this covers
|
||||
## it, so adding a faster or longer-lived bullet fails a test instead of
|
||||
## producing bullets that wink into existence.
|
||||
const BULLET_INTEREST_RADIUS := 2200.0
|
||||
|
||||
# --- Map streaming ----------------------------------------------------------
|
||||
## How far around a player the server streams map tiles. Comfortably wider than
|
||||
## the viewport so movement prediction and bullet simulation always run against
|
||||
|
||||
Reference in New Issue
Block a user