by at_a_remove · 2y ago · 0 comments
What is fooling you is the motion. This is sustained because the system has no conservation principles built in. You can make A-B pairs where B is attracted to A, A is repelled by B, and off they go, zoom. Were the meta-rules devised such that conservation of energy or momentum and such were baked in to whatever system you devised, you would see less exciting structures which would more resemble a late-stage pentamino explosion in the Game of Life.
With a sufficiently large processor, I would like to see this in three dimensions and more options for force, such as dropping off as the inverse of r or r-cubed or even r * log(r), or some "repulsive at a distance, attractive at very close quarters" particles. I have a feeling that such a system would grind to a halt even with clever optimizations.
Oh, there's one of those too! I don't see ways to change the falloff though, just the magnitude...
https://hunar4321.github.io/particle-life/particle_life_3d.h...
>> I have a feeling that such a system would grind to a halt even with clever optimizations.
I took this to mean that they thought there was no falloff calculated at all. If there is, I don't see why substituting a different function, e.g. cube vs square, would be significantly more CPU-intensive.
1) Three dimensions, not two. Therefore distance is not the square root of (delta-x * delta-x + delta-y * delta-y) but the cube root of (delta-x * delta-x + delta-y * delta-y + delta-z * delta-z). More operations.
2) Three dimensions, not two. As you start increasing the number of dimensions, the simulation feels more and more empty. One hundred particles on a line a thousand units long is crowded. One hundred particles on a grid of one thousand by one thousand feels like more "room" for that same number of particles. In a volume of a thousand by a thousand by a thousand, one hundred particles feels too few, and one would naturally increase the number of particles. Naively, which is to say without optimizations, the number of force computed grow as N-squared. More operations.
3) Cube falloff goes by r * r * r, rather than r * r. More operations, by fifty percent. And I did suggest some more exotic functions in there which certainly could be more daunting.