T-009: Soft-body physics
Goal
The physics that lets bodies made of bonded cells move in many different ways. This ticket
decides whether the world can ever show varied locomotion, so it matters more than most.
See docs/DESIGN.md section 5.
Scope
- Bonds as position-based constraints with per-bond stiffness. Bodies must hold a shape, bend, and survive hard muscle pulls without exploding. Stable at the step size T-001 chose.
- Muscles: bonds whose rest length is driven by a control value each step. The control system (T-013) will supply that value. Expose the interface and test it with a scripted wave.
- Drag that depends on direction (a rod moving sideways resists more than one moving lengthwise) with a linear part and a squared part, so small slow bodies and large fast bodies live in different regimes. Interior cells are shielded.
- Buoyancy and gravity from per-cell density. A current field pushes everything.
- Terrain: collision with a height field, with friction, so crawling is possible. Anchors bond a cell to the terrain.
- Cell-to-cell collision between different bodies, using the shared spatial index.
- All coefficients in
Params.
Done when
- ☐ Hand-built test bodies each move by a different mechanism under scripted muscle waves: an undulating chain swims, a rower with two limbs swims, a pulsing bell rises, a floor crawler crawls, a float rises and an armored lump sinks.
- ☐ A tiny body with a simple open-and-close stroke makes almost no progress, while a large one does (the two drag regimes work).
- ☐ No explosions in a 100,000-step soak test with random muscle input.
- ☐ Benchmark from T-001 re-run and logged. Say what the physics costs per cell.
Notes
- The water itself is not simulated. No wakes or vortices.
- Volume or shape preservation for blobs of cells is a gap in the design. Decide how bodies resist collapsing and record it.
Added 2026-12-02: honest physics for any body, at any size
Read "Open-ended bodies" and "Scale is free" in docs/DESIGN.md section 5 first. The lists
there are examples of the spirit. They are not your acceptance tests. The physics must not
know what a body part is, and must not behave differently at different sizes for numerical
reasons.
Extra done-when checks:
- ☐ Random stress test. A generator builds random bodies across the full
Paramsranges of cell size, mass, stiffness and density, as lines, sheets, shells, lumps, branches and mixtures, from one cell to thousands, and lets them move and collide. Kept as an automated test: nothing explodes, jitters at rest, stretches past its limits or gains energy from nowhere. - ☐ Extremes together. Very small cells bonded to very large ones, and very stiff parts next to very soft ones, stay stable. State the ratios the solver holds and what happens beyond them.
- ☐ Function from physics. Show with probe bodies of your own choosing that shape alone gives function. For example: a flat part pushes more water broadside than edge-on, stiff parts driven by a muscle can grip another body, a thin part can hold something away from the body. Choose probes that differ from each other, and include some that are not in the design's examples.
- ☐ Scaling. The same body shape built at several sizes across a few orders of magnitude in mass. Measure speed, cost of travel, sinking speed and stability at each. Say which differences are physics and which are the solver. Check that the change from thick-water movement to coasting falls inside the range of sizes bodies can be.
The orchestrator will try bodies you have not seen when reviewing.
Added 2026-12-02: notes from the sim core review
index.rspads every contact query by the largest cell radius in the whole world, so one very large cell slows every query. With cell size as a gene this matters. You own contacts, so you may change the index for this. Fix it, or measure the cost with very mixed sizes and report it.- T-001 measured that about two thirds of a placeholder step is the neighbour query, which mostly finds the organism's own cells. A cheap bound per organism first would likely help.
- Add what you learn about speed to
docs/perf/IDEAS.md.