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.72k stars 397 forks source link

General performance problems #9396

Open Chotat0 opened 2 years ago

Chotat0 commented 2 years ago

Disclaimers

What happened?

I have a very powerful PC that used to be able to run Barotrauma at 144 FPS and only dropped to 60-40 during action with settings on medium, resolution at 1080p. Ever since the Rising Tide update, and made significantly worse by the Urban Expanses update (when almost everybody's new performance issues started, you can see almost all NEW performance related threads were created around the launch of these two updates) the game has refused to go above 60FPS ever, despite Vsync and any other setting that would limit the FPS and ALL GRAPHICAL OPTIONS turned OFF or to the lowest possible option except for the resolution which will stay at 1080p because I record gameplay sessions and the recordings need to be in 1080p which was never an issue previously.

Now when the ship starts to flood or anything significantly interesting happens the game will drop to 12-6 FPS and not come back even if we break combat and fix the ship. Notably the ship flooding causes this issue consistently and is repeatable. It also introduces a SIGNIFICANT input delay that's present whenever the FPS tanks that low to the point where once the FPS has dropped the input delay is so long users cannot put on a diving mask before their character suffocates.

I saw in the changelogs that you added more info to the showperf screen so I took some new screenshots while the issue was starting. I've been completely unable to play Barotrauma for the past 3-4 months because of this newly occurring performance issue when the game worked fine throughout 2020 and 2021 on higher settings than it's currently running.

I saw that you closed the other thread so I'm making a new one specifically about NEWLY INTRODUCED performance issues. This issue HAS NOT been resolved with the current update.

I'm playing the game unmodded, on vanilla subs and it happens in every possible setting. Singleplayer campaign solo no bots + with bots, multiplayer campaign without bots + with bots, Singleplayer missions solo + with bots, Multiplayer missions no bots + with bots, and happens on all subs no matter how small.

My specs are: Windows 7 Ultimate 64 bit AMD FX 8350 Black Edition @ 4.0ghz (not overclocked) 24gb DDR3 Hyper X Fury RAM MSI RTX 2070 Super (Not overclocked) Asrock Extreme 3 970 mini ITX motherboard AOC 144hz monitor 900W PSU Game is installed on an SSD, but issue persists when reinstalled on regular HDD.

This same bug is occurring for roughly 1/3rd of everybody on our dedicated Discords (multiple Discords dedicated to various Barotrauma related things, little community overlap so I'd estimate roughly 1/4th of the entire playerbase is affected) and is constantly talked about in the Steam Discussion comments for every post Barotrauma has made since Rising Tide. This issue is widespread and Rising Tide is what caused it, Urban Expanses made it far worse. As stated above, the newest update has done absolutely nothing to combat this issue and previously the game ran between 60 and 144 FPS on the same rig. Similar reports from our other Discord users, prior to Rising Tide the game ran perfectly, post Rising Tide they're no longer able to play the game at all.

20220617154104_1 20220617154134_1 20220617154136_1 20220617154150_1 20220617154159_1 20220617154202_1

Reproduction steps

Start any type of gamemode with or without bots or other players on any vanilla sub Load into the game Play until the ship starts flooding with the FPS gradually getting lower and lower Get reduced to 9 FPS or less Quit the game because the FPS tied with the input delay makes it unplayable.

Bug prevalence

Happens every time I play

Version

0.18.12.0

-

No response

Which operating system did you encounter this bug on?

Windows

Relevant error messages and crash reports

No response

Chotat0 commented 2 years ago

Bump, I'd really like acknowledgement here. I've talked to Regalis several times about this, as have my friends also affected by the same issue and there doesn't seem to be any concern or urgency to this issue that stops me from playing the game.

Regalis11 commented 2 years ago

Thank you for the report!

We hoped the performance optimizations in the latest update would've addressed this, but it seems there is still something wrong that we haven't yet been able to diagnose. This is quite frustrating to us as well, since we still haven't been able to reproduce it ourselves, nor have the screenshots we've gotten given as much clues on what's causing it. It doesn't seem to be related to hardware, since we've gotten reports about it from people with completely different hardware, often so powerful that there should be no problems running the game.

What's even stranger, is that the showperf screenshots don't show anything unusual - nothing seems to be taking so much time that it'd cause such a huge FPS drop (in your screenshots the total time taken for updates and rendering is so low the FPS should be close to 60). This suggests the issue is somewhere outside our code (although, most definitely caused by our code).

Since it seems trying to pinpoint the issue by these kinds of measurements hasn't been of much use, I think we'll need to figure out some other kind of approach. I think for the next unstable build I'm going to add some extra console commands for disabling certain things related to the leaks so we could hopefully rule out some potential causes for the problem: rendering the water inside the sub, water-related physics, effects caused by the gaps and such.

But for the time being, if you would like to help us diagnose this, something I'm interested in is whether getting rid of the gaps does anything to the performance. I.e. if you enter the console command fixwalls, does it seem to affect the framerate in any way? Or if you enter the command water and empty the hulls?

Something that might also give us more clues are GPU performance statistics (which the showperf can't really measure in much detail - which would explain why the in-game stats don't seem to show anything unusual). If someone could for example take a screenshot of the GPU stats on the task manager, it might be helpful (in case it shows e.g. excessive GPU utilization or memory usage). image

I'm sorry about the trouble this issue has caused, I can imagine how frustrating this must be. :/

Regalis11 commented 2 years ago

And to add to the above: it seems there are essentially two different performance problems that people are reporting. One is about overall bad performance in various different situations, which we did a ton of optimizations for in the latest update (and they seem to have significantly improved the performance based on the feedback we've gotten). The leak issue seems to be something different: it affects a much smaller subset of people, happens consistently in this one specific situation, and leads to a gradually worsening FPS unlike the "general" performance problems.

I've been trying to think of common factors in the reports we've gotten about the leak issue, but nothing seems to clearly jump out. One guess I have is Windows 7 - the one comment in the previous thread that mentioned leaks was also on Windows 7. Just to check, have you installed Windows 7 ESU (Windows 7 without ESU has been unsupported since 2020)?

HeatedWafflez commented 2 years ago

And to add to the above: it seems there are essentially two different performance problems that people are reporting. One is about overall bad performance in various different situations, which we did a ton of optimizations for in the latest update (and they seem to have significantly improved the performance based on the feedback we've gotten). The leak issue seems to be something different: it affects a much smaller subset of people, and happens consistently in this one specific situation, and leads to a gradually worsening FPS unlike the "general" performance problems.

I've been trying to think of common factors in the reports we've gotten about the leak issue, but nothing seems to clearly jump out. One guess I have is Windows 7 - the one comment in the previous thread that mentioned leaks was also on Windows 7. Just to check, have you installed Windows 7 ESU (Windows 7 without ESU has been unsupported since 2020)?

Running Windows 7 myself and I've found my framerate to be absolutely fantastic after the release of these optimizations. I'm not sure if this particular OS is a problem but there isn't really much of a way to pinpoint it either considering how little people actually use Windows 7.

Chotat0 commented 2 years ago

And to add to the above: it seems there are essentially two different performance problems that people are reporting. One is about overall bad performance in various different situations, which we did a ton of optimizations for in the latest update (and they seem to have significantly improved the performance based on the feedback we've gotten). The leak issue seems to be something different: it affects a much smaller subset of people, happens consistently in this one specific situation, and leads to a gradually worsening FPS unlike the "general" performance problems.

I've been trying to think of common factors in the reports we've gotten about the leak issue, but nothing seems to clearly jump out. One guess I have is Windows 7 - the one comment in the previous thread that mentioned leaks was also on Windows 7. Just to check, have you installed Windows 7 ESU (Windows 7 without ESU has been unsupported since 2020)?

Other users here have responded saying it runs fine on their Windows 7 system. Also have other people in my Discord that experience this bug on Windows 10. I’ll absolutely give the ESU a try when I get home but I’m really doubting it’s an OS issue given the evidence that other users on W7 run it just fine and this same bug occurs for people on Windows 10.

Windows 7 also wouldn’t explain why it only recently became unplayable. Game performed fine on this exact system prior to Rising Tide.

As for the other things to try, I absolutely will once I’m at my computer again. I’ll post back here with my findings. Please, if you think of anything else to try let me know. I’m more than willing to be a test subject for fixing this issue, I work I.T. myself so I’m happy to give you any information I can to help solve this problem and I’m willing to volunteer some of my time to anything that would help you narrow down the cause.

Regalis11 commented 2 years ago

@Chotat0 Thank you for the extra info. Win7 was just a wild guess, but it sounds like the issue has to be somewhere else.

Windows 7 also wouldn’t explain why it only recently became unplayable. Game performed fine on this exact system prior to Rising Tide.

I thought it could have - some change in the Rising Tide update must be causing issues on some specific systems, and I could've imagined it occurring on a specific OS. Although, as said, that's starting to seem unlikely. Are you by any chance using any 3rd party "game optimization" software, like Razer Cortex, GameBoost, Smart Game Booster?

Chotat0 commented 2 years ago

No I am not. MSI Afterburner is installed but stays dormant, not running unless I specifically launch it for certain games to limit my FPS, and Barotaruma isn't one of them.

ravendaark commented 2 years ago

I just want to report that problem with low fps was solved (on my system at least, hope it helps others as well) I have PC and a laptop, while laptop preformed better than pc, despite having nearly identical specs. After some head scratching and absolutley unneccessary purchase of the overkill RTX 3080 ti and yet nothing improved, i saw that my RAM was running at 800mhz on pc and 2400mhz on laptop. With help of a friend, we updated the bios to the latest version, wich brought up the full working capacity of the RAMs and the 15 FPS bullpoop went to majestic 140 FPS overkill. Loaded the save with tons of mods and tons of items in game AND IT WORKS. I never imagined that RAM frequency can have such an impact

Chotat0 commented 2 years ago

I just want to report that problem with low fps was solved (on my system at least, hope it helps others as well) I have PC and a laptop, while laptop preformed better than pc, despite having nearly identical specs. After some head scratching and absolutley unneccessary purchase of the overkill RTX 3080 ti and yet nothing improved, i saw that my RAM was running at 800mhz on pc and 2400mhz on laptop. With help of a friend, we updated the bios to the latest version, wich brought up the full working capacity of the RAMs and the 15 FPS bullpoop went to majestic 140 FPS overkill. Loaded the save with tons of mods and tons of items in game AND IT WORKS. I never imagined that RAM frequency can have such an impact

Thought this might've been the issue for me as well so I went ahead and checked my RAM speeds. CMD is reporting all 4 of my RAM sticks are running at 1600mhz, so that shouldn't be the issue on my end. Glad that fixed it for you though.

2 sets of 2: 2x4gb Hyper X Fury DDR3 2x8gb Hyper X Fury DDR3 Running dual channel on both sets. image

Jamessy22 commented 1 year ago

Is this perhaps in any way relevant to the amount of items you keep inside your sub? I noticed gradual performance decrease as the campaign progresses, which was (to some degree) improved by moving a bunch of aluminum/calcium/sodium/etc to another sub (so I can recover it if/when need be). Note: this seems to apply even if all items are properly stored in containers inside waterproof lockers, or crates, or wherever else. Pirate ships also seem to make lag worse due to influx of items being processed, presumably?

@Chotat0 Could you try loading a particularly sluggish save, then either dump some items or just carry them to another sub? You could even try buying a new one and transferring everything, then going back to the "main" sub with some rods/ammo - just to test if it helps at all.

@ravendaark From my experience, it seems to be associated with older/low-end CPUs - probably having to do with worse microcode and/or less caches (8MB or less). My suspicion is, when there are too many objects in a level - be that items, enemies, or whatever - it would begin swapping some structures in and out of caches, causing considerable and sudden spikes in processing time (as in, fine until cache overflows, then extremely laggy). I suspect dev boxes are decently modern/beefy, but perhaps it would be feasible to reproduce it somewhat with a bunch of items in a sub on a low-end machine.. even some laptop, perhaps? Or just old-ish CPU?

Note: this is one source of lag that I noticed and "sort of" been able to remedy in my campaigns, to a degree - there may be other issues and whatnot. Just something to consider!

mygamingaccount commented 1 year ago

https://github.com/Regalis11/Barotrauma/issues/10101 is a separate problem not related to this

mygamingaccount commented 1 year ago

I decided to try to investigate the server lobby slowdown issue (#10101) after getting reports from Windows users too about this

Running a debug build of Barotrauma with dotnet-trace recording the performance while in the lobby menu, the result suggests that it's one of the native libraries linked by Barotrauma:

~/Projects/Barotrauma/game$ dotnet-trace report ../Barotrauma_20221020_085439.nettrace topN
Top 5 Functions (Exclusive)                                                  Inclusive           Exclusive
1. Missing Symbol                                                            55.38%              55.38%
2. WaitHandle.WaitOneNoCheck(int32)                                          13.76%              13.76%
3. EventSource.DefineEventPipeEvents()                                       8.83%               8.83%
4. Alc.GetStringList(int,int32)                                              7.13%               7.12%
5. Thread.Sleep(int32)                                                       6.73%               6.73%

Loading the trace into Speedscope, the external function seems to be called by Barotrauma!OpenAL.Alc.GetStringList(int,int32) The following stack trace

Barotrauma!OpenAL.Alc.GetStringList(int,int32)
> Barotrauma!Barotrauma.Networking.VoipCapture.get_CaptureDeviceNames()
> Barotrauma!Barotrauma.NetLobbyScreen.Update(float64)
> Barotrauma!Barotrauma.GameMain.Update(class Microsoft.Xna.Framework.GameTime)
> MonoGame.Framework.Linux.NetStandard!Microsoft.Xna.Framework.Game.DoUpdate(class Microsoft.Xna.Framework.GameTime)
> MonoGame.Framework.Linux.NetStandard!Microsoft.Xna.Framework.Game.Tick()
> MonoGame.Framework.Linux.NetStandard!Microsoft.Xna.Framework.SdlGamePlatform.RunLoop()
> MonoGame.Framework.Linux.NetStandard!Microsoft.Xna.Framework.Game.Run(value class Microsoft.Xna.Framework.GameRunBehavior)
> MonoGame.Framework.Linux.NetStandard!Microsoft.Xna.Framework.Game.Run()
> Barotrauma!Barotrauma.Program.Main(class System.String[])
> Thread (36480)
> Threads

suggests that the issue lies in these lines of code being called too often, which were published in 2022-02-26: https://github.com/Regalis11/Barotrauma/blob/35c6bd2526e5f857782bbbf547a5c5b30a02bcbc/Barotrauma/BarotraumaClient/ClientSource/Networking/Voip/VoipCapture.cs#L21-L22

image

Attaching the nettrace file: Barotrauma_20221020_085439.nettrace.tar.gz

Barmem commented 1 year ago

My FPS drops to 5 when we are on station or enemies spawn

Barmem commented 1 year ago

Running game on linux Fixed all of my performance issues

DanlarScott commented 1 year ago

Hello, how are you? I'm here to report a problem I have with Barotrauma.

The game is running smoothly with good FPS, especially if I have VSYNC OFF, because it seems that there is a kind of bug with VSYNC ON where the FPS are not stable at all.

Leaving this aside, my real problem (and from what I have seen, some people also have this or similar problem) is that from time to time, I suffer from stuttering or micro-freezing, when this happens my FPS drops from 144 to 120~ for a short time and then goes back to normal. This happens totally random, no matter the situation. There is nothing specific that causes it (as far as I have noticed). it is quite annoying if this happens while you are trying to escape from a monster, or trying to maneuver the sub etc. >_< (like I said it is random, you never know when it might happen >.<) Apart from this problem, I really enjoy the game, I love everything of it! (very good job devs! <3).

oh yes! Also another thing to mention (and that I could verify) is that the first time you open the sonar screen, there is usually some stuttering/micro-freeze, but only the first time you open it, then during the rest of the session it doesn't happen again, until you close/open the game again and reopen the sonar screen.

This is my PC: 12th Gen Intel I5 12400F - RTX 3070 - 16GB RAM - 1TB SDD - Windows 11

thank you for your attention, greetings.

Wheatley1001 commented 1 year ago

Thought I'd throw my hat into the ring of performance issues, I found that Alien Ruins cause quite a significant drop in performance on the sonar monitor. Going from passive to active whilst the submarine is close to the alien ruins made my game go from 140 fps to 28 fps. Screenshot attached below.

image

NoNamesAvailable1488 commented 1 year ago

Hello! I'm experiencing a problem with FPS too, but it appears unpredictably. We played campaign and at one of the first missions of third biome we got all mission at 10 FPS. 1 After the end of the mission, on the next one FPS returned to kinda normal. 2 We continued the campaign and now in 4th biome we got low FPS broblem again. Pretty high "Physics", and "Ragdolls" jumping from 0,5 to 15,5. 3 4 My system at that moment. 5

I tried different ways to fix this with no effect. Turned off all mods too. I have a small list of mods, mostly QOL, so I'm pretty sure this is not the mod issue. In fact, "perfomace fix" are making overall FPS better. Not solving this problem, though.

enceos commented 1 year ago

I believe I have found the real culprit behind the 90% of the issues with the game's performance: https://steamcommunity.com/app/602960/discussions/2/3828665107785637452/

Unclear64x commented 1 year ago

Hi everybody. I want to help find a performance problem. My PC characteristics are: AMD FX(tm)-6100 Six-Core-Processor (3.3 GHz) AMD Radeon R9 200 Series (4 Gb) 2 x 8 Gb Memory DDR3 (800 MHz) HDD 1 TB

Recently, my friends and I destroyed all the bots at the outpost and the FPS rose. The storage was great, all the crates had items and items in containers.

Before the 1.0 update, when another submarine appeared (enemy or abandoned), I had extremely low fps. Now fps 8 - 20 is stable.

I noticed that when there is nothing but a submarine and bots on the stage, fps is 60 (in the submarine editor and at the end of the game (up to 1.0)) with a large number of objects (there were at least about 50 shells for the railgun and 30 boxes for the magnetic cannon on the floor, as well as about 1000 resources throughout the submarine in the boxes).

If I am far enough away from the submarine, the fps increases.

When I used the Delug program, which is very simple and does not require a lot of resources, when it was launched, I noticed that the input and cursor movement slowed down, so I think that either there is a library using which the input is partially slowed down, or there are a lot of calls to the system.

I hope that this information will reveal the problem with low fps. Goodbye.

BlackMoons commented 9 months ago

Heres a screenshot of my campaign, 3rd biome with dynamic europa:

image

As you can see, Map drawing, Physics/ragdolls and lighting all seem to be eating a pretty good chunk.

Dunno why lighting is taking so long, the same sub only takes 1mS for 'lighting' in sub editor? I did notice all ores are 'shadow casting' lights but also are 'drawn behind sub' so it shouldn't matter?

Even with performance fix set to '4 entity update' interval, its hardly getting 20FPS (at 29 physics FPS) even without any combat going on.

Barmem commented 7 months ago

this is not ok изображение

BlackMoons commented 7 months ago

Same GPU transplanted to a different CPU/motherboard provided a HUGE boost in FPS (About 2x, same amount as the CPU's single threading improvement over the old CPU/motherboard), as well as reduction in draw time, suggesting the game is extremely draw call (CPU) limited, as well as everything else its doing CPU wise.

lewri commented 2 months ago

Since 1.5.8.0 I can say that settlement performance has improved to a target of around 60, but it's still not making good utilisation of the GPU to achieve higher framerates (or of any concern on the CPU). In-ship frames are still a bit choppy but have improved a little (staying over 50). This is against an RX 7600 (previously using an RX 580 with around double the frames)