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.75k stars 406 forks source link

Water Flowrate Between Hulls Not Restricted as Expected #13243

Open UEAdmiral opened 10 months ago

UEAdmiral commented 10 months ago

Disclaimers

What happened?

Video Here: https://youtu.be/LS0q6uuEW5E?si=hOsIO9MGz4IfzD6F

Water flow does not behave as expected. A hole of size 1 should be overwhelmed by a hole of size 2, and a hole of size between 2 to 19 should not be overwhelmed by a hole of size 1. In my sample, it takes 7 duct blocks draining vertically to reach an apparent equilibrium with the drain capacity of a single duct block draining horizontally. Also, opening and closing a door between two fully flooded rooms should not alter the water drain rate in this sample.

Water seems to flow "horizontally" at a much faster rate than "vertically". Additionally, water movement seems to be unaffected or at least unexpectedly affected by size of openings through which it travels. In my experiments, when I create a hull breach in room A, I need at least 7-8 duct blocks open in the floor to overwhelm a wall-mounted duct block in Room B beneath. However, a wall mounted duct block in Room C connecting to Room A, positioned beneath a door that similarly links A and C, can overwhelm Room A's 19 Floor Mounted Duct Blocks. (Note: enlarging Room B and adding a second horizontal drain block seems to address the issue of Room A fully flooding via Room C; however, Room B still seems to fill with water and not be able to keep up with the water coming from Room C and passing through Room A.)

Moreover, opening and then closing the door between Room A and Room C seems to INCREASE the drain rate temporarily. The same behavior seems to occur when the door is replaced with a Wall, and the wall is destroyed then repaired--the room drains suddenly then slowly starts filling up again.

All in all, none of this behavior makes sense. I'm not sure what bug(s) are in play or not, but things are definitely not working as expected.

Reproduction steps

  1. Load the sub contained in zip file provided, or alternatively do step 1a: 1a. create a sub with a Middle room, left room, right room, and bottom room. Have Middle room with many duct blocks to allow water flow into the bottom room. Set up the Bottom Room with a single duct block (or two ducts depending on which aspect you're testing) allowing it to drain into the left room. Set up the left room with a pump to purge any water that drains into it. Set up Right Room to drain into the middle room with a single duct block, and add a pump to rapidly fill the room with water. Strange Water Behavior.zip

  2. Connect/Disconnect Duct Blocks until desired number are enabled.

  3. Create water flow, either by cutting through the ceiling in the Middle Room, or activating the pump in the Right room.

  4. Observe water flow rate / room flood percentage visually or on Status Monitor.

The video above (in the "what happened" section) should also enlighten steps to reproduce.

Bug prevalence

Happens every time I play

Single player or multiplayer?

Other

-

Sub Editor Test Environment

Version

v1.2.7.0 (Winter Update hotfix)

-

No response

Which operating system did you encounter this bug on?

Windows

Relevant error messages and crash reports

No response

Tsunder commented 10 months ago

some of this seems to be working as expected to me, but not to your understanding of game mechanics.

horizontal/vertical flow rate non-equivalence is intentional as per source code. breaches flow seems normal.

the door opening/closing and increasing drainage seems funny though. perhaps an bug stemming from door opening changes related to pushing bodies?

UEAdmiral commented 10 months ago

If indeed the game intentionally moves water much, much faster horizontally than vertically, then I withdraw that aspect of the report.

On the door open/close bit, it visually appears as if the gap between rooms is slowly increasing. Whether that's actually happening on a mechanics level is an open question. Re-establishing that the door is in fact closed seems to "remind" the game that the gap there is a small one. It bears reiterating that replacing the door with a vertical inside wall results in the same behavior: the gap appears to widen until player destroys the wall and subsequently repairs it to "remind" the game of the proper gap size and triggers the same drainage speed change.

I could perhaps phrase this past paragraph a bit better, but I think it gets the idea across?

Tsunder commented 10 months ago

debugdraw console command has a nice feature that shows exact water quantities per hull + also water flows/gaps -- the water visually may not necessarily match the actual water level (particularly for flowing water, because of vfx) . though with that many ducts it'll probably be hard to gauge visually.

Regalis11 commented 10 months ago

Thank you for the report!

It's actually intentional that water flows faster through horizontal than vertical gaps. This is a sort of side effect of how the water flow logic has been implemented (or a workaround to water flowing horizontally from room to room looking strange if the flow rate is more restricted).

I'm not entirely sure there's an issue with the door either. To me it looks like closing and reopening the door increases the flow rate because it forces all the duct blocks to be open. When there's less water in the room, the duct blocks seem to close and reopen as the water level fluctuates, but when there's lots of water, they all stay constantly open.

UEAdmiral commented 10 months ago

I am not so sure the cause of the increased flow rate is that opening and closing the door forces the duct blocks to be open. As you can see in the video (about 3:54), the room is already completely filled with water and you can see the duct blocks are all open. Toggling the door open merely opens one full room to another full room: again, all duct blocks appear to be open.

It is only upon closing the door that we see increased flow rate, and no state change in the duct blocks is observed. (Edit: and we see the same thing if the door is replaced by a vertical inside wall, which is destroyed and then subsequently repaired!)

So a few possibilities come to mind:

I haven't had an opportunity yet to play with the debugdraw console command Tsunder mentioned. That may prove illuminating.