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 ... 7

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

Alex

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

It's possible to directly trigger an economy update. This should only be done from code triggered by UI interactions (where dropping a frame or two won't matter) but I suppose a script that does this on the regular could result in slowdowns. This may be something to look out for - scripts that call EconomyAPI.tripleStep() or .doubleStep() or .nextStep(). If a script does that not in response to a UI interaction, that's basically an error and an almost guaranteed frame drop.

Generally, the economy will update itself gradually in a way that doesn't impact the frame rate. E.G. the impact of a single tripleStep() is spread out over something like 9 in-game days.

Seeing a stack trace like you're describing could be enlightening - in particular where the economy update code is getting called from could shed some light on whether it's "normal" or troublesome. And it would also (importantly, if it's indeed a problem) tell us where it's being called.


You could still try that VisualVM monitoring that Alex mentioned, see if you have a leak or nah. Considering that Starsector was first released (in Beta) in 2011, it is entirely possible that our contemporary rigs can keep going with a leaked campaign engine. I could imagine that current gen rigs simply shoulder that and keep going, but Alex might be able to shed light on that. I am just making *** up at this point.

It's just a question of how much RAM is allocated. Generally if you've got 4-6 gb or so it'll be fine with a single CampaignEngine instance leak, maybe even two, depending on how much mods have increased the baseline memory needed for a single instance.

Thing is, though, a memory leak is not going to slow the game down unless the total memory used reaches very near the maximum allocated and it forces the garbage collector to "thrash" - meaning, it has to run often, but can't free up much memory because there isn't much to free up. This uses up a lot of CPU and would cause stuttering. It would also extremely likely result in an out-of-memory crash when you try to save, so since that's not happening, it seems fairly unlikely that this is the cause of the problem.
« Last Edit: August 05, 2020, 09:45:03 AM by Alex »
Logged

Cyan Leader

  • Admiral
  • *****
  • Posts: 718
    • View Profile

Posting here to confirm I'm getting this issue as well. Usually the battles are fine but the campaign layer is really laggy on a late game. Initially I thought it had to do with me hoarding weapons but I'm not sure. Usually restarting the game alleviates it but it is very annoying. I allocated 4 gigs to the game of RAM (java.exe -XX:CompilerThreadPriority=1 -XX:+CompilerThreadHintNoPreempt -Djava.library.path=native\\windows -Xms4096m -Xmx4096m -Xss1024k -classpath ) but through the task manager I have never seen it use more than 2.8g, which is odd. I have 16 gigs.

Running with a lot of mods though.
Logged

Alex

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

(Posting the mod list can be helpful in the interest of narrowing down where the problem is, if you don't mind. The game should print the modlist to the log on startup.)
Logged

Cyan Leader

  • Admiral
  • *****
  • Posts: 718
    • View Profile

I can't find that on the log but I typed them out:

Spoiler
AI Core Production 1.0.0
Audio Plus 1.1.1x (old version which I modified to include other music)
Better Colonies 1.4
Commissioned Crews 1.9
Flux Reticle 1.0.1
GraphicsLib 1.4.2
HullMods Expansion 4.2a (should be the latest version before the author asked it to be removed from the forums)
Hyperdrive 2.0.0
Industrial.Evolution 1.7.d
Interstellar Imperium 2.2.1
Karlsson Heirloom 0.12
Lazylib 2.4f
Leading Pip 1.9.0
Logistics Notifications 1.3
Luddic Enhancement 1.2.2
MagicLib 0.29
Nexerelin 0.9.6e
Personal Adjustments (My own private mod which is basically just settings changes)
Player Gate Construction 1.1.1
Polaris Prime 0.23 RC-1
Secrets of the Frontier Prerelease 7
Shadowy Broker 0.1.5
Ship/Weapons Pack 1.11.0
SkilledUp 1.1
SpeedUp 0.6.1
Tahlan Shipworks 0.3.13
The Knights Templar 0.9.9b
Tiandong Heavy Industries 1.2.1a
Transfer All Items 1.1
Underworld 1.4.4
Vayra's Sector 3.1.5
Vesperion Combine 1.2.0
Weapons Group Controls 1.1.0
[close]
« Last Edit: August 06, 2020, 06:41:13 PM by Cyan Leader »
Logged

Nick XR

  • Admiral
  • *****
  • Posts: 712
    • View Profile

I can't find that on the log but I typed them out:

Spoiler
AI Core Production 1.0.0
Audio Plus 1.1.1x (old version which I modified to include other music)
Better Colonies 1.4
Commissioned Crews 1.9
Flux Reticle 1.0.1
GraphicsLib 1.4.2
HullMods Expansion 4.2a (should be the latest version before the author asked it to be removed from the forums)
Hyperdrive 2.0.0
Industrial.Evolution 1.7.d
Interstellar Imperium 2.2.1
Karlsson Heirloom 0.12
Lazylib 2.4f
Leading Pip 1.9.0
Logistics Notifications 1.3
Luddic Enhancement 1.2.2
MagicLib 0.29
Nexerelin 0.9.6e
Personal Adjustments (My own private mod which is basically just settings changes)
Player Gate Construction 1.1.1
Polaris Prime 0.23 RC-1
Secrets of the Frontier Prerelease 7
Shadowy Broker 0.1.5
Ship/Weapons Pack 1.11.0
SkilledUp 1.1
SpeedUp 0.6.1
Tahlan Shipworks 0.3.13
The Knights Templar 0.9.9b
Tiandong Heavy Industries 1.2.1a
Transfer All Items 1.1
Underworld 1.4.4
Vayra's Sector 3.1.5
Vesperion Combine 1.2.0
Weapons Group Controls 1.1.0
[close]

FWIW, here's the intersection of my mod list, with your mod list (I too get horrific post battle slowdown)

Spoiler
Audio Plus 1.1.1x (old version which I modified to include other music)
GraphicsLib 1.4.2
Industrial.Evolution 1.7.d
Interstellar Imperium 2.2.1
Lazylib 2.4f
MagicLib 0.29
Nexerelin 0.9.6e
Ship/Weapons Pack 1.11.0
SpeedUp 0.6.1
Tahlan Shipworks 0.3.13
Tiandong Heavy Industries 1.2.1a
Underworld 1.4.4
Vayra's Sector 3.1.5
[close]

caekdaemon

  • Ensign
  • *
  • Posts: 24
    • View Profile

For completion's sake, my mod list. The logfile didn't contain it for me either (is starsector.log the correct place for it?) so I just grabbed mine from enabled_mods.json

Spoiler
  "anvil_industries",
  "raccoonarms",
  "blackrock_driveyards",
  "Celestial Mount Circle",
  "CombatAnalytics",
  "timid_commissioned_hull_mods",
  "COPS",
  "lw_console",
  "diyplanets",
  "istl_dam",
  "diableavionics",
  "DisassembleReassemble",
  "XLU",
  "fluffships",
  "gt_galaxytigers",
  "ZGrand Sector",
  "GMDA",
  "HMI",
  "deconomics",
  "Imperium",
  "kadur_remnant",
  "lw_lazylib",
  "ArkLeg",
  "luddenhance",
  "MagicLib",
  "Mayasuran Navy",
  "metelson_release",
  "missingships",
  "nexerelin",
  "ORA",
  "roider",
  "SCY",
  "swp",
  "bonomel_skilledup",
  "sun_starship_legends",
  "StopGapMeasures",
  "Sylphon_RnD",
  "tahlan",
  "Terraforming and Station Construction",
  "THI",
  "TORCHSHIPS",
  "underworld",
  "US",
  "vayrasector",
  "vayrashippack",
  "lw_version_checker",
  "vesperon",
  "shaderLib"
[close]

Cross referencing my list with Cyan Leader's and Nick XR's gives these two lists:

Cyan Leader's List
Commissioned Crews 1.9
GraphicsLib 1.4.2
Industrial.Evolution 1.7.d
Interstellar Imperium 2.2.1
Lazylib 2.4f
Luddic Enhancement 1.2.2
MagicLib 0.29
Nexerelin 0.9.6e
Ship/Weapons Pack 1.11.0
SkilledUp 1.1
Tahlan Shipworks 0.3.13
Tiandong Heavy Industries 1.2.1a
Underworld 1.4.4
Vayra's Sector 3.1.5
[close]

Nick XR's list
GraphicsLib 1.4.2
Industrial.Evolution 1.7.d
Interstellar Imperium 2.2.1
Lazylib 2.4f
MagicLib 0.29
Nexerelin 0.9.6e
Ship/Weapons Pack 1.11.0
Tahlan Shipworks 0.3.13
Tiandong Heavy Industries 1.2.1a
Underworld 1.4.4
Vayra's Sector 3.1.5
[close]

Then those two lists together equals this one, where only the mods that are in all three lists are:

Spoiler
GraphicsLib 1.4.2
Industrial.Evolution 1.7.d
Interstellar Imperium 2.2.1
Lazylib 2.4f
MagicLib 0.29
Nexerelin 0.9.6e
Ship/Weapons Pack 1.11.0
Tahlan Shipworks 0.3.13
Tiandong Heavy Industries 1.2.1a
Underworld 1.4.4
Vayra's Sector 3.1.5[
[close]


Logged

Zoro89

  • Ensign
  • *
  • Posts: 39
    • View Profile

...
Then those two lists together equals this one, where only the mods that are in all three lists are:
...

I have the same issue. After 3-5 big battles (fleet points > 1000) the game run slowly immediatly when I'm on the galaxy map again. I have Ryzen 3600, 16 GB and RTX 2060S + Win 10 + SSD. I allocated 8 GB for the game.

This is our shared mod list after I compare it with the above one. On the next game run I will try to turn off Vayra's Sector because it's a "..."megamod" which changes, adds, or replaces several core campaign-level gameplay mechanics..."

Spoiler
GraphicsLib 1.4.2
Industrial.Evolution 1.7.d
Interstellar Imperium 2.2.1
Lazylib 2.4f
MagicLib 0.29
Nexerelin 0.9.6e / 0.9.6f
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]
« Last Edit: August 07, 2020, 06:29:57 AM by Zoro89 »
Logged

Cyan Leader

  • Admiral
  • *****
  • Posts: 718
    • View Profile

I'm curious in knowing if anyone that has been getting these slowdowns can report through the task manager if java is using more than 3G. I have a feeling that the game wants to use more memory but it can't for whatever reason, even when set to.
Logged

Ced Riggs

  • Ensign
  • *
  • Posts: 43
    • View Profile

Ah, yes, cross referencing mod lists.

Sadly, I am using all the ones listed myself. The remaining list is thus:
Spoiler
GraphicsLib 1.4.2
Interstellar Imperium 2.2.1
Lazylib 2.4f
MagicLib 0.29
Nexerelin 0.9.6e / 0.9.6f
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]
At this point, I am leaning towards either Vayra or Nexelerin, which would coincide with the prior mentions of inventory interactions resulting in drops. The "big battles" usually end up with a big loot pile, and unless you skip the loot phase, would always end with opening your inventory. If you have positive experiences without Vayra, please let us know, Zoro89!

I'm curious in knowing if anyone that has been getting these slowdowns can report through the task manager if java is using more than 3G. I have a feeling that the game wants to use more memory but it can't for whatever reason, even when set to.
I've had Starsector at any number from 4GB to 7.8GB (when I had given it 8GB) of RAM. Sorry.
Logged

Ced Riggs

  • Ensign
  • *
  • Posts: 43
    • View Profile

And, an update. I played normally in my new playthrough, and I am still relatively small. No impacts to performance up until now, even when I forgot to go to bed last night. Just now, the very same behavior reoccurred.
  • Bigger battle
  • Loot
  • game starts going slower.
But that is not all. Just prior to this fight, I founded my first colony. This may be confirmation bias, but it seems that opening market dialogues takes longer now. If anything, this may just be because I've played for a while, and isn't really affecting gameplay all that negatively.

Peripheral data:
  • Current save size: 50MB
  • RAM set to 7GB, 5GB in actual use.
  • No extraneous com.fs.starfarer.campaign.CampaignEngine instances.
  • Playtime was about 2h, ish?
  • The single battle the shot my performance was an original IBB mission.
More pointers towards Vayra's Sector? I just have no indication on what I could investigate further to confirm/rule out that it's Vayra's.

Any ideas on what to look for/how to look for the source of this?
« Last Edit: August 08, 2020, 02:05:34 AM by Ced Riggs »
Logged

pairedeciseaux

  • Captain
  • ****
  • Posts: 340
    • View Profile

I just have no indication on what I could investigate further to confirm/rule out that it's Vayra's.

Any ideas on what to look for/how to look for the source of this?

Stupid yet important questions:
  • Have you tried a new campaign without those mods you and others in this thread do suspect?
  • If you see that one battle seem to cause the problem, what kind of fleets/mods were involved in this battle?
  • You mentioned original IBB mission in your last message. What mod and what mission?

Other than that, plain binary search is your friend:
  • look at your mod list, identify mandatory dependencies
  • split the remaining mods in two halves (mandatory dependencies excluded)
  • start a new campaign using the first half + mandatory dependencies, write down the mods used for this campaign
  • do you reproduce the problem? if yes go to point 2
  • you did not reproduce using first half, then start a new campaign using the second half + mandatory dependencies, write down the mods used for this campaign
  • you should reproduce the problem, go to point 2

All of this is kind of sisyphean, having some forms of resource usage tracking built into Starsector could help pinpoint problems.
Logged

Ced Riggs

  • Ensign
  • *
  • Posts: 43
    • View Profile

The mod in question would be Vayra's Sector, which spawns these IBB bounty missions. The IBB in question does not seem particularly relevant, as this does track with previous events in retrospect; IBB missions of higher level are bigger battles, and it has not always been this specific IBB. I am led to believe that there's something off with Vayra's Sector.

The plain binary search is an option I'll go with next, and I'll simply disable the entire Vayra's Sector mod for it. After that, I'd escalate to Vayra and go from there.
Logged

Cyan Leader

  • Admiral
  • *****
  • Posts: 718
    • View Profile

It felt like my problems started after I founded my first colony as well.
Logged

Alex

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

More pointers towards Vayra's Sector? I just have no indication on what I could investigate further to confirm/rule out that it's Vayra's.

Any ideas on what to look for/how to look for the source of this?

If the game starts going real slow - that is, if the frame dips are not periodic, but it's more consistent slowness - then I think the best thing to try would be to run jvisualvm, go to the "Threads" tab, and do a "Thread Dump".

What this does is give you a stack trace for the for all the threads in the current moment of the game. From the stack trace, you should be able to tell what the "main" thread is, and you can take a look to see what it's currently doing.

The thing is, though, since this is a snapshot of an instant in time, it may not be doing the thing that's causing the slowdown just then. But if it's something that is in fact slowing it down, then the odds of seeing it in the thread dump's stack trace are higher because whatever it is is taking more time than other things. Still, you'd want to do this a number of times to get a reasonable sample size - just one thread dump doesn't mean much since whatever it shows is effectively random. Weighted random, but still.

It might still not show the culprit. For example, if a mod were to add, I don't know, 1000 markets to the economy, then this would show the economy being slow without showing an indication as to why. But if there's some kind of script that's taking forever, or kicking off economy updates directly, or whatever, then you might be able to see it in the thread dump.

(And, actually, if it's spikes rather than general slowness, then this approach is probably worth a go, too. It'll just be trickier to time it right.)
Logged

Volkssnake

  • Ensign
  • *
  • Posts: 2
    • View Profile

The mod in question would be Vayra's Sector, which spawns these IBB bounty missions.

I would just like to chime in to point out the Vayra's Sector deals in High Value Bounties (HVB), Ship/Weapon pack is responsible for International Bounty Board (IBB).

I also experience massive post battle slow downs, particular when defending colonies, but this may just be a selection bias thing, I haven't really taken part in super massive battles outside of colony defense. I have 8gb allocated in vmparams.

And to eliminate a few more mods from the cross referenced list
Spoiler
GraphicsLib 1.4.2
Interstellar Imperium 2.2.1
Lazylib 2.4f
MagicLib 0.29
Nexerelin 0.9.6e / 0.9.6f
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
Pages: 1 [2] 3 4 ... 7