P5.js made non-playable slither.io like design, open source now!

Something reminds me of this old work today.
My very old university assignment in processing (p5.js). (2 years ago)
Since I already graduated, so it might be a good idea to release my source code.

You may find interesting.

This was inspired by slither.io.


You can see the source code by clicking β€œ</>” at the centre.


Nice, my frameRate is arround 25 on my tablet. Is that reasonable?

It depends on your mobile chip power.

But on my laptop with 6 core cpu and integrated graphic card (chrome does not support dedicated gpu any more), it could easily handle up to 50 snakes simultaneously at stable 60fps.(frame does drop when over 50 snakes)

It you feel laggy on your tablet, you can change number of snakes in the source code and run again. Just keep in mind, mobile browsers’ JavaScript performance are always not that great.

1 Like

any plans for neural network version?

Currently, no.
If you modify the parameter a little bit, you can make snakes always avoid crushing with others and detect food with range of the whole map.
I changed to high chance for these behaviours rather than 100%.