N10: Playable network client
The client program now turns a connection into a match someone can play. - ClientSession: a ClientGame, the keyboard and mouse as commands (ClientInput), and a MatchView of the client's own copy of the world. - ClientMirror writes what the client is showing into that world every frame: other players from the recent past, its own player where it was predicted, items, the barge, the clock and the sea. The existing views draw it unchanged. - LocalServer: offline play is the same ServerLoop and NetGame in the same process, with packets handed across in memory, so there is one path. - main.gd: --connect=HOST[:PORT] joins a server, otherwise an offline match; --autoplay and --client-seconds=N for scripts and checks. - The camera aboard the barge follows the player's own place on the deck. Tests drive a scripted client through a whole match on a real server over loopback UDP, lobby to results, and through an offline match. `make client-check` does it with two real processes, and `make client-captures` renders what the client sees. Closes #77 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -25,6 +25,9 @@ const DECK_ROWS: int = 4
|
||||
|
||||
## The entity drawn in the brightest oilskin, or 0.
|
||||
var local_id: int = 0
|
||||
## Where to draw the barge, when its owner knows better than the simulation's tick: a
|
||||
## network client, which draws between ticks. Vector3.INF leaves it to the tick.
|
||||
var barge_at: Vector3 = Vector3.INF
|
||||
|
||||
var _sim: Simulation
|
||||
## Entity ID -> the figure's root node.
|
||||
@@ -70,7 +73,7 @@ func sync() -> void:
|
||||
heading = atan2(along.x, along.z)
|
||||
_barge.visible = crossing
|
||||
if crossing:
|
||||
_barge.position = drop.barge_position(_sim.tick)
|
||||
_barge.position = barge_at if barge_at != Vector3.INF else drop.barge_position(_sim.tick)
|
||||
_barge.rotation.y = heading
|
||||
|
||||
var seen: Dictionary = {}
|
||||
|
||||
Reference in New Issue
Block a user