N11: Build ghost, client flood and shot effects in the playable client
- Build ghost: ClientSession shows a BuildGhost in build mode while the client plays, asking Building.check() of its own world and predicted player with the mouse's newest look, so it agrees with the server. - Flooded basins: ClientMirror.follow_flood() spreads the client's flood as the server's tide tick does, from the tide and the pieces it has. WaterView passes a mask of flooded cells (Flood.pours says when it changed) to the sea shader, which leaves dry cells undrawn. - Shots, impacts and swings: a new FX message (NetFx) goes unreliably on the state channel next to each snapshot, with what happened within NET_FX_RADIUS_METRES of what the client watches or involving that player. ClientGame keeps them in `fx` for views and sound. They change no state, so a lost one is a missed flash; sending them reliably would add to the traffic a bad link can least afford (N8). The fuzzer covers the new parser. - Captures: client_build and client_build_refused show the ghost in its allowed and refused tints; client_basin rings shore ground with breakwaters and plays until the tide stands over it, and the server, the client's flood and the drawn sea all keep the basin dry. - Tests: NetFx round trips, limits and malformed input; a landed player's shots and impacts reach a client, each matching a server event; the client keeps a ringed basin dry through the first rise, floods it with no ring, catches up after a long frame; the water mask follows pours. The held item is still not drawn; that needs the models (A4, #44). Closes #78 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -30,6 +30,9 @@ var flooded: PackedByteArray = PackedByteArray()
|
||||
var fill_group: PackedInt32Array = PackedInt32Array()
|
||||
## The sea level the flood was last spread for.
|
||||
var sea_level: float = Tuning.SEA_LEVEL_START
|
||||
## Counts every pour, so a view can tell the flooded cells changed without comparing
|
||||
## them. Not match state.
|
||||
var pours: int = 0
|
||||
|
||||
## Filling groups: group ID -> {"level": float, "cells": PackedInt32Array}.
|
||||
var _groups: Dictionary = {}
|
||||
@@ -233,6 +236,7 @@ func _passable(from: int, to: int) -> bool:
|
||||
## Water pours across an edge into `to`, and on through everything it can reach. The
|
||||
## reached cells fill together, from their lowest floor up.
|
||||
func _pour(to: int) -> int:
|
||||
pours += 1
|
||||
flooded[to] = 1
|
||||
var queue: PackedInt32Array = PackedInt32Array([to])
|
||||
_spread(queue)
|
||||
|
||||
Reference in New Issue
Block a user