A2: Player figure and animation
The islander is built in headless Blender (tools/models/figure.py, `make figure`, `make art`) as twelve rigid parts with their origins at their joints: an oilskin coat, a sou'wester, sea boots, a bedding roll and the canvas wing-sail. Debian's Blender can't write glTF, so the figure is jointed rather than skinned. FigureRig hangs the parts on pivots, paints them from Palette with the coat in the player's own oilskin, and plays FigurePoses' hand-written key poses through one AnimationTree: idle, walk and run by speed, crouch and creep, air, skydive, glide, swim and aboard; long, short and carried holds; reload and use layers; fire, boathook swing, keg throw and building as one-shots; and a flinch when health drops. The chest takes a third of the pitch and the held item all of it. Figures animate from replicated state only: positions, look, health, the held item and the FLAG_ bits (reloading and using now reach mirrored players), with actions from FX. Every boathook swing is now a sim "swing" event, sent as a SHOT with no item, so misses are seen and heard; the new FX kind PLACE shows pieces placed. Protocol version 4. Tests: test_figure_rig (15), plus swing and PLACE cases in test_harvest and test_net_fx. make check passes (604 tests); make client-check passes. Captures: figure_states, figure_actions, figure_close (make figure-captures), client_glide and client_landed. Closes #42 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+18
-3
@@ -1,6 +1,7 @@
|
||||
extends TestCase
|
||||
|
||||
## Issue N11: shots, impacts and swings on the wire (NetFx).
|
||||
## Issue N11: shots, impacts and swings on the wire (NetFx). A2 added boathook swings
|
||||
## that miss (a SHOT with no item) and pieces placed (PLACE), for the figures.
|
||||
|
||||
|
||||
func _records() -> Array[Dictionary]:
|
||||
@@ -9,6 +10,7 @@ func _records() -> Array[Dictionary]:
|
||||
{"kind": NetFx.IMPACT, "tick": 401, "player": 3, "item": 2, "position": Vector3(130.0, 11.0, 220.0), "hit": Weapons.HIT_PLAYER, "target": 700},
|
||||
{"kind": NetFx.HARVEST, "tick": 402, "player": 4, "item": -1, "position": Vector3(50.0, 9.0, 60.0), "prop": 12, "piece": 0},
|
||||
{"kind": NetFx.HARVEST, "tick": 402, "player": 5, "item": -1, "position": Vector3(51.0, 9.0, 61.0), "prop": -1, "piece": 33},
|
||||
{"kind": NetFx.PLACE, "tick": 402, "player": 6, "item": -1, "position": Vector3(52.0, 10.5, 62.5), "piece": 41},
|
||||
]
|
||||
|
||||
|
||||
@@ -18,8 +20,8 @@ func test_records_survive_the_trip() -> void:
|
||||
assert_false(message.is_empty())
|
||||
assert_eq(message["tick"], 402)
|
||||
var events: Array = message["events"]
|
||||
assert_eq(events.size(), 4)
|
||||
for index: int in 4:
|
||||
assert_eq(events.size(), 5)
|
||||
for index: int in 5:
|
||||
var sent: Dictionary = _records()[index]
|
||||
var got: Dictionary = events[index]
|
||||
for key: String in sent:
|
||||
@@ -64,3 +66,16 @@ func test_malformed_messages_are_refused() -> void:
|
||||
var bad_kind: PackedByteArray = bytes.duplicate()
|
||||
bad_kind[NetFx.HEADER_BYTES] = 9
|
||||
assert_true(NetFx.decode(bad_kind).is_empty(), "unknown kind")
|
||||
|
||||
|
||||
func test_swings_and_placed_pieces_from_the_simulation() -> void:
|
||||
var swing: Dictionary = NetFx.from_event({"type": "swing", "player": 9, "from": Vector3(1.0, 2.0, 3.0), "direction": Vector3.FORWARD}, 80)
|
||||
assert_eq(swing["kind"], NetFx.SHOT)
|
||||
assert_eq(swing["item"], -1, "a swing is a shot with no item")
|
||||
var placed: Dictionary = NetFx.from_event({"type": "piece_placed", "player": 9, "piece": 12, "kind": 0, "material": 0}, 80, {9: Vector3.ONE}, {12: Vector3(4.0, 5.0, 6.0)})
|
||||
assert_eq(placed["kind"], NetFx.PLACE)
|
||||
assert_eq(placed["piece"], 12)
|
||||
assert_eq(placed["position"], Vector3(4.0, 5.0, 6.0), "at the piece")
|
||||
var unknown: Dictionary = NetFx.from_event({"type": "piece_placed", "player": 9, "piece": 13}, 80, {9: Vector3.ONE})
|
||||
assert_eq(unknown["position"], Vector3.ONE, "at the builder, without the piece's centre")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user