N11 Client: build ghost, held item and hits in the playable client #78

Closed
opened 2026-11-12 19:51:05 +00:00 by claude · 1 comment
Owner

Depends on: N10

The playable client (N10, #77) draws the world and takes input, but several things a player needs to see while playing aren't wired into ClientSession yet:

  • Build ghost. BuildGhost (src/client/building/) exists and isn't shown. In build mode, draw it at Building.target() for the client's predicted player, tinted by whether Building.check() passes on the client's world.
  • Held item. ClientMirror puts each player's held item code in SimEntity.item; nothing draws it (the models are A4, #44).
  • Hits and shots. The client isn't told about simulation events (shots fired, hits, harvest swings), so there is nothing to draw or play a sound for. Decide whether they ride in snapshots or on the reliable channel.
  • Flooded basins. The client doesn't run the flood. WaterView draws one flat sea, so a basin behind a breakwater looks flooded when it is dry.
  • A real window. The keyboard and mouse path (ClientInput.poll() and handle()) has only been run headless, where nothing is pressed. It needs a person at a real display (R6, #65).

Acceptance

  • A capture in build mode shows the ghost where the piece will go, in both the allowed and refused tints.
  • A capture shows a dry basin behind a breakwater as dry on a network client.
  • Shots and hits reach the client and a test shows them arriving.
**Depends on:** N10 The playable client (N10, #77) draws the world and takes input, but several things a player needs to see while playing aren't wired into `ClientSession` yet: - **Build ghost.** `BuildGhost` (`src/client/building/`) exists and isn't shown. In build mode, draw it at `Building.target()` for the client's predicted player, tinted by whether `Building.check()` passes on the client's world. - **Held item.** `ClientMirror` puts each player's held item code in `SimEntity.item`; nothing draws it (the models are A4, #44). - **Hits and shots.** The client isn't told about simulation events (shots fired, hits, harvest swings), so there is nothing to draw or play a sound for. Decide whether they ride in snapshots or on the reliable channel. - **Flooded basins.** The client doesn't run the flood. `WaterView` draws one flat sea, so a basin behind a breakwater looks flooded when it is dry. - **A real window.** The keyboard and mouse path (`ClientInput.poll()` and `handle()`) has only been run headless, where nothing is pressed. It needs a person at a real display (R6, #65). **Acceptance** - A capture in build mode shows the ghost where the piece will go, in both the allowed and refused tints. - A capture shows a dry basin behind a breakwater as dry on a network client. - Shots and hits reach the client and a test shows them arriving.
claude added this to the v0.6 Art, Audio and UI milestone 2026-11-12 19:51:05 +00:00
claude added the priority/hightype/feature labels 2026-11-12 19:51:05 +00:00
eric closed this issue 2026-11-13 07:24:20 +00:00
Author
Owner

Done in 57faefb.

What changed

  • Build ghost. ClientSession shows a BuildGhost in build mode while the client plays. It asks Building.check() of the client's own world and predicted player, using the mouse's newest look.
  • Flooded basins.
    • ClientMirror.follow_flood() spreads the client's own flood the way the server's tide tick does, from the tide schedule and the pieces it already has. Nothing new goes over the network.
    • WaterView passes a mask of flooded cells to the sea shader, which leaves dry cells undrawn.
    • The mask is rebuilt only when Flood.pours changes. Off the grid it is open sea.
  • Shots and hits. Decision: a separate unreliable FX message (NetFx) on the state channel, sent with each client's snapshot.
    • It carries shots (origin and aim), impacts (point, what was hit, target) and harvest swings.
    • Only events within NET_FX_RADIUS_METRES (250 m) of what the client watches go to that client, plus any involving the player it watches.
    • It is capped at 1,200 bytes. They arrive in ClientGame.fx for views (A7) and sound (A8).
    • They change no state, so a lost one is a missed flash. Sending them reliably would add to the reliable traffic that hurt N8 (#39).

Acceptance

  • captures/client_build.png: a sea-green driftwood wall ghost in front of the player (OK). captures/client_build_refused.png: the same ghost in rust red, UNAFFORDABLE with no driftwood.
  • captures/client_basin.png, on a network client over UDP:
    • The server rings shore ground with stone breakwaters, then play continues until the tide's first rise.
    • The sea stands at 4.3 m outside the ring, and the ground inside, at 3.3 m, is dry.
    • The caption reports the inside as dry on the server, in the client's flood and in what is drawn.
  • test_shots_and_hits_reach_the_client: a landed player fires at the ground. Its shots and impacts reach the client, and each one matches a server event's tick, player and position.
  • More tests:
    • test_net_fx.gd: round trips, byte and count limits, malformed input. The parser fuzzer covers NetFx.decode too.
    • test_client_flood.gd: a ringed basin stays dry through the first rise; with no ring it floods; a long frame catches up; the mask follows pours.
  • make check passes (506 tests). make client-check passes.

Not done here:

  • The held item isn't drawn yet: it needs the models from A4 (#44).
  • The keyboard and mouse at a real window is R6 (#65).

— tidewall-build

Done in 57faefb. **What changed** - **Build ghost.** `ClientSession` shows a `BuildGhost` in build mode while the client plays. It asks `Building.check()` of the client's own world and predicted player, using the mouse's newest look. - **Flooded basins.** - `ClientMirror.follow_flood()` spreads the client's own flood the way the server's tide tick does, from the tide schedule and the pieces it already has. Nothing new goes over the network. - `WaterView` passes a mask of flooded cells to the sea shader, which leaves dry cells undrawn. - The mask is rebuilt only when `Flood.pours` changes. Off the grid it is open sea. - **Shots and hits.** Decision: a separate unreliable **FX** message (`NetFx`) on the state channel, sent with each client's snapshot. - It carries shots (origin and aim), impacts (point, what was hit, target) and harvest swings. - Only events within `NET_FX_RADIUS_METRES` (250 m) of what the client watches go to that client, plus any involving the player it watches. - It is capped at 1,200 bytes. They arrive in `ClientGame.fx` for views (A7) and sound (A8). - They change no state, so a lost one is a missed flash. Sending them reliably would add to the reliable traffic that hurt N8 (#39). **Acceptance** - `captures/client_build.png`: a sea-green driftwood wall ghost in front of the player (OK). `captures/client_build_refused.png`: the same ghost in rust red, UNAFFORDABLE with no driftwood. - `captures/client_basin.png`, on a network client over UDP: - The server rings shore ground with stone breakwaters, then play continues until the tide's first rise. - The sea stands at 4.3 m outside the ring, and the ground inside, at 3.3 m, is dry. - The caption reports the inside as dry on the server, in the client's flood and in what is drawn. - `test_shots_and_hits_reach_the_client`: a landed player fires at the ground. Its shots and impacts reach the client, and each one matches a server event's tick, player and position. - More tests: - `test_net_fx.gd`: round trips, byte and count limits, malformed input. The parser fuzzer covers `NetFx.decode` too. - `test_client_flood.gd`: a ringed basin stays dry through the first rise; with no ring it floods; a long frame catches up; the mask follows pours. - `make check` passes (506 tests). `make client-check` passes. **Not done here:** - The held item isn't drawn yet: it needs the models from A4 (#44). - The keyboard and mouse at a real window is R6 (#65). — tidewall-build
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: claude/tidewall#78