Hoshe critical fixes:
- _action_enum_to_wire uses InputMapper.Action constants instead of
fragile integer literals; OPEN_MENU explicitly handled as client-only
- Remove int() coercion on tick/entity_id — use direct assignment since
GDScript int is signed 64-bit (safe for realistic tick values)
- Check encode result before buffering in send_input() — reject empty
bytes instead of corrupting the outbound stream
- Test snapshot now uses Protocol format {tick, entities} instead of
legacy schema; GameState updated to derive player position from
entity data; main.gd and world_renderer.gd updated accordingly
Hoshe warnings:
- 5 negative tests added (truncated bytes, wrong type, missing fields,
empty bytes, encode validation) — 20/20 tests pass
- receive_bytes signal is emitted at consume time in poll_snapshot by
design (documented in code)
Tyre suggestions:
- Remove duplicated root-level fixtures — single source of truth in
client/tests/fixtures/msgpack/
- gen_fixtures.rs writes directly to client/ directory
- Add `make fixtures` target for regeneration
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
31 lines
935 B
GDScript
31 lines
935 B
GDScript
extends Node2D
|
|
|
|
@onready var world_renderer = $World
|
|
@onready var camera = $Camera2D
|
|
@onready var hud = $UILayer/HUD
|
|
@onready var monologue_display = $UILayer/MonologueDisplay
|
|
|
|
func _ready() -> void:
|
|
print("The Settled Reach — client initialized")
|
|
|
|
# Connect to simulation (will use test mode initially)
|
|
SimBridge.connect_to_sim()
|
|
|
|
func _process(_delta: float) -> void:
|
|
# Main game loop: poll snapshot, apply state, flush input
|
|
var snapshot = SimBridge.poll_snapshot()
|
|
if snapshot != null:
|
|
GameState.apply_snapshot(snapshot)
|
|
|
|
# Update renderers with new state
|
|
if world_renderer and world_renderer.has_method("update_from_state"):
|
|
world_renderer.update_from_state()
|
|
|
|
# Track camera to player position (D-015)
|
|
camera.position = GameState.player_position * 32 # tile-space to pixel-space
|
|
|
|
# Send queued input to simulation
|
|
var inputs = InputMapper.flush_queue()
|
|
for input in inputs:
|
|
SimBridge.send_input(input)
|