2D particle-based fluid simulation

Hi there,
Just got my first decent results in the 2D fluid simulation I am writing for game prototype.

In the video I am turning gravity on and off, which is why it floats sometimes.
The simulation is having optimisation issues but I can get to 500 particles over 60fps

Planned work:

  • Optimizations to get to 3000+ particles
  • Implement viscoelastic properties such as viscosity, plasticity and elasticity
  • Rigidbody interaction
  • Better shader for rendering

This will does not and will not use any pro features (mostly because I dont have pro :wink: )
I am thinking about putting it on the asset store when it is finished, if I do I’m thinking the $10-20 range. If you would like to have it on the store let me know and let me know about what price range you would expect

Cheers

This is very cool, two questions:

  1. Does it use a grid system?
  2. Can you use a custom shader to make it look more like water?

Hi thanks so much
It is an implementation of SPH, but it uses a spatial hash to calculate neighboring particles. If that is what you were asking.
And yes, The particles are rendered using a particle system so you can use any shader really. I do plan on making or using one to get a better effect.

Is it using the shuriken system at all?
What are the planned physics interactions?
You say rigidbody, but what about triggers/events, being able to extinguish fires as a puzzle game etc would be valuable.

If you can do a lot with the liquid with good optimization (especially for mobile) I think you could wind up charging closer to the $30 range.

It isnt yet, but i will probably use it for collision data. Currently it just does the calculations and then sets the positions to the particle system.
The current idea i have is to also add fluid interactions like in pixeljunk shooter, ie magma hitting water and turning to stone, water heating up and turning to steam and different fluid densities having different buoyancies.
But these are all stretch goals currently.
The first step is the optimisation, I am working on methods of speeding up the neighbour search as that is the most computationally heavy aspect, then add the viscoelastic properties.

I appreciate the questions and thoughts, I am quite excited about this project.

And the $30 dollar range would be preferable :wink: