links break only while this is true, so a structure can settle under its own weight first
nodes are held on or above this; null for none. Water, a gorge or a cliff face is the game's own business
ReadonlylinksReadonlynodesReadonlyonfires once for a link that passed its strength, which has already stopped carrying load
the highest smoothed load ratio across the links at the last step, for a strain gauge
adds a link between two existing nodes and returns its index
an external force on a node for the next step only (a wheel's weight, wind)
breaks a link now, as if it had passed its strength: it stops carrying load and onBreak fires. A broken link is left alone
a 32-bit FNV-1a hash of snapshot()'s exact bits: equal for equal states, whatever the machine
indices of the unbroken links with an endpoint or a crossing inside the box (a ship's hull, a blast area)
indices of the unbroken links whose segment passes within radius of a point, nearest first
Dynamic solver state and queued forces, for comparing runs with the same configuration. Game payloads and the ground callback are not captured.
advances one frame: the substeps, then the link loads and any breaking
A deterministic structure solver: point masses joined by springs, solved with extended position-based dynamics (XPBD), with the force in every link read back so a link can break at a real load rather than at a stretch.
The method (Macklin, Muller and Chentanaput's XPBD) moves each node freely for a substep, then corrects positions so every link returns to its rest length, with a compliance of
rest / stiffness / dt^2: a link behaves as a spring of the stated stiffness whatever the step or iteration count, and the correction's Lagrange multiplier divided bydt^2is the force it carried. Steps are fixed and nothing is random, so the same structure and the same calls give the same result on every machine, which is what replaying or validating a player's bridge needs.It is the engine of Pontifex (a bridge-building game), generalised: the vehicle, the water and the levels stay in the game, and what is here is only nodes, links, forces and breaking. Unlike
PhysicsWorldit has no rigid bodies or collisions: nodes and links only.Example
A bridge is a truss: beams are links, a cable is a link with
tensionOnly: true(it pulls when stretched and goes slack when pushed), and a link with astrengthbreaks at that load. A bare chain of planks has no vertical stiffness and only sags like a rope, so the deck needs triangles.Example