FakeFishGames / Barotrauma

A 2D online multiplayer game taking place in a submarine travelling through the icy depths of Jupiter's moon Europa.
http://www.barotraumagame.com/
1.76k stars 406 forks source link

Hulls water volume glitches up and down #12335

Closed mygamingaccount closed 1 year ago

mygamingaccount commented 1 year ago

Disclaimers

What happened?

Observing weird behavior with water in hulls: Water compresses 5.000% (water volume 139776/133120) image

Oscillations occur when above hull is near empty but not quite.

https://github.com/Regalis11/Barotrauma/assets/68995233/8e21c285-2a88-4c1a-b916-71e7530fe8b5

Reproduction steps

Observe water as it moves between hulls. Something is not quite right but I can't put my finger on it!

Bug prevalence

Just once

Version

Unstable (v1.1.3.0)

-

No response

Which operating system did you encounter this bug on?

Linux

Relevant error messages and crash reports

No response

Regalis11 commented 1 year ago

This is a side effect of how the water propagation logic works. Water in the game is slightly compressible: water basically pushes "too much" water into the hull below, and that extra water tries to find a way to get out, making it possible for it to flow e.g. from one side of a U-shaped hull configuration to the other side and for the water level to equalize.

There is some oscillation involved, but it's generally not noticeable unless you use debugdraw (because the rendered water surface is "smoothed" to hide the oscillations).