Fluid simulation improvements
(Originally posted on Mastodon)
I’ve been working a bit more on #LiquidSimulation for my game, and I’m starting to be happy with the results!
My objective is to simulate rivers and lakes on a “large” world (20km x 20km), and allow the player to modify the terrain, build dams, locks, underwater buildings… This is a 3D simulation, which includes the possibility to make underground rivers (communicating vessels), etc.
As you can see, rendering is ugly for now (not my focus yet)
Here is another example, with a much higher liquid flow (it comes from infinite water sources). In this example it creates a bigger river that fills a lake. The end of the video is accelerated (it takes almost an hour to fill the lake to that level but then there is not really an upper limit anyway).
The idea of course would be to pre-compute all this so that everything is in a steady state when starting the game. But a player that would break a dam during the game could create this kind of behavior.
After a few improvements and fixed bugs, dynamically modifying the terrain now correctly impacts the liquid simulation.
Still a lot of things to improve. Rendering something that actually looks like water, adding the pressure system, allowing slices to shrink when liquid level is low, fixing bugs…