fix(server): add error logging, protocol version, and architecture docs

- Replace silent Entity::to_bits() fallbacks with tracing::error in
  observer.rs and interaction.rs (makes unregistered entities loud)
- Add PROTOCOL_VERSION constant to types.rs, use in observer snapshot
- Document single-observer assumption on NearbyInteractionBuffer
- Document proximity-only (no LOS) limitation on compute_nearby_interactions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-12 21:22:34 +01:00
co-authored by Claude Opus 4.6
parent e2f2f4e590
commit ba867564a8
3 changed files with 26 additions and 4 deletions
+5 -2
View File
@@ -118,7 +118,10 @@ pub fn compute_observer_snapshot(
let wire_id = registry
.to_stable(entity)
.map(|sid| sid.0)
.unwrap_or_else(|| entity.to_bits());
.unwrap_or_else(|| {
tracing::error!(?entity, "entity visible but not in EntityRegistry");
entity.to_bits()
});
visible_entity_bits.insert(wire_id);
entities.push(VisibleEntity {
entity_id: wire_id,
@@ -160,7 +163,7 @@ pub fn compute_observer_snapshot(
// Step 8: Assemble snapshot (v4: added nearby_interactions)
buffer.snapshot = Some(ObserverSnapshot {
version: 4,
version: crate::bridge::types::PROTOCOL_VERSION,
tick: time.tick,
game_time,
player_facing: facing,