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:
@@ -51,6 +51,11 @@ func collect_seeds() -> void:
|
||||
seeds.append(bytes)
|
||||
if tick % 10 == 0:
|
||||
seeds.append(game.snapshot_for(1))
|
||||
seeds.append(NetFx.encode([
|
||||
{"kind": NetFx.SHOT, "tick": 90, "player": 3, "item": 2, "position": Vector3(100.0, 12.0, 200.0), "yaw": 1.0, "pitch": -0.2},
|
||||
{"kind": NetFx.IMPACT, "tick": 91, "player": 3, "item": 2, "position": Vector3(110.0, 11.0, 210.0), "hit": Weapons.HIT_PLAYER, "target": 7},
|
||||
{"kind": NetFx.HARVEST, "tick": 92, "player": 4, "item": -1, "position": Vector3(50.0, 9.0, 60.0), "prop": 12, "piece": 0},
|
||||
] as Array[Dictionary]))
|
||||
var command: PlayerCommand = PlayerCommand.from_input(12, Vector2(0.3, 1.0), 1.0, 0.2, PlayerCommand.BUTTON_FIRE, 2, 1)
|
||||
seeds.append(NetSnapshot.encode_input(40, [command, command] as Array[PlayerCommand]))
|
||||
seeds.append(NetProtocol.encode_hello("Fuzzer"))
|
||||
@@ -100,7 +105,7 @@ func feed(bytes: PackedByteArray) -> void:
|
||||
var results: Array = [
|
||||
NetProtocol.decode_hello(bytes), NetProtocol.decode_welcome(bytes), NetProtocol.decode_reject(bytes),
|
||||
NetSnapshot.decode_input(bytes), NetSnapshot.decode_snapshot(bytes), NetSnapshot.decode_match(bytes),
|
||||
NetWorld.decode_world(bytes), NetWorld.decode_own(bytes),
|
||||
NetWorld.decode_world(bytes), NetWorld.decode_own(bytes), NetFx.decode(bytes),
|
||||
NetDiscovery.decode_query(bytes), NetDiscovery.decode_info(bytes), NetDiscovery.decode_register(bytes),
|
||||
NetDiscovery.decode_challenge(bytes), NetDiscovery.decode_list(bytes),
|
||||
]
|
||||
@@ -152,5 +157,6 @@ func _mutate(bytes: PackedByteArray) -> void:
|
||||
var types: Array[int] = [
|
||||
NetProtocol.MSG_HELLO, NetProtocol.MSG_WELCOME, NetProtocol.MSG_REJECT, NetSnapshot.MSG_MATCH,
|
||||
NetWorld.MSG_WORLD, NetWorld.MSG_OWN, NetSnapshot.MSG_SNAPSHOT, NetSnapshot.MSG_INPUT,
|
||||
NetFx.MSG_FX,
|
||||
]
|
||||
bytes[0] = types[rng.randi_range(0, types.size() - 1)]
|
||||
|
||||
Reference in New Issue
Block a user