Guide2 min read0 sections

Shared sliding props

docs/SLIDING_PROPS.mdSource updated 2026-10-24
Markdown
On this page 0 sections

World format 4 supports an interaction with kind: 'push' and push: {offset, steps}. Its linked scene objects form one prop; the interaction ID binds their transforms to a saved integer step. The offset is a single horizontal axis, 0.25–1 metre per push, with 1–16 steps. Each prop has one axis-aligned box collider and up to 16 primitive visual members. Imported models, animation, parent transforms, hinges and platforms are excluded from this binding. A world allows at most 32 props. games/engine-zoo/sliding-props.ts is independent reference content; the garden playtest uses the same contract.

The actor stands behind either end and interacts within the moving handle's radius. The elected browser authority resolves the direction and swept collision bounds. A request carries the observed propStep; a simultaneous or retried stale request cannot advance the prop again. Other travelers, static colliders and conservative platform-route bounds block a push. Rotated primitive bounds are conservative; imported collision in the place rejects a push. The optional action flag is set only at the last step and removed when pushed back.

Shared state adds an optional props map of authored interaction IDs to bounded integer steps. Room clients validate and own this map before publication. Existing revision, epoch, request receipt and atomic disk persistence rules apply. The relay still trusts the elected host's accepted result and client-reported poses. This does not implement trusted server simulation, impulses, free dynamic bodies or arbitrary continuous prop motion.

A client prepares replacement native collision, including existing platform poses and targets, before accepting a changed prop position. Motor velocity, jump-edge state and controller settings are preserved. Platform support is reacquired on the next tick. The new prop transforms, player and platform state publish in one ECS transaction; rejected publication disposes the candidate and retains the previous runtime. Saves, travel, route-clock alignment and full checkpoint restoration retain the prop position. Native collision and canonical prop transforms are checked during checkpoint restore. Worlds without props keep their previous state shape and checkpoint profiles.

This discrete implementation rebuilds a place's native collision on a prop step. It is appropriate for the bounded garden puzzle, not a high-frequency dynamic-body path. Broader physics and multiplayer roadmap acceptance remains open.

Verification lives in tests/sliding-props.test.ts and the lantern journey in tests/browser/ferry.spec.ts: obstruction, competing pushes, reversal, saves, native collision, transaction rejection, host handoff, late join and relay restart, plus two rendered players using real movement/interact keys.

End of Sliding props