luvcraft/birthday/world.lisp
The meadow's shape, gathered as knobs so the party can be re-landscaped live. All readings stay pure functions of the source's seed and these globals, so any chunk regenerates bit-identically on any thread.
The period of the faint secondary swell that keeps hills from reading as a single sine.
Flower chance per grass column on the party lawn itself: a light freckle that leaves the gazebo's ground open.
No tree roots closer to the origin than this. It matches the blend ring, so the whole approach to the party stays open, not just the lawn.
The meadow surface at X,Z: gentle hills flattened into the party lawn.
Whether the grass at X,Z has burst into flowers.
Deterministic like every other terrain reading: a coordinate hash against a density that peaks in the wreath just outside the party clearing and fades with distance, leaving the far hills a sprinkle and the lawn itself lightly freckled.
Materialize one meadow terrain chunk at vertical layer zero.
The column fill mirrors the little world's; only the readings differ: meadow heights, and every surface grass or flowers.
Call emit with BLOCK X Y Z for the tree rooted in chunk owner-x,owner-z.
At most one tree per chunk, in about a third of them, and never inside the exclusion ring around the party. The shape is the little world's tree; the meadow's kindness is in where and how often it grows. The placement margin keeps trunk and canopy inside the owner chunk, so the direct populate path and the streaming landmark capture agree exactly.
Plant this chunk's tree, if it has one, into resident terrain.
Streaming. The inherited make-block-chunk-load-request would capture
stock landmarks, and its request's perform method rebuilds a stock
source in the worker, so the meadow carries its own request class.
Capture the meadow landmarks whose owned sites lie inside chunk key.
A chunk load whose worker rebuilds a birthday-world-source, so
off-thread terrain matches the meadow rather than the stock hills.
Persistence. Without these two methods a saved meadow would round-trip through the inherited :LITTLE-WORLD kind and wake up with stock hills.
Make the birthday meadow with resident chunks around the party lawn.
chunk-height defaults to 32 so there is sky room for balloons and
fireworks. chunk-radius NIL leaves the resident set empty for streaming
to fill, the way make-empty-little-block-world does.
((operation capture-op) (system asdf:system))Inside this distance from the origin the lawn is perfectly flat.
By this distance the lawn has fully blended into the hills.
The flat party lawn's surface height.
The mean surface height of the rolling meadow.
The long period of the meadow's one broad hill octave.
How far the broad hills swell above and below the base height.
The period of the faint secondary swell that keeps hills from reading as a single sine.
The faint secondary swell's amplitude.
Flower chance per grass column on the party lawn itself: a light freckle that leaves the gazebo's ground open.
Flower chance in the wreath between the lawn and the hills.
Flower chance far out in the hills.
Distance by which the wreath's density has faded to the far density.
No tree roots closer to the origin than this. It matches the blend ring, so the whole approach to the party stays open, not just the lawn.
(edge0 edge1 value)The maximum of compatible quantities.
The minimum of compatible quantities.
Division of two represented quantities.
Subtraction or unary negation.
Multiplication and scalar scaling.
The componentwise square root of a raw value.
Convert one scalar float or unsigned value to a 32-bit float.
Addition over compatible quantities.
(source x z height)(source x z period &optional (salt 0))(source x z)Whether the grass at X,Z has burst into flowers. Deterministic like every other terrain reading: a coordinate hash against a density that peaks in the wreath just outside the party clearing and fades with distance, leaving the far hills a sprinkle and the lawn itself lightly freckled.
Test whether one compatible scalar is at most another.
Test whether one compatible scalar is less than another.
(source x z &optional (salt 0))(source x z)(source world chunk-x chunk-z)Materialize one meadow terrain chunk at vertical layer zero. The column fill mirrors the little world's; only the readings differ: meadow heights, and every surface grass or flowers.
((world) &body body)(world x y z)(domain)(chunk offset)Test whether two compatible scalars are equal.
Logical disjunction of tests and raw truth values.
(source world chunk-x chunk-y chunk-z)(source width height depth
owner-x owner-z emit)Call EMIT with BLOCK X Y Z for the tree rooted in chunk OWNER-X,OWNER-Z. At most one tree per chunk, in about a third of them, and never inside the exclusion ring around the party. The shape is the little world's tree; the meadow's kindness is in where and how often it grows. The placement margin keeps trunk and…
The non-negative remainder of integer division.
Logical conjunction of tests and raw truth values.
Test whether one compatible scalar is greater than another.
The componentwise absolute value of a raw value.
(source world chunk-x chunk-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…
(source world chunk-x chunk-y chunk-z)(source world key demand-token priority)Make the off-thread load request which produces resident chunk KEY. Return NIL when SOURCE cannot generate chunks away from the owning thread; the session then keeps KEY desired without scheduling work for it. A returned request must carry the production key (:LOAD KEY) so it matches the session's outstanding-work…
(source world key)A chunk load whose worker rebuilds a BIRTHDAY-WORLD-SOURCE, so off-thread terrain matches the meadow rather than the stock hills.
(name-and-options &rest method-tail)Define a method whose complete dynamic extent is an ambient trace zone. The inferred name includes the generic function, non-T required specializers, and qualifiers. :ZONE and :VALUE have the same meaning as in ZDEFUN.
(request)Compute REQUEST on the production worker and return a transferable value.
(&key (id (gensym "BLOCK-WORLD-"))
(chunk-width 16)
(chunk-height 16)
(chunk-depth 16)
(cell-extent 1d0)
source)(world x y z)(source)Return SOURCE as portable semantic data, excluding resident chunks.
(kind description)Restore a world source named by keyword KIND from DESCRIPTION.
(plist key context &key optional default)(descriptions)(&key (seed 121) (chunk-radius 4)
(chunk-height 32))Make the birthday meadow with resident chunks around the party lawn. CHUNK-HEIGHT defaults to 32 so there is sky room for balloons and fireworks. CHUNK-RADIUS NIL leaves the resident set empty for streaming to fill, the way MAKE-EMPTY-LITTLE-BLOCK-WORLD does.
(&key (chunk-width 16)
(chunk-height 16)
(chunk-depth 16)
(seed 121))(source world center-x center-z &key (radius 4))Materialize a square resident window and evict everything outside it. Return the entering and leaving chunk-coordinate keys. Entering chunks are created as one staged transaction: establish all desired domains, materialize terrain, populate landmarks, then replay sparse edits.
The birthday meadow: a gentle world for a small person to run around in.
A
birthday-world-sourceis alittle-world-sourcewith kinder geography: low, long-period grassy hills, every surface grass rather than a biome rule, and one flat party clearing around the origin, smoothstep-blended into the hills so the gazebo gets a natural lawn. Flower blocks freckle the grass from the same coordinate hashes the little world uses -- never randomness -- densest in a wreath around the clearing. Trees are sparser than stock and never root inside the clearing ring.Edits, residency, and lighting semantics are inherited from the little world. Two inherited paths would quietly hand a subclass stock terrain, so both are specialized here: the off-thread chunk load (the stock request's
performmethod rebuilds alittle-world-sourceby name, and its landmark capture calls the stock generator) gets its own request class, and persistence gets its own :BIRTHDAY-MEADOW save kind so a world saved under worlds/alex-birthday.sexp comes back as the same meadow plus edits.