Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Author Topic: Mod performance is horrific, possible memory leak?  (Read 6517 times)

PotatoFarmer1

  • Ensign
  • *
  • Posts: 38
    • View Profile
Mod performance is horrific, possible memory leak?
« on: January 19, 2022, 11:46:56 AM »

Hi friends!

When I launch the game without mods everything works super nicely.

When I launch with mods my whole PC slows to a crawl, GPU usage shoots up to 100% and I get consistently 4 fps according to the readout in the game but it feels like 1 fps tbh.

SO here is the problem! If I activate one mode and then start the game, it works normally; I get about 60-61 fps stable on the home menu. Then I activate one more mod, and again its stable. So I keep activating mods until I suddenly get 100% GPU usage. Then I deactivate the most recent mod and after a couple of restarts fps goes back to normal (or my PC crashes). I have a suspicion that some mods cause massive gpu load for some reason when they load that preview ship that flies by on the main menu. It seems that the mods that I thought where responsible by method of testing enabling one mode at a time to cause this 4 fps issue do work when I activate only that mod so I can't figure it out!

It also seems that sometimes the game will start and for like 5 seconds it will be at 60 fps and there is that "preloading" text on the screen and then all of a sudden on second 6 it just tanks to 4fps and never recovers

The mods I was certain where causing the issue where: "Outer Rim Alliance", "The Xhan Empire", "Volkov Industrial Conglomerate", and "Keruvim Shipyards". But they all seem to work beautifully if I load only that mod and its dependencies. I can't for the life of me figure this out! Sometimes I will have been sure that I figured out a "stable" mod list but when I come back to the game the next day the exact same problem (100% gpu usage and 4 fps) until I disable all the mods and start from scratch!

What is going on here? Is my game randomly leaking memory in the gpu for some reason when I use mods? It doesn't seem to be loading anything since I can leave the game idle for hours and it never recovers from the 4fps once it hits it. It never goes up or down and gpu usage never seems to drop once it hits 99 or 100 percent.

I have 16gb of RAM and I've tried allocating up to 8gb to the game in vmparams by changing the Xms and Xmx values like I saw in a youtube video, but it seems to have absolutely no effect on the issue in question.

I wonder could I be running out of memory on my video card? I have an old nvidia gpu with only 2gb of memory. Do I just have a hard limit to the amount of ship images that can be loaded or something? But I can't imagine that's the case since the instability happens at the main menu! It's not like I am stable until I try to load in a battle with thousands of different ships! Surely the game isn't trying to load all of these assets into video memory before I've even loaded into any actual gameplay?? Please don't tell me that the ships flying by on the main menu are all being "preloaded" in or something from all the mods you possibly have installed?

Oh yes and btw when this 4fps 100% gpu usage thing happens it doesn't go away even when I load a mission with only 3 tiny ships in it, so it can't be a main menu problem right?

here is my current modlist:
Does anything here pop out as suspicious or conflicting to anybody?
Spoiler
{"enabledMods": [
  "$$$_lightshow",
  "anotherportraitpack",
  "HMI_brighton",
  "lw_console",
  "istl_dassaultmikoyan",
  "DetailedCombatResults",
  "diableavionics",
  "dronelib",
  "fleethistory",
  "HMI",
  "Imperium",
  "JYD",
  "lw_lazylib",
  "exshippack",
  "MagicLib",
  "nexerelin",
  "tahlan_scalartech",
  "swp",
  "underworld",
  "astroidships",
  "shaderLib"
]}
[close]

I want to use a massive modlist because I feel like I've just seen everything in the vanilla game and I want that feeling of wonder and excitement back from seeing a new ship for the first time and wondering what it does. Am I hard limited by my videocard or is there (hopefully) something I am missing that could be fixed?

It's my first time modding the game btw! Any help would be greatly appreciated! I really want as many mods as I can get away with; Particularly I want to see as many different new ships in a playthrough as humanly possible!
Logged

Tartiflette

  • Admiral
  • *****
  • Posts: 3529
  • MagicLab discord: https://discord.gg/EVQZaD3naU
    • View Profile
Re: Mod performance is horrific, possible memory leak?
« Reply #1 on: January 19, 2022, 03:04:40 PM »

That definitely sounds like a saturated Video memory. If your 2GB get filled, your GPU will use regular RAM as a backup, that will in turn cause abysmal performances and instabilities. You can try to use a different preset file for GraphicLib, that can dramatically decrease your VRam requirements, but even then you probably won't be able to play with more than 5 to 10 factions+ ship packs.
Logged
 

PotatoFarmer1

  • Ensign
  • *
  • Posts: 38
    • View Profile
Re: Mod performance is horrific, possible memory leak?
« Reply #2 on: January 19, 2022, 03:42:48 PM »

That definitely sounds like a saturated Video memory. If your 2GB get filled, your GPU will use regular RAM as a backup, that will in turn cause abysmal performances and instabilities. You can try to use a different preset file for GraphicLib, that can dramatically decrease your VRam requirements, but even then you probably won't be able to play with more than 5 to 10 factions+ ship packs.

Thank you for the reply Tartiflette! I was wondering what you mean by "use a different preset file for GraphicLib, that can dramatically decrease your VRam requirements"? How do I do this? I didn't know GraphicLib was customize-able?!? If I can get some tricky way to squeeze more ship packs into my VRAM then I am all ears!
Logged

IGdood

  • Commander
  • ***
  • Posts: 197
    • View Profile
Re: Mod performance is horrific, possible memory leak?
« Reply #3 on: January 19, 2022, 03:46:11 PM »

I find that I increase vrams and replaced Java version 7 with Java version 8 and Starsector runs a lot smoother. 


""Wisp — 10/04/2021 Mini-guide: Switching to Java 8 to prevent the post-battle slowdown Not officially supported, may cause unrelated issues, do at your own risk and please report back if you do notice it causing problems.

Symptoms

    After some time playing and immediately after a battle, the game FPS will plummet (eg from 60 to 15-25) and usually only go back to normal after a game restart.

    Saving/loading takes 5x longer than usual.

    Using at least one mod (that adds new sprites? incl. GraphicsLib).

Fix (slow down and read this part carefully)

    Go to your starsector install and rename the jre folder to jre7.

    Download either of the following (both are the same JRE 8 v271) (Mac/Linux users look below for download link):

        (72 MB .zip) https://drive.google.com/file/d/1CGRtnv5hIGCtcdlvZXFO0F58VXqYUo6x/view?usp=sharing

        (48 MB .7z) https://drive.google.com/file/d/155Lk0ml9AUGp5NwtTZGpdu7e7Ehdyeth/view?usp=sharing

    Extract that into your game folder so you have a folder named jre. You'll now have both jre (with java 8) and jre7.

    Make sure that your starsector/starsector-core/data/config/settings.json allowAnyJavaVersion is set to true. Then launch the game as normal.

Potential issues

    Game+launcher is zoomed in/off-center. Fix: Right-click Starsector, Properties, Compatibility, Change high DPI settings, tick checkbox for "Override...Scaling performed by Application" Thanks to Normal Dude for the fix.

Afterwards, for even better performance See G1GC VMParam Collection, made by @Himemi, not your tech support. The latest version should be available by searching: in:#mod_updates vmparam."
Logged

SpaceDrake

  • Admiral
  • *****
  • Posts: 516
  • Piloting space mecha for fun and profit(?)
    • View Profile
Re: Mod performance is horrific, possible memory leak?
« Reply #4 on: January 19, 2022, 03:59:37 PM »

2GB is definitely on the lean side for running a lot of mods; I have a c. 2014 GTX 970 with 4GB of RAM, and I still get VRAM warnings after a while when running a lot of ship-heavy mods. 2GB is enough for vanilla Starsector by a fair bit, but loading up with a lot of mods is absolutely going to be a challenge. It's not really a code issue or anything; at some point the game just needs X amount of video RAM to hold the sprites and other assets needed to display the game plus the framebuffer, and 2GB is definitely on the lean side for that (and for gaming in general, at this point; hell, I've been conscious of my 970 getting longer in the tooth, but in this crypto-infested hell we live in, it's difficult to do better without shattering the bank).

Even with different GLib settings, you're probably going to have to settle for being a bit conservative with mods until/unless you can upgrade.
Logged

Thaago

  • Global Moderator
  • Admiral
  • *****
  • Posts: 7224
  • Harpoon Affectionado
    • View Profile
Re: Mod performance is horrific, possible memory leak?
« Reply #5 on: January 19, 2022, 04:41:52 PM »

That definitely sounds like a saturated Video memory. If your 2GB get filled, your GPU will use regular RAM as a backup, that will in turn cause abysmal performances and instabilities. You can try to use a different preset file for GraphicLib, that can dramatically decrease your VRam requirements, but even then you probably won't be able to play with more than 5 to 10 factions+ ship packs.

Thank you for the reply Tartiflette! I was wondering what you mean by "use a different preset file for GraphicLib, that can dramatically decrease your VRam requirements"? How do I do this? I didn't know GraphicLib was customize-able?!? If I can get some tricky way to squeeze more ship packs into my VRAM then I am all ears!

You are going to want to edit the file GRAPHICS_OPTIONS.ini in graphicslib to customize it. See here: https://fractalsoftworks.com/forum/index.php?topic=10931

There are many possible ways to change it that take less video memory, but just to see if this is truly the culprit, turn off all graphicslib functionality by setting: "enableShaders":false

This leaves graphicslib still there in name for mods that claim it as required, but otherwise stops it from doing anything. If you don't have any mods that require graphicslib, in your case it might be best to remove it entirely.
Logged

PotatoFarmer1

  • Ensign
  • *
  • Posts: 38
    • View Profile
Re: Mod performance is horrific, possible memory leak?
« Reply #6 on: January 20, 2022, 06:24:59 AM »

Hi everyone!
So the long story short is that disabling graphiclib shaders exactly as @Thaago described completely fixed my issues and allowed me to install a couple more faction mods on top of it all!

I don't even know what graphiclib does tbh but disabling it seems to free up quite a chunk of VRAM!

I wish that there was some way to see your VRAM usage.... wait just as I was writing that I remembered about the task manager on windows: And it seems that with graphiclib disabled I am just barely able to load the following mods at about 1.9gb/2gb of VRAM on my video card!
Spoiler
{"enabledMods": [
  "$$$_lightshow",
  "anotherportraitpack",
  "HMI_brighton",
  "lw_console",
  "istl_dassaultmikoyan",
  "DetailedCombatResults",
  "diableavionics",
  "dronelib",
  "fleethistory",
  "furryPortraits",
  "gflportraitpack",
  "gflportraitpack2",
  "HMI",
  "Imperium",
  "JYD",
  "keruvim_shipyards",
  "lw_lazylib",
  "exshippack",
  "MagicLib",
  "nexerelin",
  "ORA",
  "tahlan_scalartech",
  "swp",
  "underworld",
  "va11portraits",
  "vic",
  "XhanEmpire",
  "astroidships",
  "shaderLib"
]}
[close]
Thats really nice because I was just able to get the last 2 or 3 faction mods that I wanted into the game! If I want to play with other faction mods I will probably have to uninstall something before I install something new again! Thank you everyone for helping me figure this out!

2GB is definitely on the lean side for running a lot of mods; I have a c. 2014 GTX 970 with 4GB of RAM, and I still get VRAM warnings after a while when running a lot of ship-heavy mods. 2GB is enough for vanilla Starsector by a fair bit, but loading up with a lot of mods is absolutely going to be a challenge. It's not really a code issue or anything; at some point the game just needs X amount of video RAM to hold the sprites and other assets needed to display the game plus the framebuffer, and 2GB is definitely on the lean side for that (and for gaming in general, at this point; hell, I've been conscious of my 970 getting longer in the tooth, but in this crypto-infested hell we live in, it's difficult to do better without shattering the bank).

Even with different GLib settings, you're probably going to have to settle for being a bit conservative with mods until/unless you can upgrade.
Yeah I would have to sell both kidneys to afford a new GPU at this point. Even if I had the money it seems like you have to befriend the Yakuza at this point to even get the privilege of paying an exorbitant price for one. One of the reasons I got back into Starsector after a couple year haitus is because my 2gb GTX 960 can't really run anything modern and heavy. I have been playing indie games and older shooters like tf2 mostly nowadays. Starsector is just an amazingly good game for how lightweight it is! I just wanted the mods to cheat my way into some new content over the base game.

I find that I increase vrams and replaced Java version 7 with Java version 8 and Starsector runs a lot smoother. 


""Wisp — 10/04/2021 Mini-guide: Switching to Java 8 to prevent the post-battle slowdown Not officially supported, may cause unrelated issues, do at your own risk and please report back if you do notice it causing problems.

Symptoms

    After some time playing and immediately after a battle, the game FPS will plummet (eg from 60 to 15-25) and usually only go back to normal after a game restart.

    Saving/loading takes 5x longer than usual.

    Using at least one mod (that adds new sprites? incl. GraphicsLib).

Fix (slow down and read this part carefully)

    Go to your starsector install and rename the jre folder to jre7.

    Download either of the following (both are the same JRE 8 v271) (Mac/Linux users look below for download link):

        (72 MB .zip) https://drive.google.com/file/d/1CGRtnv5hIGCtcdlvZXFO0F58VXqYUo6x/view?usp=sharing

        (48 MB .7z) https://drive.google.com/file/d/155Lk0ml9AUGp5NwtTZGpdu7e7Ehdyeth/view?usp=sharing

    Extract that into your game folder so you have a folder named jre. You'll now have both jre (with java 8) and jre7.

    Make sure that your starsector/starsector-core/data/config/settings.json allowAnyJavaVersion is set to true. Then launch the game as normal.

Potential issues

    Game+launcher is zoomed in/off-center. Fix: Right-click Starsector, Properties, Compatibility, Change high DPI settings, tick checkbox for "Override...Scaling performed by Application" Thanks to Normal Dude for the fix.

Afterwards, for even better performance See G1GC VMParam Collection, made by @Himemi, not your tech support. The latest version should be available by searching: in:#mod_updates vmparam."
Thank you for the suggestion! So far I haven't done anything except play a few premade missions but performance has been very stable and locked at about 60 fps no matter what. If I start running into the issue you described then I will try the java trick but for now if it ain't broke then don't fix it!

Thank you everybody for your help! I am super excited to jump into a new and exciting Starsector!
Logged