A simple physics particles simulation sandbox that is made using javascript.
have fun tinkering with the particles and their properties!!
For debugging the code, ui improvements and helped in writing some physics code and algorithms.
A simple physics particles simulation sandbox that is made using javascript.
have fun tinkering with the particles and their properties!!
For debugging the code, ui improvements and helped in writing some physics code and algorithms.
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.
it is on by default. it turns on after a few seconds when you click the screen, then the real fun beginsss!!!
you can turn it off from the panel window.
i have tried to make it as smooth as possible by adjusting the scale of the gravity change in proportion with the tilt acceleration of the device. hope it works man!!
new file tilt.js handles the tilt logic. trying my best to keep the code modularized.
i could not upload a proper video showing the tilt mode in action, but you can try it yourself in the demo site by firing it up in your phones. would love to get feedbacks on this mode!!!
Log in to leave a comment
i have optimized this sandbox to handle hundreds of particles at 60fps. the techniques of optimization that have been used in this project are:
-the problem was that, in the previous version (v1.0.0), every particle checked every other particle for collisions which lead to the game being slowed down a lot when new particles were added.
ctx.stroke() function to be called 2 times for every single connection and required caching to solve. for 100 particles it called 200 draw calls.Optimization section.Log in to leave a comment
MADE IT FULLY MOBILE RESPONSIVE ig
yepp, finally made it mobile responsive. works properly in mobile phones. it was kinda challenging making all the modes suitable for mobile phones so I have turned off the story mode, cyclone mode and explosion mode for mobile phone. other than that, each and every modes work perfectly. I have made this change and shipped it very fast because a lot of the voters asked for this change and i felt like this was a much needed change.
Log in to leave a comment
this is the 6th ship for this project. i have added challenges in this ship. it is quite a big ship. also, added a new mode called slither mode. i guess this will be the final mode as there is no screen pixel territory left for the modes lol. i might work on a screensaver mode thing in future which will disable almost all the ui elements and spawn random particles and you just have to wait n watch and can leave it on for a long period if time, this sounds so much fun. will surely add in the next update.
###if you really want to have fun then turn these modes on together : slither + zero grav + (disco .. on your own risk ;)
i have onl made 5 challenges so after all these finish, they will circulate again randomly. but it will not happen in future versions, im thinking to make it so that the user gets some kind of achevement like thing if they finish all challenges. not sure how i would implement it though.
now, the challenges indicator shows even when the panel is hidden by ‘h’. the challenge indicator has been added to the info text shown when the panel has been hidden. it gives info about the time left for the next challenge to happen.
Log in to leave a comment
the challenge opt in issue has been fixed. a popup shows in the game after a few seconds of starting, to ask the user if they want to opt in for the challenges and if they choose yes then they better be ready for a fun challenges. sadly, i have not come up with fun challenges yet though, the current challenges quite simple actually. there are 5 challenges i have put up till now. they are quite simple.
challenges are continuous, they donot stop. they keep coming one after another. for now, i have onl made 5 challenges so after all these finish, they will circulate again randomly. but it will not happen in future versions, im thinking to make it so that the user gets some kind of achevement like thing if they finish all challenges. not sure how i would implement it though.
if the user opts in to the challenges then they get to see the time remaining for the next challenge to appear in the panel, above the particles count thing.
in the current version, if a user opts in to the challenges then they cant quit. they must face those challenges.
for future updates, i want to make sure the challenge info is shown even when the panel is closed, in the top left corner of the screen along with other infos.
Log in to leave a comment
this time, i wanted to add sth more fun to this game. so, i have added challenges. the user gets bombed with a lot of challenges throughout their playtime in this simulation, they will be challenged to spawn more than X particles, eat X+ particles using Y mode and more and there will be a time limit like 20 seconds, 30 seconds or so. the user has to complete the given challenge within the given timeframe. if the user completes it then they will be greeted with a fun message and maybe sth more ;) and if they are unable to complete it, they will be roasted and trolled (simple) with a popup message.
there is a lot more work to do in this feature.
Log in to leave a comment
Voilaaa!!! This is my 5th ship for this project. seems like its been about a week since I have started this project and it has come to become quite complex now. I have focused more on usability and good-to-have features in this update. Added a few modes to increase the fun threshold though.
repel (x): the mouse pointer changes to a no entry sign like symbol and all the particles are repelled by the mouse pointer. they try to escape and run away from the mouse pointer as much as they can.
disco (d): in this mode, the particles change their color continuously (every 0.8s fyi). also added an epilepsy warning before the starting of this mode so that it doesnot cause any harm to anyone [ it was suggested by a voter in the previous updates ].
R -> it restarts the simulation. if you are bored with your current simulation or you messed up something, you can press R and a new blank canvas will appear for you to get your creative juices flowing again.
H -> it hides the panel. allows more space to have fun with. when the panel is hidden, it shows a small text in the top left corner of the screen which gives info about the major shortcuts like toggle panel(h), restart(r), screenshot(q), etc
Q -> screenshot. it snaps a pic of the current simulation you are doing. it ignores all the UI elements and shows your particles and their fun behaviors only. it took a bit too long to add this but finally it has been added. yay!
to sum up the updates in UI:
yepp, i have introduced sounds in this update. not globally, it is just in two buttons. one is the screenshot button, which makes a camera snap sound effect when clicked and the other is the dice button which makes dice roll sound effect when clicked. thanks to pixabay for helping me with the sound effects!
if i continue on this project, i will have to improve on these things;
As I say always, this is the particle simulator that I have always wanted to play since my childhood, from the good ol’ mrdoob days. This project started as a simple project but has turned out to be not so simple and packed with a lot of features in every ship. Been putting a lot of hrs last week for this, need to touch some grass again. Might be inactive for a few weeks following this update. Till then, have fun simulatingg particlessss!
new mode again!
cursor: default inside the rollDice() function.also, if you have not noticed it yet, there is a small easter egg in the modes section. check out the 1st column and read the keys out a loud. they spell, BINGOOOO! im feel like im done with this project now, i might stop working on this after this update, who knows… my creative juices have really started draining.
Log in to leave a comment
##changelogs
H -> it hides the panel. allows more space to have fun with. when the panel is hidden, it shows a small text in the top left corner of the screen which gives info about the major shortcuts like toggle panel(h), restart(r), screenshot(q), etc
Q -> screenshot. it snaps a pic of the current simulation you are doing. it ignores all the UI elements and shows your particles and their fun behaviors only. it took a bit too long to add this but finally it has been added. yay!
finallyyyy, i have added some simple sound effects to this game. currently, the only two elements which produce sound on click are the camera button (shutter sound - screenshot button ) and the dice button (dice roll sound effect)
this seems like a simple update but this has brought change to a lot of UI components. a lot of minor issues have been fixed in this update.
Log in to leave a comment
###..
im thinking of adding a way to hide the panel so that the user can have fun with their whole available screen. also, im thinking of adding a screenshot shortcut. if you create sth quite chaotic and fun and want to share it with ur friends, simply click the screenshot hotkey or maybe button and it lets you download that screenshot.
so, this ship will be a major one. this time, i will ship after all my creative juices start draining out hehe. be ready for more chaosssss!!
Log in to leave a comment
Log in to leave a comment
refactor the code. yep, finally…took a while to do this cause everything was jumbled in the same file. finally, the project files are getting a good structure. i have made a new js folder which comprises all the js code in it. the script.js has been broken down into 6 js files. you can find proper information about this in the readme.md,
cyclone mode has been fixed. yesterday, the particles were not staying in the cyclone mode properly. now, once they enter the cyclone, they revolve continuously around it. ngl, they are much more addicting now!!!
add a restart keybinding. R when pressed r the simulation restarts to the initial phase, all the state variables are reset. you have a new blank canvas to start working on.
im thinking of adding colorschemes to this simulation. it will change the look and feel of the particles, can add more fun to the game maybe. and im also considering adding some new modes: a repel mode in which mouse repels the particles, and more. lets see how will the future updates be.
Log in to leave a comment
Woohoo! This is my 4th ship for this project. This update is quite a major one, it has brought three new modes, a lot of UI improvements, and some new features which have added to the FUNN.
i am feeling lucky button hehe.im proud of how this project is turning out to be. i am trying to build a game like the sandbox games that i used to play a few years back. tbh i have spent more time playing this game than building it. idk whats the magic behind sandbox games, they tend to be so much addictive and fun. thanks for reading this. :)
i am feeling lucky button, imo.Log in to leave a comment
#####—
been thinking of adding new modes in the next devlog which are cyclones ( click to place cyclones on the screen which tend to make other particles revolve around them when they pass through and maybe eat them if they revolve there for a bit too long ) and another is explode mode which explodes particles if they are put under pressure for a bit too much time ( will reveal the ‘how’ aspect in the next devlog )
its been fun doing this project, hope you feel fun playing it, too!!
Log in to leave a comment
-> add orbit mode (o): the mouse pointer turns into the SUN, yep this one 🌞, and guess what. the particles close to the sun start orbiting it. not so simple as it sounds. most of the time was spent in making the look and feel of the sun ( designing assets using js canvas ctx is a pita ). i like the current look of it, so not changing it anytime in near future.
-> brainstormed other modes like the canon trajectory thing i talked about in earlier devlogs, and a fan mode ( opposite of blackhole mode ) -> seems like a fun idea, lets see if i can implement it or not.
add a newspaper advertisement like thing in the top right corner (30deg slant) which gives info of the latest changes so that you can jump right into action from the latest changes.
Log in to leave a comment
This is the 3rd ship for this project. It introduces new modes, UI improvements, and a lot of performance improvements. I have made these changes keeping the feedbacks given by the voters on the 1st and 2nd ship, in my mind.
Log in to leave a comment
Log in to leave a comment
This ship has introduced a lot of new modes to the simulator adding more chaos to it. It has been quite fun tweaking the code, adding new functions and modes. Some of the modes like the merge mode were challenging. Some modes like the cannon trajectory mode had to be cancelled because it took a lot of time to debug and caused issues with performance and collisions and had to drop the idea of that mode.
-add story mode since a lot of the voters requested for it. it is toggled by ‘s’. when toggled, it displays various quotes in the middle of the screen which fade in/out to give a soothing vibe to the player.
-add trail mode which simply shows the trails of each and every particles. the more trails the more fun ;) (toggled by ‘t’)
add a line mode which is toggled by ‘l’, it connects the particles which are near to each other by a line. this helps in viewing the connections between the particles more effectively, and looks cool ;)
tried adding a cannon system (trajectory path projection for particles). in other words, tried making the particles have angry birds like projectile trajectory but failed miserably and dropped the idea. will surely get back to this feature in near future. for now, i am kicking this idea out from this project.
Log in to leave a comment
Log in to leave a comment
Log in to leave a comment
improve the blackhole mode ( make it more interactive and fun by adding particles rotating around the blackhole as if they were being pulled in by the blackhole but trying to esacpe it)
add merge mode (particles having similar colors (hue values) merge into a new larger particle of a new larger size). no need to worry about particles stacking up, just hit ‘m’ for merge mode and a lot of particles are gone ;)
Log in to leave a comment
add story mode since a lot of the voters requested for it. it is toggled by ‘s’. when toggled, it displays various quotes in the middle of the screen which fade in/out to give a soothing vibe to the player.
add trail mode which simply shows the trails of each and every particles. the more trails the more fun ;) (toggled by ‘t’)
Log in to leave a comment
add blackhole mode to particle sandbox. the cursor acts as a black hole and sucks in the particles demolishing them and taking them to the unknown world in the black hole. click b/B for black hole mode. have fun simulating particles!!
Log in to leave a comment
I built a physics particle simulation using Javascript!! I learned how to work with 2d canvas in Js while building this project. Adding collisions was quite hard but did it with the help of the resources in the internet and claude. Very happy to see how it turned out! My goal is to make it sth like mrdoob’s simulators which I used to be fascinated playing, a few years before.
changed the UI of the panel to make it a bit minimal and simpler. used Space Grotesk font for more of a sandbox vibe. abstract the unimportant things from the labels of the sliders to include one word label for each slider e.g. gravity, friction, spawn, size
Log in to leave a comment
made a simple particle sandbox system, in which the particles can be simulated using sliders that control gravity, their damping /friction, amount of particles to be spawned and size of particles.
Log in to leave a comment