Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Pages: 1 2 3 [4] 5 6 7

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

RartyMobbins

  • Ensign
  • *
  • Posts: 3
    • View Profile

Registered just to say I have the same problem in my current playthrough. My mod list is quite large but the mods that I suspect might be the source of the issue are Vayra's Sector, Nexerelin and, to a minor degree, Adjusted Sector.
Logged

Alex

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

Spoiler
Still not definitive, but here's some more data:

Baseline, flying around with no slowdown, I see:
54% of time is in com.fs.starfarer.campaign.CampaignEngine.advance()
35% of time is in org.lwjgl.opengl.Display.update()
7.5% of time is in com.fs.starfarer.campaign.CampaignState.render()

With slowdown, the breakdown is instead:
54% CampaignEngine.advance()
25% Display.update()
14% CampaignState.render()

Hm.  Looks like there's something suspicious under CampaignState.render().  Let's break that down another level.

Baseline, no slowdown:
com.fs.starfarer.campaign.CampaignEngine.render(): 3.2%
com.fs.starfarer.ui.interface.render: 3%
and a few other smaller things make it all round up to 7.5% total for CampaignState.render.

With slowdown:
com.fs.starfarer.ui.interface.render: 8.6%

...Okay, so it looks like whatever the problem is, it's something to do with UI rendering?  (Trying to track the stack traces down further did not, unfortunately, yield any further information or any sort of obvious smoking gun.)

This was, again, a slowdown triggered after end of battle.  Though, with your comment on invisible tooltips hanging around, I'm wondering if there's a way for such a thing to be generated by an end-of-battle collection screen or something?  Looks like I may need to do memory sampling in addition to CPU sampling...  but not tonight.   This morning?  Whichever; I need to get some sleep.
[close]

First off, thank you for doing this! Hmm.

This actually doesn't seem right. A couple percent difference in the time spent rendering is not going to affect the framerate in a way that's even detectable, let alone bring it down that much. The time spent in Display.update() is mostly time spent sleeping waiting for vsync. The time change spent in render() is probably due to a relatively different amount of time spent waiting for vsync() due to the advance() method taking longer than a single frame's time and changing how all that lines up.

Besides, even with the slowdown, you're looking at rendering being by far the smallest of these three. The data doesn't make too much sense, though, but I'm pretty positive that what it doesn't point to is a UI issue. To me this just looks... strange, like some pieces of the puzzle are missing, or the sampler didn't run long enough, the game was paused/inactive while sampling, the sampling itself affected the distribution (that's always fun), or *something*. Basically, I'd expect to see something more pronounced given the conditions under which the samples were taken, and it's not there, so we're missing something.

Also, the tooltips issue wouldn't just happen like you're thinking - it'd take some time, and iirc was refit-specific. It's basically a red herring for 99% of the cases, not something many people would run into or be noticeably affected if they did.

It'd be interesting to see the data from a screenshot of jvisualvm/visualvm, if you have that. Some thread dumps would I think also be informative.
Logged

Wyvern

  • Admiral
  • *****
  • Posts: 3784
    • View Profile

Hm.  Fair enough; it is only two data points, and inexpertly interpreted at that.  I'll see what I can come up with the next time I run into the problem.  (Annoying that it takes so long to reproduce.)
Logged
Wyvern is 100% correct about the math.

Ced Riggs

  • Ensign
  • *
  • Posts: 43
    • View Profile

I've been trying hard, but after 300 minutes / 30 battles / 50 market interactions, I still had no return of the slowdown.

Which is the darndest thing, because you'd think something that pops after "one big battle" would have popped in that time. "One big battle" in this case was three fleets in one, which was a slog, but, ultimately won.

I did reduce my battle size from 500 to 400 intermittently, though. Maybe that helps? Maybe that averts it from reoccurring? Show of hands, what's your battle sizes?
« Last Edit: August 10, 2020, 04:11:47 PM by Ced Riggs »
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4661
    • View Profile
    • GitHub profile

500, have after-battle slowdowns

(Having the issue without Vayra's Sector. Skimming thread dumps hasn't shown anything interesting.
I'm fairly confident it's not a RAM issue; console mod's RAM display doesn't show memory use exceeding 2 GB of the 5 GB I have allocated at any point.)
Logged

Ced Riggs

  • Ensign
  • *
  • Posts: 43
    • View Profile

During the forum maintenance, I managed to reproduce the issue with 400 battle size, so that's not a safeguard. What I saw in thread dumps was 20% of CPU time alloted to CampaignState.advance and 15% Econ.advance (sp?) over about an hour after first experiencing the slowdown. Turning off campaign map "speed-up" smoothed my FPS experience, but still ran noticeably slower than before that "big battle" event. This time, with Vayra's off, it wasn't an HVB, and it wasn't an IBB - just a regular "Personal Bounty" and a Vengeance Fleet.

Trying to bore down onto the higher rated advance elements did not yield anything I could understand or associate with anything in particular.

Edit: Here's the saved snapshot.

Edit²: After 3h, 30 battles, and a excruciatingly slow campaign map traverse with slow menus...



... I now have 3 hours of CPU sampling, and these are my "hotspots":

« Last Edit: August 13, 2020, 08:44:24 AM by Ced Riggs »
Logged

Pokpaul

  • Lieutenant
  • **
  • Posts: 59
    • View Profile

Probably unrelated, but does anyone else have issues with Starsector sometimes randomly taking a really long time to load and then running like crap? Basically when this happens I restart my computer and then it works normally, although once I had to restart twice for it to go.

Nothing to do with saves, just when starting up Starsector. I'm not changing anything to do with mods or anything, just loading up the same mods every time. I've had visual vm and resource monitor running when this happens, and I'm not even seeing any elevated use of memory, CPU or hard drive, it's just slow.

Normally it takes Starsector about 30 sec to load for me. Then randomly it sometimes takes minutes, for no obvious reason. Sometimes it happens if Starsector is the first thing I do when I start the computer, sometimes it happens if I've been working on something all day and then load up Starsector. I'm not running things in the background or concurently either.

Even though I've got no issues with anything else I run, I've checked my system for the usual suspects and not found anything.
Logged

Pokpaul

  • Lieutenant
  • **
  • Posts: 59
    • View Profile

I'm finding that the game slowdowns and errors are coming and going as I progress, for reasons I can't understand.

For example, my save sizes grow and shrink. My last five saves, most recent first, were 65, 75, 63, 63, 126 MB. The larger saves were associated with greatest in-game and saving slowdowns.
Logged

caekdaemon

  • Ensign
  • *
  • Posts: 24
    • View Profile

I did reduce my battle size from 500 to 400 intermittently, though. Maybe that helps? Maybe that averts it from reoccurring? Show of hands, what's your battle sizes?
2000. I did a little tweak because I wanted bigger battles with more stuff going on, but I get the problem even with small battles of 500-points and just had it again in a whole new save with completely updated mods and loads of other stuff going on. Ended with a fleet wipe, but when I respawned, pure stutter.

EDIT: I just had a thought: has anyone tried to reproduce this bug in the simulator, seeing if a gigantic battle in there causes the slowdown when exiting the screen?
« Last Edit: August 25, 2020, 08:56:00 AM by caekdaemon »
Logged

Kawira

  • Ensign
  • *
  • Posts: 3
    • View Profile
    • INDIE GAMES NEWS NETWORK
Re: [Late Game] Battles & Colony Management ruin FPS gradually & permanently.
« Reply #54 on: September 20, 2020, 05:10:39 AM »

I also have this problem. What I've noticed is that it's not happening until one random moment then you can play 2-3 big battles before occurs again. At one point my game refused to save at last playthrough. Sounds like whatever it is doing, it's slowly corrupting saves.
Logged

Zoro89

  • Ensign
  • *
  • Posts: 39
    • View Profile
Re: [Late Game] Battles & Colony Management ruin FPS gradually & permanently.
« Reply #55 on: September 29, 2020, 12:11:56 AM »

@ Kawira
The same happened to me too. I can "fix" this if I exit the game to desktop and reload a save game before the battle. 2-5 big battles are possible before it happened again. So after the second battle save, exit and load again.

According to our previous shared modlist I can confirm: It's not Vayra's Sector or GraphicLibs.

Spoiler
GraphicsLib 1.4.2 with enableShaders=false
Interstellar Imperium 2.2.1
Lazylib 2.4f
MagicLib 0.29
Nexerelin 0.9.6e / 0.9.6f 0.9.7b
Ship/Weapons Pack 1.11.0
Tahlan Shipworks 0.3.13 / 0.3.17
Tiandong Heavy Industries 1.2.1a
Underworld 1.4.4
Vayra's Sector 3.1.5
[close]
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4661
    • View Profile
    • GitHub profile
Re: [Late Game] Battles & Colony Management ruin FPS gradually & permanently.
« Reply #56 on: September 29, 2020, 07:51:13 PM »

Wacky thing to attempt: Does using Java 8 make the issue go away, or at least delay it?
I did this and haven't been able to readily reproduce the issue after a series of battles; campaign FPS with Shift speedup doesn't reliably go below 57, whereas before it'd IIRC drop to 20 or so.

To try this:
- Install newest Java (version 8 update 261) from Oracle site
- In [starsector-core]/data/config/settings.json, set allowAnyJavaVersion to true
- Change vmparams or the starsector .bat (depending on how you start Starsector) to begin with "java" instead of "..\jre\bin\java.exe"

(Starsector's update to Java 8 was originally reverted and the use of non-standard versions blocked because it caused some strange bugs that couldn't be feasibly tracked down in the available time, but one hopes the newest version doesn't have these issues)
(Also wondering if the newest update of Java 7 works)
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23986
    • View Profile
Re: [Late Game] Battles & Colony Management ruin FPS gradually & permanently.
« Reply #57 on: September 29, 2020, 08:15:46 PM »

(IIRC one of - not the only, there was some weird hard crashing, too - the issues with 8 is that its GC settings are by default different and can cause actual frame drops especially with larger allocations. There's, again iirc, some set of JVM parameters that could be added to use the default Java 7 GC behavior.)
Logged

Histidine

  • Admiral
  • *****
  • Posts: 4661
    • View Profile
    • GitHub profile
Re: [Late Game] Battles & Colony Management ruin FPS gradually & permanently.
« Reply #58 on: October 07, 2020, 07:31:57 AM »

Back on Java 7 (for testing purposes): I was able to reproduce in my game without Nexerelin or Tahlan, albeit with a significant number of other mods and I had to spawn + nuke a bunch of fleets with console to get a really noticeable effect.

It also readily occurs in my previous game without SWP.

Profiling continues to turn up nothing of interest, and console still indicates memory use is a fraction of the available amount. The thing that used up the most RAM according to JProfiler was Vector2f (which can approach 500 MB prior to GC), but this happens even after an application restart (i.e. no lag yet). ArrayLists are another significant hog.

Common mod list
Lazylib 2.4f
MagicLib 0.29
Nexerelin 0.9.7b
Ship/Weapons Pack 1.11.0
Tahlan Shipworks 0.3.13 / 0.3.17
[close]

I have the inkling that the slowdown stems from some unknown issue in the JVM.
« Last Edit: October 07, 2020, 08:06:18 AM by Histidine »
Logged

Modo44

  • Commander
  • ***
  • Posts: 144
    • View Profile
Re: [Late Game] Battles & Colony Management ruin FPS gradually & permanently.
« Reply #59 on: October 07, 2020, 10:59:11 PM »

I can add that Alt-Tabbing brings the slowdowns on quicker using either Java version. This happens both in full screen (for UI scaling), and windowed (for watching streams on the side) modes. Running dozens of mods.
Logged
Pages: 1 2 3 [4] 5 6 7