DfCreature
The driver every animal in Deep Field runs on. One component, thirteen species. Put on an entity under `df_fauna_rig` with a `speciesId`, it reads that species' spec (documented in `game/df_core.module`) and turns it into a sighting.
DfCreature
The driver every animal in Deep Field runs on. One component, thirteen
species. Put on an entity under df_fauna_rig with a speciesId, it reads
that species' spec (documented in game/df_core.module) and turns it into a
sighting.
local e = entity.spawn("df_sighting", { parent = entity.find("df_fauna_rig") })
e.component.add("DfCreature", { speciesId = "moonjelly" })
DeepFieldGame does that; a fauna slice testing one animal can do it by
hand.
What it supplies, and what the species supplies
This component owns the arc: where the animal comes up from, how fast it
closes, where it holds, how it answers the lamp, when it turns, and how it
leaves. The species module owns the body (build), the swim
(animate) and the plate (plate).
It comes up from below and always on the far side of the lure, with its bearing drifting and its elevation shallowing as it closes — because the frame is 1080 wide and 1440 tall, and a portrait frame has depth to spare and no width at all.
What animate is handed
animate(root, t, ctx) runs every frame of a sighting. t is seconds since
the sighting began. ctx carries:
| key | |
|---|---|
brightness | the lamp dial, 0..1 |
distance | metres from the lure |
fleeing | it has turned and is leaving |
readability | Core.readability right now: 0 silhouette, 1 full detail |
startled | the lamp was just turned up on it |
dt | seconds |
Grade an animal's own display off readability rather than off
brightness, so the journal's promise stays one number.
Bioluminescence
A species with glow = {r,g,b} and glowStrength > 0 gets a real point
light on its root. It is driven every frame: brighter when the lamp is dim
(counter-illumination answers the light around it), pulsed at a rate keyed
to the species' rarity, and flared when the animal is startled or fleeing.
Fields
speciesId (set at attach), and the read-only-in-practice distance,
age, fleeing, readability, endReason.
Method
:leave(reason) — the session calls this when the player commits a name, so
the animal goes the way the outcome says. reason is "identified",
"fled", "missed" or "lost", and it is what rides on sighting:end.
Events it emits
sighting:begin, sighting:near (first entry into the lamp's throw), and
sighting:end — exactly once, whatever ends it.
Slice owner: core-loop.
Scoped to this part · feeds back into the world's score.