Jump to content
Stray Fawn Community
Sign in to follow this  
Shahbaz

The game slows down to a crawl

Recommended Posts

This is on Linux, and my first play through.

I just reached the lava-core worlds, and built a drone with cold weapons. While fighting firemantas, I often (as in 2 every 3 launch), and randomly see the game slow down to a crawl (as in drop down to ~4 fps). Pausing the game, brings the FPS back up, and unpausing it goes back to slow.

First few times, I went back to hanger and moved on. However, in an unobtanium rich world, I did the following (so I won't lose what I gathered):

- Once, I flew back to the container, which suddenly brought the FPS back to normal (say 200).

- Another time, I flew back to the container, which made the FPS go up a bit (around 40), but with hitches every second or so. I could hear the hard disk work a bit at the same time as the hitches, and `iotop` showed a constant ~3KB/s write by Nimbatus. (I'm guessing Nimbatus got stuck in a "save" loop).

First time this happened, I looked at `top`, which showed Nimbatus using 50% CPU (note that this is on Linux, so that's 50% of a single CPU, which is a meaningful number regardless of how many CPU cores I have). When the game is paused, `top` shows 20% CPU usage. I also looked at Nvidia's "X Server Settings" which incidentally also shows GPU usage. That was about 1%, with the temperature well below the "Slowdown Temperature".

So it looks like the game is neither CPU-bound nor GPU-bound in these scenarios, so something gets stuck "waiting"?

---

To reproduce, load the save game, in the solar system the ship is already in, travel to one of the planets whose mission is already done (I think the "smaller" planet showed this more frequently, but I could just be paranoid). Visit the planet with the "Cooler Explorer" drone and start fighting firemantas.

Do let me know if there's anything else I can do to debug this.

Saves.tar.xz Player.log

Share this post


Link to post
Share on other sites

Some more info.

- When the game is normally running, `top` shows 200% CPU usage. So during the slowdown, the CPU usage is actually way lower.

- In another reproduction, I see the CPU usage drop to 70% and the pause menu showing 170%. I don't know under what condition I saw 20% before, but these values hold regardless of whether I'm firing weapons, or there are enemies or even the planet in view.

After this, I tried to see if the problem is the sparkthrower. Removing that, I couldn't reproduce the issue anymore. Putting it back, I couldn't reproduce the issue anymore either. Restoring the save file, again, I couldn't reproduce the issue. So I'm not able to debug this further at the moment. I'll investigate more if it happens again.

Share this post


Link to post
Share on other sites

Thanks for reporting this, I'll look into it

Share this post


Link to post
Share on other sites

Some more info. I reproed the issue again.

- Fiddling with options, including changing resolution, fullscreen and vsync doesn't fix the issue.

- I see a constant 3.25 K/s in `iotop`, so I went to look at what file is being written to, and it's Player.log. I see the following recurring log while the stutter is happening:

NullReferenceException
  at (wrapper managed-to-native) UnityEngine.AudioSource.Stop(UnityEngine.AudioSource)
  at AudioObject._Stop () [0x0001c] in <cca0ffe981174746961fc3b67ac84a82>:0
  at AudioObject.Stop (System.Single fadeOutLength, System.Single startToFadeTime) [0x0006c] in <cca0ffe981174746961fc3b67ac84a82>:0
  at AudioObject.Stop (System.Single fadeOutLength) [0x00000] in <cca0ffe981174746961fc3b67ac84a82>:0
  at AudioObject.Stop () [0x00000] in <cca0ffe981174746961fc3b67ac84a82>:0
  at Assets.Nimbatus.Scripts.WorldObjects.Items.DroneParts.DronePartResources.ResourceParticleSystem.Stop () [0x0000a] in <cca0ffe981174746961fc3b67ac84a82>:0
  at Assets.Nimbatus.Scripts.WorldObjects.Items.DroneParts.DronePartResources.ResourceTank.FixedUpdate () [0x00178] in <cca0ffe981174746961fc3b67ac84a82>:0
 
(Filename: <cca0ffe981174746961fc3b67ac84a82> Line: 0)

This keeps repeating, with the same "Filename", with a frequency that matches the stutter. This is most likely the issue.

The stack trace says "ResourceTank", and in fact I reproduced the issue while I was harvesting unobtanium and fighting firemantas at the same time. This repro was with the same save file as attached, on the current solar system, but on the level3 difficulty planet. I was gathering unobtanium at the entrance to the middle layer of the planet. I had emptied "the inside" of the pocket, leaving a "shell" (went back to container to dump), then removed part of the unobtanium "shell" to expose the firemantas on the other side, fired weapons through the hole while gathering the rest of the "shell".

Share this post


Link to post
Share on other sites

I'm now convinced that the reason I previously couldn't reproduce the issue any longer was because upon revisiting an old planet, I only accidentally the first time happened to gather some residue resources while fighting, and the rest of the times I was focused only on fighting, while the bug is related to audio of resource particle.

I reduced the sound and music of the game to 0, in hope of it disabling the sound altogether (instead of volume*0), to no avail.

Share this post


Link to post
Share on other sites

Going back to the container, the frequency of the NullReferenceException log is reduced, lessening the stutter (from 2fps to 70fps, but with a hiccup every half second or so).

Given that this is about `Stop()`ing the audio from a particle, a `null` check could be a good stop-gap measure. Another stop-gap measure would be to "give up" on this action somehow, instead of repeating it (I presume the crashing thread is restarted and it attempts to perform the same task).

---

Note: I was going to see if I can repro the issue by just finding a pocket of resources and shooting at it while gathering it, and ended up reproducing the issue in the same spot (after going to hanger and back), but this time not gathering resources (I did gather some, but had put it in the container. My tanks were empty), and no resources that could be shot at were around.

---

Edit: I reproduced this many more times, and maybe I'm paranoid, but it looks like if I gather some yellow resources, bring it back to the container, then go fight (at least 2) firemantas, the stutter happens as soon as the mantas spawn their fireflies.

Share this post


Link to post
Share on other sites

To confirm these suspicions, I worked around this bug by first going over the planet, killing all firemantas, then start collecting resources. I didn't encounter this issue doing that.

Share this post


Link to post
Share on other sites

Ok very interesting. Thanks a lot for the in-depth analysis!
I did not manage to reproduce it on my machine using your save-file, however I analyzed the code and found some potential bugs that I fixed.

@Shahbaz I uploaded a new build to the preview beta-branch on Steam with those fixes. It would be really great if you could test if it helped or not.

Share this post


Link to post
Share on other sites

@Micha, so far so good! I'll post an update in case I could repro it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...