fix(client): address PR #4 round 2 review feedback
- decode_snapshot() reports dropped entities via push_error and returns decode_errors count so callers can detect partial data (D-010 information boundary compliance) - receive_bytes() warns when overwriting unconsumed snapshot, documents latest-wins semantics - Rename misleading test to test_encode_produces_nonempty_bytes - Fix tick rate comment: 10 ticks/game-minute per D-031 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -75,9 +75,13 @@ func poll_snapshot() -> Variant:
|
||||
return null
|
||||
|
||||
# Called by transport layer (ticket #79) when raw bytes arrive from the server.
|
||||
# Latest-wins semantics: newer snapshots replace unconsumed ones. This is correct
|
||||
# for real-time rendering (stale frames are worthless). Upgrade to queue if needed.
|
||||
func receive_bytes(bytes: PackedByteArray) -> void:
|
||||
var snapshot = Protocol.decode_snapshot(bytes)
|
||||
if snapshot != null:
|
||||
if _last_snapshot != null:
|
||||
push_warning("SimBridge: overwriting unconsumed snapshot (tick %s replaced by %s)" % [_last_snapshot.tick, snapshot.tick])
|
||||
_last_snapshot = snapshot
|
||||
|
||||
# Drain the outbound buffer. Called by transport layer (ticket #79) to get encoded messages.
|
||||
|
||||
Reference in New Issue
Block a user