luvcraft/simulation.lisp
The block-world camera's 70-degree vertical field of view.
The 50-degree vertical field of view used during modal focus.
One complete, freely movable view pose used by a modal focus transition.
The five camera lanes of the frame uniform: position, basis, projection.
The environment lanes which complete the block are packed by
frame-uniform-data from the session's sky clock and profile.
Pack the five camera lanes for an eye at position with the unit basis
right up forward, in whatever coordinate space those are given in.
The ordinary camera packs its own pose through this; a display drawn in a space of its own (a phone screen in the hand) packs the same camera re-expressed in that space.
Ease camera's full view pose toward target and return the remaining error.
The first player controller is intentionally a small scalar reference simulation. Its body is distinct from the view camera, and its AABB queries the voxel lattice directly. This is the behavior later dense body/contact domains and SIMD kernels must preserve, not their final storage layout.
Predict unobstructed motion through the checked storage boundary. #GZ53LD
Treat absent horizontal terrain and the lower world boundary as solid.
A body is the small scalar contact abstraction which every walking thing in the world shares: an upright axis-aligned box, standing on its own position, swept one axis at a time against solid voxel cells. The player controller remains its reference implementation, and a critter is the same sweep with different dimensions and a different mind above it, so the contact code below is written against this protocol rather than against either participant.
body's world position at the centre of its base.
body's world velocity.
Half the width of body's square horizontal footprint.
How far body's box rises above its position.
Whether body rested on solid terrain after its last step.
body's intended level-ground speed in cells per second.
How quickly body changes horizontal velocity on the ground.
How quickly body changes horizontal velocity in the air.
body's downward acceleration magnitude.
body's upward speed when climbing a one-cell step.
body's current destinational movement action, or NIL.
Move body along axis and clamp its AABB against solid voxel cells.
Return true when body's AABB would be clear standing at X, Y, Z.
Advance body by one collision-checked walking step toward horizontal velocity.
target-x and target-z are velocities, not coordinates. This is the common
physical motor beneath held player input and discrete Move To actions: the
caller decides where to go; the body accelerates, collides, steps, and falls.
Advance the scalar player controller by one small physics step.
INTENT is what the player is trying to do rather than what they pressed: the controller asks for directions and a hurry, and never learns that there is a keyboard.
(name value &key type quantity documentation)Define an ordinary constant which publishes its represented quantity. The runtime value remains the unwrapped result of VALUE. TYPE states its Common Lisp representation independently of QUANTITY's semantic declaration; VALUE-DECLARATION-FOR retrieves the latter at definition boundaries.
The block-world camera's 70-degree vertical field of view.
The 50-degree vertical field of view used during modal focus.
(x y z)A standard class whose annotated slots retain quantity declarations. Slot access and instance representation remain ordinary CLOS. The metaclass only makes definition-time meaning inspectable and inheritable. #OXBSAY
(camera)(camera)(camera)(camera)(view previous inspection-parameters ink-strength player
&optional (bevel-width luft:+mesh-bevel-width+) (exposure 1.0f0))Multiplication and scalar scaling.
Subtraction or unary negation.
(session width height &key camera-lanes)Pack the frame environment: camera lanes plus the evaluated sky. Lane order must match *FRAME-UNIFORM-MEMBERS* exactly; the construction-time check in BLOCK-WORLD-CAMERA-UNIFORM-SIZE keeps the two honest. CAMERA-LANES may replace the session camera's own five lanes with a camera expressed in some other space; the…
(position right up forward field-of-view width height)Pack the five camera lanes for an eye at POSITION with the unit basis RIGHT UP FORWARD, in whatever coordinate space those are given in. The ordinary camera packs its own pose through this; a display drawn in a space of its own (a phone screen in the hand) packs the same camera re-expressed in that space.
Division of two represented quantities.
PROPERTY: VALUES; -- the property a keyword, the values a list written space-separated.
(name)Return the represented-value declaration published by global NAME, or NIL.
(declaration)Return DECLARATION's backend or Common Lisp representation type, or NIL.
(position)(camera)(target current)The non-negative remainder of integer division.
Addition over compatible quantities.
(camera pose)(camera target seconds)The maximum of compatible quantities.
(vector)The componentwise absolute value of a raw value.
(name parameters &body body)Name a compatible derived quantity.
(&key representation-type quantity-specification quantity-layout source-form)(options &key (default-tensor-order 0))Parse one source declaration plist into a quantity specification. Return NIL when OPTIONS contains no quantity attributes. This is the common source seam used by arithmetic parameters, shader interfaces, and semantic storage declarations; callers retain ownership of their source-specific error conditions and…
(definition &key parameter-representation-types result-representation-type)(record slot-name)(realization actual-parameter-declarations
&key actual-result-declaration)(player seconds)(player)(player)(player)(player)(player)(player)(camera)(camera player)(world x y z)(world x y z)Return one site as BLOCK and :RESIDENT, or NIL and :ABSENT. This sparse world-coordinate accessor constructs coordinate descriptors and a chunk lookup key. It is appropriate for inspectors, ray hits, collision probes, and sparse interaction. Algorithms over many cells should select a chunk/domain once and use…
(block)Test whether one compatible scalar is less than another.
(body)How quickly BODY changes horizontal velocity on the ground.
One named verb over a session.
(body)(body)(body)(minimum maximum)(function body world)(body world axis distance)(vector axis)The minimum of compatible quantities.
Logical conjunction of tests and raw truth values.
(value target maximum-change)Test whether one compatible scalar is greater than another.
(player x y z)(body world x y z)(body world target-x target-z seconds &key jump-p)Advance BODY by one collision-checked walking step toward horizontal velocity. TARGET-X and TARGET-Z are velocities, not coordinates. This is the common physical motor beneath held player input and discrete Move To actions: the caller decides where to go; the body accelerates, collides, steps, and falls.
Logical negation of one test or raw truth value.
Logical disjunction of tests and raw truth values.
(name-and-options lambda-list &body body)Define a function whose complete dynamic extent is an ambient trace zone. The inferred name is PACKAGE/FUNCTION. Use (NAME :ZONE ZONE-NAME) to provide a more semantic name and :VALUE FORM to attach a Tracy work count.
Advance the scalar player controller by one small physics step. INTENT is what the player is trying to do rather than what they pressed: the controller asks for directions and a hurry, and never learns that there is a keyboard.
(intent positive negative)The componentwise square root of a raw value.
Intent: make a declared CLOS or structure field usable as an input or output of one checked arithmetic definition without wrapping each runtime value. The boundary should compare the stored representation and quantity declaration with the arithmetic parameter once, choose the existing Lisp realization, and then call…
The first-person view and the scalar reference player simulation.
Camera mathematics stays small and inspectable: five vec4 values form the prefix of the frame uniform block. The player controller is intentionally a small scalar reference simulation whose body is distinct from the view camera and whose AABB queries the voxel lattice directly. This is the behavior later dense body/contact domains and SIMD kernels must preserve, not their final storage layout.