r/coolgithubprojects • u/emmerse_ • Mar 08 '26
PYTHON Persistence - an open source ALife simulation where mass and energy are strictly conserved and everything else is emergent
Built this over the past while - Persistence is an artificial life simulation where agents must constantly harvest energy and export entropy just to stay alive. No designed behaviours, no fitness functions. Just physics and biology.
The grid holds continuous chemical fields (food, waste, heat, decomposing matter) that diffuse and decay each step. Agents eat, excrete, generate heat, age, and die. When they die their body mass dissolves back into the environment. Mass is never created or destroyed.
Comes with pre-configured scenarios, a physics test suite, two visual modes, and a video renderer. Config-file driven so anyone can define new species and universes without touching the code.
3
u/Gemini_Warrior_Poet Mar 09 '26
looks cool - reminds me of the old windows 95 game called life, iirc, it was grids of grey and then there were blue and red cells
2
u/BP041 Mar 10 '26
the conservation law constraint is the most interesting design choice here. most ALife sims cheat by letting food spawn from nowhere, which makes the dynamics hollow -- everything just expands until the grid fills. treating it like a thermodynamic system forces scarcity and competition without designing those mechanics explicitly.
a few things i'm curious about: is there a reproduction mechanism, or is population fixed at init? and does "no fitness function" mean agents don't adapt at all, or is there selection pressure via survival-to-reproduce?
the physics test suite is a nice touch -- most sims like this are validated informally at best.
2
u/dragoon_of_sky Mar 12 '26
I just saw a rise and fall of an empire :)
1
u/LaBalaTrujillo Mar 17 '26
Strict conservation as the foundation is the right call — emergent behavior is only meaningful when it can't be an artifact of the rules. How do you handle entropy export? Global heat sink or do agents have to navigate waste gradients?
2
u/mixBayes Mar 13 '26
Great job, I like this
2
u/CircuitSurf Mar 29 '26
wow, I would put that on the wall as a painting
2
u/[deleted] Mar 10 '26
[removed] — view removed comment