Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.9.1a is out! (05/10/19); Updated the Forum Rules and Guidelines (02/29/20); Blog post: GIF Roundup (04/11/20)

Author Topic: [Late Game] Battles & Colony Management ruin FPS gradually & permanently.  (Read 170 times)

Ced Riggs

  • Ensign
  • *
  • Posts: 21
    • View Profile

Heya,

I am playing Starsector with a buttload of mods, larger fleets, and 7GB RAM assigned to the game. My savegame file is currently ~80MB in size.
  • Loading into the game, performance is fine.
  • Loading my save, everything is fine.
  • I can fly around, slip in and out of systems, and everything is fine.
And yet...
  • With every colony I touch, performance drops by a tiny margin, and does not recover.
This manifests in colony docking dialog loading longer and longer. Interactions with the options in the menu itself go smooth and quickly, but if I take a tour across my currently seven colonies, I am experiencing a delay upwards of two seconds after docking.
  • With every battle I fight, performance drops significantly and does not recover.
  • Battlesize is directly proportional to performance loss.
  • Not sending in my flagship and fighting battles from the tactical screen helps with performance in fights.
  • The subsequent performance loss is irrespective of whether I watched the battle from flagship, via video feed, or not at all.
Masochistic as I am, I tried to push this as far as I can, and with three HVB fights in sequence, I reduced my FPS (travel mode) to less than three, and colony dialogs take about five seconds to pop up. Another three seconds needed to get from colony menu to colony management. At this point, the associated RAM is maxed out, my CPU is barely concerned and effectively idle. The only way to return to a functional game is saving (takes upwards of five minutes), quitting the game, restarting, loading back in. I can currently play one or two battles, or do two rounds of colony management before the loss of performance becomes annoying. One more battle/five more markets, and I have to restart. This is the end of most of my playthroughs, after a couple of days.

My conclusion is some sort of clean-up not happening and/or some sort of memory leaking that seemingly isn't caught.

Is there anything I can do? Is there anything responsible I could monitor?
« Last Edit: August 02, 2020, 06:30:04 AM by Ced Riggs »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 16736
    • View Profile

Hi - hmm. If you can share your mod list, I think that'd be helpful - this indeed sounds like some kind of leak or similar issue. Knowing which mods are involved could help narrow it down over time.

It's possible to connect to a running copy of the game and check it for leaks - and what's causing it - but its fairly involved. Depending on how comfortable you are with that sort of stuff, there are some instructions here:

http://fractalsoftworks.com/forum/index.php?topic=7690.msg128363#msg128363

Basically, best-case scenario is this would zero in on a specific Java class in a specific mod.
Logged

caekdaemon

  • Ensign
  • *
  • Posts: 3
    • View Profile

Is there anything I can do? Is there anything responsible I could monitor?
I've got this exact same issue: ton of mods, larger fleets, lots of RAM allocated to the game, but then serious drops in FPS after battles until getting into the next battle, where the game will run fine, then get even laggier after getting back to the stratmap. I tried to figure out what it was by a little testing here and there, and at first I thought it was just a problem when two big fleets duked it out with one another, but after a while I noticed that it seemed to have something to do with the afterbattle looting as it seemed to get worse when I had more varieties of item in the cargohold, but don't quote me on that.

Unfortunately, I can't load the save now - Tahlan Shipworks has had an update which doesn't seem to be backwards compatible with that save, so it's KIA, so I can't load it up to rummage around. My current new save seems to have the issue as well, but since I'm flying a smaller fleet the problem doesn't seem to be anywhere near as bad until it builds up over a few hours of play. 
Logged

Ced Riggs

  • Ensign
  • *
  • Posts: 21
    • View Profile

If you can share your mod list, I think that'd be helpful - this indeed sounds like some kind of leak or similar issue. Knowing which mods are involved could help narrow it down over time.
Every mod that works with the current game version and doesn't overlap. I am currently running about 90 mods.

Depending on how comfortable you are with that sort of stuff, there are some instructions here:
http://fractalsoftworks.com/forum/index.php?topic=7690.msg128363#msg128363
Basically, best-case scenario is this would zero in on a specific Java class in a specific mod.
Comfortable enough! Will do that extensively tomorrow and report back.

I noticed that it seemed to have something to do with the afterbattle looting as it seemed to get worse when I had more varieties of item in the cargohold, but don't quote me on that.
Quoted you on that on principle, and, that is a valid pointer. I will look out for that.
Logged

Ced Riggs

  • Ensign
  • *
  • Posts: 21
    • View Profile

Update: To get jvisualvm, I went and grabbed the current JDK; Java 14.0.2 from Oracle.

That did not get me jvisualvm, as this has been removed in 2016, and @Alex post is from 2014. So I went an grabbed VisualVM (same guys, just, no longer associated with Oracle), clipped Starfarer to the VM, and went out to cause mayhem to find my leak in the wild. I fought endless battles, traveled across the universe, flipped markets and caused wars. Two hours later, I could still play fine, and never got to the point where I felt like, yupp, that's the ticket, time to heap dump. Some crazy battles had so many fighters that my rig started chugging, but as soon as the fight was over or enough carrier died, we were back to almost 100% performance. I did notice a very minor stuttering every ~3s that barely registered, like a loss of one or two frames every so often, but that was it.

Will monitor and see if I get this again tomorrow, so I can search for the leak.

Tentative first thought: Maybe JDK 14.0.2x64 fixed an issue JRE 1.8.0_131x86 was having? Will investigate further when it's not half an hour past midnight.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 16736
    • View Profile

Were you actually running the game using Java 1.8? You'd have to replace the jre/ folder that comes with the game, and edit the settings.json file to do that and disregard some fairly dire warnings about it causing instability and so on.

The version of Java you have installed on your system shouldn't matter, though, since the game will run using the jre it's bundled with regardless.
Logged

Ced Riggs

  • Ensign
  • *
  • Posts: 21
    • View Profile

... then it's not that, and I am back to square one of not knowing what the heckie. Thanks for pointing that out. I'll monitor performance, and if I have something, I now know what to look for via VisualVM - thanks Alex!

PS: You might wanna update that post with the links to VisualVM, the usage is analog enough that I could replicate all steps you mentioned in that program.
Logged

Nick XR

  • Captain
  • ****
  • Posts: 389
    • View Profile

You can also use the ConsoleCommands to take a heap dump, if you do that and put the dump in a public place I can take a look at it too.  I'm having similar issues so another data point is interesting to me.

(also once you have a dump you can use EclipseMAT too, or Visual VM)

Ced Riggs

  • Ensign
  • *
  • Posts: 21
    • View Profile

You can also use the ConsoleCommands to take a heap dump, if you do that and put the dump in a public place I can take a look at it too.  I'm having similar issues so another data point is interesting to me.

(also once you have a dump you can use EclipseMAT too, or Visual VM)

Once I can reproduce the behavior, I'll do both - an analysis like Alex described, and a dump for you to look at. I'll start a new playthrough and will keep an eye on it. That'll take some time (work, learning how to sprite, things), but I'll keep you posted here.

PS: Never had a GC issue, only degrading performance. Was always able to save, even in 3FPS scenarios.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 16736
    • View Profile

PS: You might wanna update that post with the links to VisualVM, the usage is analog enough that I could replicate all steps you mentioned in that program.

Good call, thanks! Did that.

PS: Never had a GC issue, only degrading performance. Was always able to save, even in 3FPS scenarios.

Interesting. It taking that long - you mentioned five minutes! - still seems to indicate that there's something going on to slow it down, though. It's possible that the leak just isn't quite big enough to make it crash while saving but just big enough to make it slow, but, yeah, that'd be a fine line for it to walk. The really low campaign framerate seems to be almost be more indicative of some kind of cumulative problem with, say, the same script getting repeatedly added to the game or something that just over time adds up and massively slows it down.

Semi-related note: how big are your savefiles? The size of the campaign.xml, specifically.
Logged