Dead organism decay
By Robin Dowling · 3 months ago
When organisms died in the simulation, they vanished instantly. One moment they were there, the next they were gone. This created a jarring experience, you couldn't tell when or why an organism died, and you couldn't see the patterns of death across the ecosystem.
I changed death to be gradual and visible. When an organism dies, it now remains in the world for a while, visually decaying over time. Motile organisms tilt to the side, as if fallen over, and gradually darken. Sessile organisms simply darken in place. Eyes close on dead motile organisms. A death indicator appears in the organism's label.
The decay is tracked over adjustable time, currently 50 iterations. Each iteration increments the decay value, and the visual effects intensify accordingly. After reaching full decay, the organism is removed from state entirely. As before, its energy is transferred to the soil, made available for plants to consume.
This change required coordinating state between server and client. The server tracks each organism's death decay value and includes it in broadcasts. The client reads the value and applies appropriate visual effects—rotation, darkening, closed eyes.
Both pooled and non-pooled rendering paths support death effects. Movement and interaction systems skip dead organisms while keeping them positioned in the world. The visual effects are applied idempotently to prevent duplicate transformations if an organism is rendered multiple times during decay.
The impact on understanding the simulation is significant. You can now see where organisms are dying: starvation clusters in food-depleted areas, death along territorial boundaries between species, mass die-offs during disease outbreaks. You can watch predation events complete rather than having the prey vanish mysteriously. You can see the lifecycle close rather than experiencing it as a sudden disappearance.
Death statistics also shifted from tracking only cumulative totals to including current dead count. This gives a clearer picture of ecosystem health. A stable population maintains a consistent rate of deaths matching births, while a collapsing population shows deaths accumulating.
It's a more realistic representation of how ecosystems work. Death is visible, gradual, and part of the ongoing cycle rather than an instant state transition.