Repository navigation
Ariadne: boat fleets in the entity layer (boat-rudder plan P4a) - #1579
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Boat fleets drawn like car fleets: the entity layer takes
dynamicboatworld 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) androom_view::update_entitiesused to keep every floating vehicle as its own node. A boat now goes to the firstentity_layerwhoseof:takes it, as a car does. Above the layer's threshold it is instanced, and the nearestpromoteboats keep their own nodes.The boat fit is shared.
boat_fit_ofmoves from boat_node.cpp into vehicle_view (boat_fit,boat_fit_of). Theboatnode, a world boat's own node and the layer all use it:dyn_boat_desc::length_overall;A box-look boat's template is its hull.
vehicle_look_mesh_oftakes an optionalboat_descand draws the hull asadd_hull_nodedoes: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.
vehicle_look_mesh::hull) now takes a model's four rungs, each colour role decimated on its own.mesh_lod'sdecimate_mesh_by_role. The fallback now lives there, as an optionalrole_decimationscache that a ladder of rungs passes from finer to coarser.make_rungspasses it;swarm_nodesdoes not, so the swarm view is unchanged.entity_view::posemarks 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::sentcounts 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: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
boatnode 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_entitiessends a boat's keel as itsbase_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::entitiesand 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_entitiesboats: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).lod: false):AriadneWorldBoats.ABoatsModelSitsOnItsKeelOnARelaysClients: a relay'sroom_entityfor a launch carries the keel asbase_zand its length overall asfit_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:tacticalboats in a box look (their hulls), drawn byarigl snapshot --fps 1000at 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.
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.
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
entity_view.hheader comment.vehicle_view.hcomments:boat_fit, the hull branch,sync_vehicle_markers.room_entity::base_z.