World
A simulation world. Owns the actor pool, the snapshot store, and the
projectile definitions registry. Built by Hindsight.createWorld.
A typical server uses one World; clients use one World per peer for
visuals only. Server and client Worlds do not share state — both speak the
same definitions module independently because each Actor requires the
module in its own VM.
Properties
rollback
World.rollback: Rollback
The rollback store. See the Rollback class for the full
method list.
Functions
cast
Fires a projectile. Resolves options.type against the definitions module,
then dispatches to the least-loaded simulation actor in the pool.
On the server, timestamp should reflect the moment from the shooter's
perspective — typically clientTimestamp - playerPing - interpolation.
On the client, workspace:GetServerTimeNow() is fine — the client World
has no rollback path.
hitscan
Resolves a single-frame ray. Server-side, queries the rollback store for
lag-compensated character hits using options.timestamp; the projectile
loop is bypassed entirely. Client-side, only world geometry is tested —
the client World has no rollback path, so onIntersection will not fire.
Reuses the same ProjectileDefinition as
cast. Hitscan-relevant fields: range, power, angle, loss,
collaterals, raycastFilter, filter, onImpact, onIntersection.
Projectile-only fields (velocity, gravity, lifetime) are ignored.
onDestroyed is not fired by the hitscan path — the terminal callback
is the last onImpact or onIntersection. Out-of-range scans fire no
callback at all.
Penetration and ricochet behave identically to the projectile path,
bounded by MAX_ITERATIONS (16) to prevent runaway bounces.
destroy
World:destroy() → ()
Tears down the simulation actor pool. Disconnects every Output binding,
destroys every Actor, and clears internal references. After destroy, the
World is unusable — build a new one with Hindsight.createWorld.