Log inGet started
World

Fly Circus — The Living Simulation

Branchmain
Branchesmain
Commitff727ce6b1

README.md

flyBody

A fruit fly's body, built as an entity tree and posed frame by frame.

build(root, species, env) stands one fly's anatomy under an entity the caller owns — the entity that IS the fly, carrying FlyAgent and moving through the world. bind(root, species) walks that tree by name and hands back the same shape, which is how the agent poses a body it did not create, and how it recovers the rig after a hot-reload when the module's own memory of it is gone. pose(refs, state) moves the joints.

The anatomy, and how it is jointed

A head that is mostly two compound eyes, an antenna each side, a proboscis folded under it; a thorax wider than the head — the box the flight muscles are in; a three-segment abdomen; two wings; six legs.

The joints are nested rather than composed arithmetically: a leg is a hip that swings, holding a spread that points outward, holding a femur and a knee, holding a tibia and a foot. Each link sets only its own local rotation and the hierarchy multiplies them, so a gait is one number per joint instead of a quaternion the author has to get right by hand. The same trick spreads a wing with an inner yaw and flaps it with an outer roll, and lets a wing's beat and its fold be set independently.

Posing

pose takes one table describing what the creature is doing this frame:

FieldMeaning
flying0..1, how much of its weight the wings carry — legs fold away as it rises
flap0..1 wing drive, taken straight off the brain's flight pool
walk0..1 leg drive; the gait is a tripod, legs 1/3/5 against 2/4/6
feeding0..1 proboscis extension, and the abdomen pulses as it drinks
alert0..1 lifts the head and sweeps the antennae
speedunits per second, which sets the leg cadence and the lean

Each species' temperament.tempo scales the wing beat, so a Kinger beats his wings slowly and a Pomni fast, from the same code.

Sizing

The creature is about 0.6 world units long, which is small beside a 34-unit big top and a 1.8-unit visitor: a fly you can walk up to and watch, not a monster. STAND_CLEARANCE is how far its body sits above whatever it is standing on.