Shipped this project!
i built a particle sandbox using javascript!! this was a very fun project! i learned a lot about javascript objects and their methods by doing this project. i did this project because im a long time fan of mrdoob’s simulations and i wanted to make the simulation that i never got to play so i made this project! this helped me improve my js skills, i found the sharable link feature which i have introduced in this ship, a bit challenging but now that it works, im very happy with it!!
changes introduced in this ship, summary:
optimization
- firstly, i have done a lot of OPTIMIZATION of this project in this ship. i have tried my best to maintain the fps at a fixed rate throughout this project even if the user has very low end device. more information about optimization can be found at the github readme optimization section.
tilt mode
- finally added tilt mode which moves the particles here n there based on the tilt of the device. i have made it so that this works only on mobile phones. it basically enables device tilt control (works magically for non-ios devices. i have added motion permission request for ios devices, hope it works). then it reads the acceleration and changes the graviy of the game based on the acceleration. this is just a try to make the game more interactive on mobile phones. it moves particles based on the phone movement when tilt mode is on.
shareable link
- i have made a button in the bottom right of the screen, right above the dice button, shows a popup when clicked, saying that the url has been copied and is ready to be shared!!
- the button has a fun lil animation when it is clicked.
- the current game state which is a json at first, is convered to a simple string which is encoded to a base64 type string.
- this string is added to the copied url which when opened on a new tab restores the game.
- i have updated it so that if a user shares a link with disco mode enabled then the game asks the epilepsy thing before loading the simulation on the new tab to the new user.
achievements system
- you get various achievements based on awkwardly random interactions that you do. for e.g. u may get an achievement for pressing the dice button more the X number of times or so, or for spawning more than Y particles in Z mode. i have added this to make the games fun.
- im using session storage to store info about achievements. i tried using local storage but i wanted it to reset achievements each time the simulation is opened so i switched to session storage.
- you may find the achievements through the code and try it or get into detective mode and try each and every mode searching for new achievements. ;)