Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

so water, just like the sand and the dirt, is a ball, a much smaller ball than the sand and the dirt. it is using and simulating its physics through RigidBody2D, with a physics Material 2d that ensures 0 bounciness and 0 friction. 
Then I object pool it to ensure the first burst is not bringing on a huge frame drop and let them sit. The water is captured by another camera, that has slightly smaller resolution to give it a blurry effect. then I apply a shader to it. a shader that takes all the objects in the set layer only, (in this case water but worked the same for dirt, and creates a small outline with all the objects in set layer, once they are close to each other, it looks like a fluid, (the friction you give to it has more or less viscosity ). Then you work a bit with the already existent shader to make it look good.

The issue when it comes to performance, is that in order for the water to behave like watter, it needs to be constantly simulated, and having such small particles, it is hard to have enough and still keep the frame rate. unlike the dirt and sand, where I stop the simulation once they stop moving. so no matter the size of the particle, it is not simulating much ( another nice performance trick we could use from here is to make it a single mesh once the balls stop moving for dirt and sand) .

Hopefully I've responded to your question :D 

(+1)

You could do a trick and it is to use some cell automata to emulate the water and sand at low resolution. You can give it a pixel art look or maybe use a SDF on shader to give them another look. For the water you will have to run few iterations per frame. But it should be fast enough.

(+1)

yee, I actually thought about that. That was the first thing I tried, but then based on the artistic direction and the overall gameplay direction I tend to cut scope and went back and forward. And I also liked how this feels, not being tight to a grid and all, but yee, that was the first idea. 

(+1)

I grew up with PowerToy so that was literally the first thing I imagined when we decided on the gameplay loop, to go towards that kind of simulation for the dirt, sand, water, even rocks :D 

(+1)

ohhh PoderTory, I did not know aobut that one. Beautiful! 

Making the game simulation match with the art can be a really hell. That is something only devs know :D