Fractal Softworks Forum

Please login or register.

Login with username, password and session length

Author Topic: [0.96a] Targeting Feed Slowdown Fix v1.1  (Read 4335 times)

vicegrip

  • Commander
  • ***
  • Posts: 190
    • View Profile
[0.96a] Targeting Feed Slowdown Fix v1.1
« on: September 08, 2022, 01:12:43 PM »

This is a small quality of life mod that fixes the rendering slowdown issue some graphics cards have with the Targeting Feed system of the Heron. It will remove the shield glow effect but maintains the weapons glow aboard shielded fighters to preserve visual identification when the system is active.

Download Version 1.1
« Last Edit: May 14, 2023, 10:20:31 AM by vicegrip »
Logged

Ruddygreat

  • Admiral
  • *****
  • Posts: 524
  • Seals :^)
    • View Profile
Re: [0.95.1a] Targeting Feed Slowdown Fix v1.0
« Reply #1 on: September 08, 2022, 03:33:10 PM »

small note, this basically already exists in the "renderShieldJitterEffect" boolean in starsector-core/data/config/settings.json (though that's not a particularly obvious place to look)

vicegrip

  • Commander
  • ***
  • Posts: 190
    • View Profile
Re: [0.95.1a] Targeting Feed Slowdown Fix v1.0
« Reply #2 on: September 08, 2022, 04:23:00 PM »

small note, this basically already exists in the "renderShieldJitterEffect" boolean in starsector-core/data/config/settings.json (though that's not a particularly obvious place to look)

I made this because setting renderShieldJitterEffect to false didn't currently affect fighter behavior for this ship system. You can test this for yourself by turning on devMode and giving any of the Heron variants a spin after loading them up with shielded fighters. When Targeting Feed activates you can still see the telltale shield glow even if your graphics card doesn't suffer the framerate drop.

« Last Edit: September 08, 2022, 04:29:44 PM by vicegrip »
Logged

SomeKindOfLifeform

  • Ensign
  • *
  • Posts: 4
    • View Profile
Re: [0.95.1a] Targeting Feed Slowdown Fix v1.0
« Reply #3 on: January 13, 2023, 03:59:06 PM »

Hello,

What did you actually change to remove the effect? Archean order has a similar file called PhaseProjectorStats which does something similar, as well as their own version of Targeting Feed. I am trying to remove the effect but I can't really tell what you actually changed to remove.
Logged

vicegrip

  • Commander
  • ***
  • Posts: 190
    • View Profile
Re: [0.95.1a] Targeting Feed Slowdown Fix v1.0
« Reply #4 on: April 19, 2023, 05:40:45 PM »

Hi everyone,

I've already helped resolve the issue with Archean Order for the above poster but I thought I'd explain it here for anyone else running into similar issues. This mod works by removing the fighter.setJitterUnder and fighter.setJitter effects from the Targeting Feed subsystem code. It's the interaction between this jitter effect and the shield glow on shielded fighters that causes the frame rate drop on AMD cards. Any mods that reuse the Targeting Feed code can cause the same issue, which this will not fix. However, if you have access to the mod's source files, you can diagnose and fix the problem yourself with a bit of work. All you need are two programs, a .csv spreadsheet reader such as Ron's Editor, and a robust text editor such as Notepad++.

It is also possible to fix this bug if the mod did not come with source files, but that involves the use of either an IDE or Java decompiler, which lies outside the scope of this guide. In either case, make a bug report with the mod creator and hopefully they will fix it with an update.

In our example, the mod Archean Order TC v1.4.1.1 has a ship, the Malevolent, which has a ship system ability that causes a significant frame rate drop. Here I have activated "Phase Shell (AO)" with shielded fighters deployed causing an immediate 30 fps drop.

Spoiler
[close]

To see what the code is doing to cause this, we need to track down the correct ship system file. First, let's take a look at the ship's entry in ship.csv. This is a spreadsheet located at (mod directory)\data\hulls\ship_data.csv

Spoiler
[close]

Under system id we can see how the game refers to the system internally, but we still need to track down the code it's using. In data\shipsystems we can look by system id and find the file archean_phaseprojector.system. This is just a text file. Opening it up reveals:

Spoiler
[close]

This is a path to a Java class, and PhaseProjectorStats.java is the file we need to look at. However, a copy might not actually exist at \data\scripts\shipsystems\, since it could have already been compiled by the mod maker as part of a .jar file. To find it, we need to look for the source file.

Checking the \src\ directory inside the mod's main folder we find the following in \src\data\scripts\shipsystems\.

Spoiler
[close]

After we found the .java file, we can take a look through the code and search for fighter.setJitterUnder and fighter.setJitter. If they're present, we've found out culprit.

Spoiler
[close]

However, before we can make changes, first we need archean_phaseprojector.system to point to a new location so it will load our edited code. Going back to the .system file, we will comment out the old "statsScript" line with #, add a new line pointing to a new directory, and save the changes.

Spoiler
[close]

Next, we will create the directory \data\myfix\ and paste a copy of PhaseProjectorStats.java there so we can work on it.

Spoiler
[close]

Now we're ready to work on PhaseProjectorStats.java. However, before the game will load it properly, we need to do some housekeeping.

Spoiler
[close]

Because our .java file now resides at a new location, we need to have its "package" field point to the right place. This is simply the directory where the file is currently residing, \data\myfix\. Next, we need to delete the "final" keyword from the various class variables. Starsector comes with a Java compiler that will convert our code to a version usable by the computer. It's what allows us to make text edits to the source code and have it reflected in-game without using an IDE. However, the capabilities of the Janinio compiler are very limited, and if we attempt to compile our .java file with the "final" keyword, it will crash. Deleting this has no impact on gameplay, so we'll remove them.

Finally, we're ready to comment out the code causing our bug. We do this by adding two / slashes before each line, like so:

Spoiler
[close]

If we did everything right, the game should run and no longer suffer the slowdown.

Spoiler
[close]

Success!

If you game crashes, or the changes are not showing up, you can run through a quick checklist:

Did I update my .system file's "statsScript" field to point to the right directory?
Is my .java file in that directory?
Did I change the "package" field in my .java file to point to its current location?
Does the "statusScript file name, .java file name, and class name all match up?
Did I delete all final keywords in my .java file?
Did I comment out the actual code causing the slowdown?
Did I save all my updates?

Hopefully this should help you get the changes working.

lustfull

  • Lieutenant
  • **
  • Posts: 90
    • View Profile
Re: [0.96a] Targeting Feed Slowdown Fix v1.1
« Reply #5 on: September 07, 2023, 02:45:15 PM »

would it be possible to extend this mod to temporal shell and entropie amplifier ?
Logged

vicegrip

  • Commander
  • ***
  • Posts: 190
    • View Profile
Re: [0.96a] Targeting Feed Slowdown Fix v1.1
« Reply #6 on: September 09, 2023, 08:57:47 PM »

would it be possible to extend this mod to temporal shell and entropie amplifier ?

You can go into starsector-core\data\config\settings.json and set renderShieldJitterEffect to false, and it should apply to all ships of frigate size and above. This mod is only needed because the setting doesn't get applied properly to fighters.

lustfull

  • Lieutenant
  • **
  • Posts: 90
    • View Profile
Re: [0.96a] Targeting Feed Slowdown Fix v1.1
« Reply #7 on: September 11, 2023, 04:54:52 PM »

Still lag despite set this to false. Thanks you anyway.
Logged