(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!

Screen capture video of a green mountainous landscape in first person view. Water comes out of the ground at some locations and begins to stream down the slopes, splitting and joining, filling holes in the ground, as it continues to progress downhill.

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).

Video similar to the previous one, showing a liquid simulation on a green landscape. The water flows in a deep trench in the ground until it reaches a big depression in the ground that it fills to create a lake.

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.

Screen capture video of a green mountainous landscape in first person view (mostly flying in debug camera mode). Water comes out of the ground at some locations and streams down the slopes. The player spawns big spheres that modify the terrain, forcing water to flow differently. At some point, the player digs a big tunnel to allow water to flow beneath the terrain.

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…