- #1
Aediono
- 6
- 0
Hey, this is my first time posting and I've been looking everywhere but can't find a decent water model. I hacked a program together to decently simulate water physics, but it's not nearly robust enough for what I need.
So, in this world, everything is based on a grid. Any non-wall tile can have water in it, represented by 0 for completely empty, 1 for completely full, any anything in between. Water generally moves to areas with less pressure, but also factors in velocity.
This means that each block has a water value, pressure and a velocity vector that it tries to impart on not only its neighbors, but potentially everything else in the water simulation.
Ideally, I'd be able to calculate the static pressure on every single block, but I'd have to potentially factor in everything in the same body of water. Imagine if we had a u-bend like this.
Now, the water on the right side would be putting downward pressure on the water on the left side, which would move it up until they equalize. My program simulates that in a very hacky way (essentially finding and remembering a path to a source block or a block with the highest concentration of water, and drawing from it) but I need to actually calculate pressure.
I'd also have to design it in such a way that it could handle new water, and random pressure increases caused by a player.
TLDR: Grid based water simulation, need to calculate pressure for each tile in realtime
Anyone have any tips or concepts I could look into? I'm really out ideas. Thanks a ton.
So, in this world, everything is based on a grid. Any non-wall tile can have water in it, represented by 0 for completely empty, 1 for completely full, any anything in between. Water generally moves to areas with less pressure, but also factors in velocity.
This means that each block has a water value, pressure and a velocity vector that it tries to impart on not only its neighbors, but potentially everything else in the water simulation.
Ideally, I'd be able to calculate the static pressure on every single block, but I'd have to potentially factor in everything in the same body of water. Imagine if we had a u-bend like this.
Now, the water on the right side would be putting downward pressure on the water on the left side, which would move it up until they equalize. My program simulates that in a very hacky way (essentially finding and remembering a path to a source block or a block with the highest concentration of water, and drawing from it) but I need to actually calculate pressure.
I'd also have to design it in such a way that it could handle new water, and random pressure increases caused by a player.
TLDR: Grid based water simulation, need to calculate pressure for each tile in realtime
Anyone have any tips or concepts I could look into? I'm really out ideas. Thanks a ton.