hunar4321 / particle-life

A simple program to simulate artificial life using attraction/reuplsion forces between many particles
MIT License
2.98k stars 297 forks source link

split the main loop in two #32

Closed skal65535 closed 1 year ago

skal65535 commented 1 year ago

First, update the velocity with fixed position. Second, finalize the positions.

This produces different pattern than updating both velocity/position in random order within the same loop.

Not sure which ones are more interesting, but this version seems more correct. But we could keep both variant and make it a param, too...

Small FPS drop here on Mac M1 (51FPS -> 47FPS), because of cache locality i guess.