Small JS config file mod to gain 10/15+ FPS in airliners and glass cockpit planes

IMPORTANT UPDATE September 17th

THE ACTUAL FIX IS NOT WORKING ANYMORE, PLEASE REMOVE IT FROM THE COMMUNITY FOLDER.

After today’s FS2020 patch, it is now possible to set the instruments refresh rate to LOW / MEDIUM / HIGH from the in-game graphics menu (last item on the bottom of the list).


UPDATE September 4

Very interesting alternative approach to solve this issue with excellent frame rates and much smoother instruments by @Highonsnow: https://forums.flightsimulator.com/t/highonsnow-js-fix-15-19-fps-improvement-on-airliners-targetting-specific-instruments/252551?u=tellurico1975


IMPORTANT UPDATE August 30th

DO THIS AT YOUR OWN RISK
Please follow the instructions carefully to avoid breaking up your PFDs and glass cockpits!

After several tests with all methods, I have created an archive with various options (ready for the Community folder, so you don’t have to touch the official file) for both solutions:

  • The “original” fix that divides the PFDs and glass cockpits refresh rate based on the actual frame rate (initially it was stated it used the nominal screen refresh rate but tests suggested it’s not the case), already tweaked with the cleaner and more efficient code by @ossimc82

  • The excellent fixed Hz solution provided by @CptLucky8 (in my opinion the best option at the moment!)

You can download the Zip with all the options directly from my server, no registration is needed: https://www.postfrontal.com/FS2020/FPS-Fix_Community_Folder.zip

After extracting the archive, you will find different subfolders. Just copy the one you choose in the Community folder as explained later

ZIP CONTENTS:

@CptLucky8 option with fixed PFDs’ and glass cockpits’ refresh rate:

  • FPS-Fix-5Hz
    Solution with PFD’s and glass cockpits’ fixed refresh at 5Hz (for systems with slow or old CPUs, it’s very choppy but still usable)

  • FPS-Fix-10Hz
    Solution with PFDs’ and glass cockpits’ fixed refresh at 10Hz (for systems with medium-slow CPUs, a little choppy but usable)

  • FPS-Fix-15Hz (suggested as a first test)
    Solution with PFDs’ and glass cockpits’ fixed refresh at 15Hz (for systems with medium CPUs, in my opinion a very balanced option between PFDs fluidity and CPU use)

  • FPS-Fix-20Hz
    Solution with PFDs’ and glass cockpits’ fixed refresh at 20Hz (for systems with good CPUs, smooth but a bit more aggressive on the CPU)

  • FPS-Fix-25Hz
    Solution with PFDs’ and glass cockpits’ fixed refresh at 25Hz (for systems with powerful CPUs, very smooth but quite more aggressive on the CPU)

“Original” fix with dynamic division based on the actual frame rate:

  • FPS-Fix-div-2
    The PFDs’ and glass cockpits’ refresh rate will be half of your actual refresh rate (suggested for powerful CPUs)

  • FPS-Fix-div-3
    The PFDs’ and glass cockpits’ refresh rate will be one third of your actual refresh rate (suggested for medium CPUs)

  • FPS-Fix-div-4
    The PFDs’ and glass cockpits’ refresh rate will be one fourth of your actual refresh rate (suggested for slower CPUs)

  • Original unedited file
    If you previously modified the JS file in the Official folder, you can replace it with this backup

HOW TO INSTALL

  1. Decompress the ZIP file in any location on your PC, out of the FS folders (your desktop for example)
  2. If you modified the original JS file in the Official folder, overwrite it with the provided backup file located in the ZIP’s subfolder named Original unedited file
  3. Find the Community folder as explained here: https://www.nexusmods.com/microsoftflightsimulator/articles/4
  4. Choose an option (I suggest starting with the one named FPS-Fix-15Hz) and copy the folder in the Community folder

This is all. If you want to try different options, close FS2020, delete the folder you copied in the Community folder and replace it with another one (for example, if you copied FPS-Fix-15Hz and want to try the 20Hz option, delete the subfolder FPS-Fix-15Hz from the Community folder and copy the one called FPS-Fix-20Hz).
Since FS2020 loads the alternative files in the Community folder at startup, you will have to completely exit the sim and start it again after changing the folder in the Community folder.

Side note: The Garmin and similar instruments’ 3D and map view are not affected by this tweak, only the overlaying text.

Let me know if this works!

OLD—OLD—OLD—OLD—OLD—OLD—OLD—OLD—OLD—OLD—OLD—OLD—OLD—OLD—OLD—OLD—OLD—OLD—OLD—OLD—OLD—OLD—OLD—OLD—OLD—OLD—OLD—OLD—OLD—OLD

UPDATE August 28
The fix can be applied to the community folder, without altering the original JS file.
All the instructions here: FPS Increase - Lower 2D instrument refresh rate - DELETED at Microsoft Flight Simulator Nexus - Mods and community

Please take a look to this Reddit post: https://www.reddit.com/r/flightsim/comments/igw31c/lowering_2d_instrument_refresh_rate_improves/

Starting from there, I did some tests and it seems to work as a temporary solution for the ContentGTDraw/Limited by main thread issue everyone is having mostly in the airliners.
On my system (a gaming laptop with i7 8750h and RTX2080) the CPU is still the bottleneck, but I can see a 10-15 FPS gain in the airliners.

It’s super easy to try and you don’t risk to break anything in the sim. The file to edit can be found here:

MS Store version:
C:\Users\YOURNAME\AppData\Local\Packages\Microsoft.FlightSimulator_RANDOMCODE\LocalCache\Packages\Official\OneStore\asobo-vcockpits-instruments\html_ui\Pages\VCockpit\Instruments\Shared\BaseInstrument.js

OR

%localappdata%\Packages\Microsoft.FlightSimulator_RANDOMCODE\LocalCache\Packages\Official\OneStore\asobo-vcockpits-instruments\html_ui\Pages\VCockpit\Instruments\Shared\BaseInstrument.js

Steam version:
C:\Users\YOURNAME\AppData\Local\Packages\Microsoft.FlightSimulator_RANDOMCODE\LocalCache\Packages\Official\Steam\asobo-vcockpits-instruments\html_ui\Pages\VCockpit\Instruments\Shared\BaseInstrument.js

OR

%localappdata%\Packages\Microsoft.FlightSimulator_RANDOMCODE\LocalCache\Packages\Official\Steam\asobo-vcockpits-instruments\html_ui\Pages\VCockpit\Instruments\Shared\BaseInstrument.js

To edit the BaseInstrument.js file I suggest to use a code editor as Notepad++ or Sublime Text (both free).

Backup the file making a copy on your desktop to restore it in case you encounter any problem.

This is the part to be edited (line 235 in my case but may be different):

CanUpdate() {
        var quality = this.getQuality();
        if (quality == Quality.high) {
            if ((this.frameCount % 3) != 0) {
                return false;
            }
        }	
        if (quality == Quality.medium) {
            if ((this.frameCount % 8) != 0) {
                return false;
            }
        }
        else if (quality == Quality.low) {
            if ((this.frameCount % 32) != 0) {
                return false;
            }
        }
        else if (quality == Quality.hidden) {
            if ((this.frameCount % 128) != 0) {
                return false;
            }
        }
        else if (quality == Quality.disabled) {
            return false;
        }
        return true;
    }

if you don’t have this part (it wasn’t present in my case), just paste it in:

        if (quality == Quality.high) {
            if ((this.frameCount % 3) != 0) {
                return false;
            }
        }	

Consider that Quality.high is the chunk of code used when you are in cockpit, the other quality options are for lower LODs (external views or drone camera based on distance from the plane).
The number you enter here if ((this.frameCount % 3) != 0) (3 in my case) is the glass cockpit instruments FPS subdivision coefficient based on your screen refresh rate (my screen is 144Hz so divided by 3 means the glass cockpit will work at 48 Hz, you can try different numbers based on your display Hz and CPU power).

If you want to do tests with different coefficients you don’t need to close and reopen the program, just exit to main menu and repeat the flight.

Some tests with the A320 in the middle of nowhere in Africa and with Clear Skyes at midday

if ((this.frameCount % 1) != 0) (basically the default option with no division coefficient):

if ((this.frameCount % 3) != 0) (instruments working at 48Hz, very usable):

if ((this.frameCount % 8) != 0) (instruments working at 18Hz, very choppy):

If you want to revert to the original PFDs frame rate please just change the code like this in the Quality.high section:

if (quality == Quality.high) {
              if ((this.frameCount % 1) != 0) {
                   return false;
               }
           }	

Happy modding :wink:

117 Likes

Very interesting, will try this later,

Regarding performance, if being really ■■■■ about it, swapping the if/else over to a switch will be even more performant - also swapping the == for a ===, same with != with a !== as this will type check and not try and not do any dynamic casting.

Good find :slight_smile:

6 Likes

From 15 fps in the Dreamliner to 40+. Well alright, thank you! Did an 8 hour flight yesterday and now it’ll be so much more pleasant.

4 Likes

Blimey, a tip that works for me! Went from approx 19fps in 787 to 30 on Runway at Orbx egnm. Still need more smoothness on my rig but a real measurable improvement, thanks!

1 Like

Are you saying that I should also add another = in the file for even more FPS? And what do i change to a “switch”? Do I just change “if” or “else if” Thank you

Those changes will not give more FPS, it’s just a way to use conditions and comparisons in a more efficient way. I think the point is they didn’t really work in a optimized way all around.

1 Like

A more cleaner and 0.0000001% more optimized way:

CanUpdate() {
    var quality = this.getQuality();
	switch(quality) {
		case Quality.high:
			return this.frameCount % 3 === 0;
		case Quality.medium:
			return this.frameCount % 8 === 0;
		case Quality.low:
			return this.frameCount % 32 === 0;
		case Quality.hidden:
			return this.frameCount % 128 === 0;
		case Quality.disabled:
		default:
			return false;
    }
    return true;
}
18 Likes

i have no idea how code works but dose this work ?

ABSOLUTELY! I just got a 10-ish fps boost!

1 Like

I can now see two codes people have posted.

Which do we use?

I suggest sticking to my first post not to alter too much the code if you are not experienced with code editing.

1 Like

they do for me, it absolutely makes a difference

1 Like

Don’t know why but my LocalCache folder is empty.

If you have the Steam Version check here: C:\Users\YOURNAME\AppData\Roaming\Microsoft Flight Simulator\Packages\Official\Steam\asobo-vcockpits-instruments\html_ui\Pages\VCockpit\Instruments\Shared

Or if you installed in a different folder or drive the location may be different. Try to search the file name BaseInstrument.js in your system with the W10 search.

3 Likes

Thanks, great mod. I’m trying right now, I am sure it’ll help.

2 Likes

Technically it will make a difference, if it’s running an insane amount of times then these micro optimisations will soon add up. Less CPU cycles to do the same checks :).

1 Like

I hope the Devs fix this ASAP. It’s crazy such simple fixes exist but not implemented. I am not one to be overly critical but surely such things should be quickly updated by the devs than us folk messing with files which might mess up future updates. I’m all for mods but how were such quick wins for improved fps overlooked?

4 Likes

Because it’s no a real “fix”. The FPS are improved on the cost of the smoothness of the screens.

If they just did that, by default, people would complain they did a visual downgrade.

4 Likes

Completley agree, I expected better from Microsoft. Since they both design the actual OS and simulator, I would have expected it to be very optimised and not have to mess around in Windows Settings etc

Unfortunately they don’t make your hardware. Different settings will work differently with different hardware.

Do you want something really optimized? It’s called a videogame console. Software and hardware working greatly together.

2 Likes