Fluid Simulation Prototype

This is my first real post on the forum, so apologies if I’m posting this in the wrong category or anything.

So I’ve made a simple prototype for how water currents might be implemented and how they would interact with the compound clouds. I imagine that it would be fairly easy for the simulation to move microbes and bacteria as well by simply getting the fluid velocity at the microbe or bacteria’s location and add it to their momentum.

However, I can think of two major obstacles to implementing this into the game: first, how do we handle the player moving from location to location? The simulation as it is now can only be a finite size, so a player who moves any significant distance from the starting point would experience no currents. One possible solution would be to make multiple simulation objects and dynamically load them as the player moved into them, but I’m not totally sure how that would work.

Second, how do we generate currents continuously? When given an initial force, my simulation soon diffuses back to near-zero velocities. Perhaps new forces on the fluid could occur at the planned heat sources, perhaps they could be generated randomly at the edges of the simulation, representing currents from other places in the tide pool, or perhaps the new forces could be generated randomly within the simulation, representing turbulence from water levels above or below the player.

Edit: Silly me, github isn’t for executables.

2 Likes

Currently the compound clouds are within a single rectangle which is moved when the player moves (it is repositioned and the data inside is moved accordingly). The same approach could be used for this as well. But the problem with this is that when the player moves fast they can see the edges of the rectangles as the compounds just stop there. For that reason I’ve been considering having dynamically created compound rectangles that are created near the player and would allow compounds to move between them.

I’ve commented on your pull request about the inclusion of binary files to git, which is something that should be avoided.

This is pretty neat! It works well and efficiently, although if we put something like this in the game we’d want a higher framerate for obvious reasons. We don’t really need as much detail as you’ve given, so maybe reducing the density of points could compensate for needing a larger field and faster simulation rate. How would you go about making it look less pixelated?

These are all great suggestions - maybe a combination of all three would work?

Unfortunately the easiest way to do that would be to increase the density of points and sacrifice speed. It might be possible to add a shader or filter of some sort that would have a similar effect, but I’m not familiar with that sort of thing at all. I’ll look into it.