Version 2


Modified Controls:

Left mouse button to Pull, Right mouse button to Push.

Space to Big Bang.

Scroll to Zoom.

Any other key to generate a New world.


Performance Improvements:

Improved performance by comparing distances without using squareroot.

Instead of sqrt(dx*dx + dy*dy) < distance It is now dx *dx + dy*dy < distance*distance

Only after I have confirmed it is in range, I calculate the actual distance using square root. So for each out of range case, we get to avoid using a squareroot.


Another optimization was reducing the uses of Random values.

Each particle (I call them Bugs) does not check with every other bug whether or not its in range and so on. Because that is just way too much calculation. So instead each bug only checks a certain amount, in this version its 20 other bugs.

In the previous version it would choose these 20 bugs at random. But since that was slower than a square root, I replaced it with this:

Each bug is given a random number between 0 and the amount of bugs. Each frame it linearly checks all the next 20 bugs from that index in the bugs array and updates the index accourdingly.

Files

SEA LIFE.zip 11 MB
Jul 21, 2021

Get SEA LIFE

Leave a comment

Log in with itch.io to leave a comment.