Skip to content

Ariadne: boat fleets in the entity layer (boat-rudder plan P4a) - #1579

Merged
transfix merged 3 commits into
masterfrom
ariadne/boat-fleets-layer
Nov 27, 2026
Merged

transfix merged 3 commits into
masterfrom
ariadne/boat-fleets-layer

Conversation

@transfix

@transfix transfix commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

Boat fleets drawn like car fleets: the entity layer takes dynamicboat world vehicles. This is phase P4a of the boat-rudder plan (moving outboards and props), and it needs neither the new parted boat model nor the parts code.

What changes

  • Boats are no longer skipped. world_entities (entity_view.cpp) and room_view::update_entities used to keep every floating vehicle as its own node. A boat now goes to the first entity_layer whose of: takes it, as a car does. Above the layer's threshold it is instanced, and the nearest promote boats keep their own nodes.

  • The boat fit is shared. boat_fit_of moves from boat_node.cpp into vehicle_view (boat_fit, boat_fit_of). The boat node, a world boat's own node and the layer all use it:

    • the model is fitted to dyn_boat_desc::length_overall;
    • its keel sits on the hull's bottom, in hull-body z;
    • it is drawn about the hull body's origin, which is what the binding poses.
  • A box-look boat's template is its hull. vehicle_look_mesh_of takes an optional boat_desc and draws the hull as add_hull_node does:

    • flat-shaded;
    • topsides in role 0 and the stripe in role 1, which are the entity's two colours;
    • the wet bottom and a box hull's teak sole in role 2, in their own colours;
    • a box hull stays open, with no deck.

    Both draw from one helper (hull_faces_of), so the node and the layer cannot drift apart.

  • The hull has LOD rungs, and still rungs are not re-sent (second commit, after the first bench). The first bench had 240 boats in the layer 3-4x slower than one node each. There were two causes. The hull was not a model, so it got one rung: the whole hull for every copy. And the layer packed and uploaded every rung every frame, even with nothing moving.

    • A boat's box look (vehicle_look_mesh::hull) now takes a model's four rungs, each colour role decimated on its own.
    • A role that collapses at a rung's reduction keeps its coarsest decimation so far, not its whole mesh. The launch's coarsest rung was 484 points a copy and is now 18. This also covers a car model's small roles.
    • Merged with master: master's Ariadne: the Humvee in parts by default, its wheels turning; one Humvee loader #1569 moved this per-role decimation into mesh_lod's decimate_mesh_by_role. The fallback now lives there, as an optional role_decimations cache that a ladder of rungs passes from finer to coarser. make_rungs passes it; swarm_nodes does not, so the swarm view is unchanged.
    • entity_view::pose marks a member moved only when its pose changes. A rung drawing the same members, none of them moved, is not packed or sent: a parked fleet or a paused world uploads nothing and doesn't re-bake shadows. entity_view_stats::sent counts the rungs sent in the last draw.
  • Promoted boats match the layer. In sync_vehicle_markers, a world boat with a one-piece model used to go down the car path:

    • it was fitted to its hull's box length, not its length overall;
    • its base went to ground_z - z, which for a boat is the lake bed under it, so the model was drawn on the bottom.

    It now gets the boat fit, as the boat node does. It shows its hull while the model loads or when the model can't be read. Without this, a boat would jump in size and height when it was promoted.

  • Relay clients. room_entities sends a boat's keel as its base_z, not the bed's depth. The relay sends no hull, so a box-look boat on a client is its box, as its own node already was there.

  • Water. A layer-drawn boat still keeps the water out of its hull. The water node reads the world's boats (WorldVehicles::entities and the archetype's cutout), not their nodes, and keeps the 4 nearest boats out as before. A test checks it.

  • Parted looks on a boat (a car's rig) keep their own node. A parted boat's template belongs to P4b.

Tests

  • cvcgl_ariadne_entities boats:
    • The hull template's points, normals, triangles and roles match add_hull_node's node, point by point. This covers the launch (a box hull, which gets the teak sole) and the tactical boat (a V hull, which has none).
    • 40 launches on a lake:
      • they are drawn in the hull's four rungs: the finest is the whole hull, the coarser ones have fewer points;
      • the 8 nearest get their hull nodes;
      • each rung's copies are where unpromoted boats are, and every rung drawn keeps the red bottom and the coloured topsides;
      • with the world paused no rung is sent; going on, they are;
      • the water's 4 hull cutouts are set.
    • 40 tactical boats with a one-piece model (lod: false):
      • a promoted boat's node is the model, with its keel at the hull's bottom;
      • each copy's lowest point is its boat's keel, and its length along its heading is the boat's length overall.
  • AriadneWorldBoats.ABoatsModelSitsOnItsKeelOnARelaysClients: a relay's room_entity for a launch carries the keel as base_z and its length overall as fit_length.

Bench

The bench world is a 640 m lake with water at -1 m, wind 3 m/s and waves 0.25 m, with 60 and 240 dynamicboat:tactical boats in a box look (their hulls), drawn by arigl snapshot --fps 1000 at 1280x720 in the chase and overhead views. A frame's cost is (T(800 frames) - T(200 frames)) / 600, with six interleaved runs of each case, reported as medians with ranges. It ran on a box busy with other builds, so only the interleaved comparisons count.

The physics dominates. One 1/120 s step (physics.stats.step_ms) takes about 90-140 ms for 60 boats and 350-600 ms for 240 (the box's load differed between the two runs), and a snapshot frame runs four steps. So each run pauses the world at frame 25, and the frames after it time the drawing alone. The step is reported separately, from the prints before the pause. In a paused world the nodes cost nothing to pose, while the first commit's layer re-sent every copy every frame.

First commit (1687fbf): the hull as one full-detail rung, every rung sent every frame.

View Boats Each its own node Layer
chase 60 46.6 (30.0-48.5) 49.5 (42.5-84.7)
chase 240 33.8 (31.6-88.0) 127.1 (97.6-173.4)
overhead 60 39.7 (29.6-45.7) 47.0 (18.3-66.4)
overhead 240 46.6 (40.2-77.7) 147.1 (123.7-209.5)

ms a frame. Physics step: 130-140 ms for 60 boats (range 94-247) and 555-677 ms for 240 (range 382-1500).

Second commit (928afcb): the hull's four rungs, and a rung of unmoved boats not sent again. The third column is the layer from a build of 928afcb that sends every rung every frame, as a moving fleet's are, so the paused world still times the packing a moving fleet pays.

View Boats Each its own node Layer Layer, every rung sent
chase 60 35.1 (26.8-42.5) 32.2 (25.3-39.0) 35.6 (33.6-44.2)
chase 240 32.1 (28.2-39.3) 26.7 (21.5-42.7) 34.8 (25.0-40.5)
overhead 60 34.7 (26.6-38.3) 31.7 (27.2-38.4) 34.0 (30.5-39.1)
overhead 240 34.7 (25.1-46.8) 37.4 (29.3-41.8) 35.6 (31.6-41.8)

ms a frame. Physics step: medians 85-99 ms for 60 boats (range 73-137) and 345-386 ms for 240 (range 295-726).

For scale, a one-boat world (run after the bench, not interleaved with it; 4 runs) draws a frame in 28.4 ms (26.5-31.5) in chase and 26.5 ms (24.8-29.1) overhead, with a 0.94 ms step. So most of each frame above is the world's own cost, not the fleet's.

The three cases fall within each other's ranges at every size and view. The layer no longer costs more than each boat as its own node, even with every rung sent every frame: the far copies are now decimated instead of the whole hull (in the test, a launch's 484 points become 48 and 18 on the coarse rungs), so packing 240 of them is small. Drawing the fleet does not limit a boat fleet on this box; the boat physics does (four steps a frame, about 1.5 ms a boat a step: some 0.35 s a step for 240 boats). That is a follow-up on dyn_boat_plant's step, not part of this PR. A moving world's nodes also pay for posing every frame, which this paused bench does not time.

Docs

  • The entity_view.h header comment.
  • The vehicle_view.h comments: boat_fit, the hull branch, sync_vehicle_markers.
  • room_entity::base_z.
  • docs/ARIADNE.md, "At scale: entity layers".

The entity layer now takes dynamicboat world vehicles as it takes cars: a boat fleet is instanced,
the nearest boats promoted to their own nodes, instead of one node per boat.

- world_entities and room_view::update_entities no longer skip floating plants.
- boat_fit / boat_fit_of move from boat_node.cpp into vehicle_view, so the boat node, a world
  boat's own node and the layer fit a one-piece model alike: its length overall, its keel on its
  hull's bottom, about the hull body's origin.
- vehicle_look_mesh_of takes an optional boat_desc: a box-look boat's template is its hull, drawn
  as add_hull_node draws it (one helper, hull_faces_of, makes both): topsides role 0, stripe role
  1, wet bottom and a box hull's teak sole role 2.
- sync_vehicle_markers fits a world boat's one-piece model as the boat node does. It went down the
  car path before: fitted to its hull's box, its base on the lake bed (ground_z - z). Its hull
  stands in while the model loads or when it cannot be read.
- room_entities sends a boat's keel as its base_z.
- A boat in a parted look (a car's rig) keeps its own node; a parted boat's template is P4b.
- The water keeps out of a layer-drawn boat's hull as before: it reads the world's boats, not
  their nodes.

Tests: cvcgl_ariadne_entities `boats` (the hull template against add_hull_node's node point by
point; 40 launches at scale with their hull nodes and the water's cutouts; 40 tactical boats with
a one-piece model, the copies and the promoted nodes on their keels at their length overall);
AriadneWorldBoats.ABoatsModelSitsOnItsKeelOnARelaysClients. Docs: entity_view.h, vehicle_view.h,
room_entities.h, ARIADNE.md.
…gain

The bench of #1579's first commit had 240 boats in the layer 3-4x slower
than each its own node (127 against 34 ms a frame, chase, the world
paused). A boat's hull is not a model, so it had one rung, the whole hull
for every copy, and the layer packed and uploaded every rung every frame
even when nothing moved.

- A boat's box look (vehicle_look_mesh::hull) takes a model's four rungs,
  each colour role decimated on its own.
- A role that collapses at a rung's reduction keeps its coarsest
  decimation so far instead of its whole mesh (a small hull at the
  coarsest rung was drawn whole: the launch's lod3 was 484 points a
  copy, now 18).
- entity_view::pose marks a member moved only when its pose changed; a
  rung drawing the members it drew, none moved, is not packed or sent
  (a parked fleet, a paused world: no upload, no shadow re-bake).
  entity_view_stats::sent counts the rungs sent in the last draw.
- cvcgl_ariadne_entities: the launches' four rungs, their copies and
  bands at each rung, and a paused fleet sending nothing.
master's #1569 moved entity_view's per-role decimation into mesh_lod's
decimate_mesh_by_role. This branch's fallback (a role that collapses at a rung keeps
its coarsest decimation so far, not its whole mesh) now lives there, as an optional
role_decimations cache that a ladder of rungs passes from finer to coarser.
make_rungs passes it; swarm_nodes does not, so the swarm view is unchanged.
@transfix
transfix merged commit aff0d4c into master Nov 27, 2026
30 of 31 checks passed
@transfix
transfix deleted the ariadne/boat-fleets-layer branch November 27, 2026 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant