Prepar3D 5.3+ Affinity Calculator

User Note

This is advanced configuration of Prepar3D that requires manual editing of the Prepar3D.cfg file. If you do not have experience editing INI-based configuration files or manually entering settings into the Prepar3D.cfg, you are encouraged to turn around and head back the other way. You can screw up your config (deleting it will rebuild a new one) if you don't know what you are doing.

HOW THIS WORKS

This tool helps you figure out affinity masks for Prepar3D versions 5.3 and higher. It is a three-step process that is quite literally point-and-click:

  1. Enter the information about your CPU - The number of physical cores and logical processors. Then click "Start Building My Affinity Masks"
  2. A table will appear that represents your CPU. Simply pick which option you want and click the table cell to activate it for whatever item you have selected.
  3. Copy the text below the table that represents your CPU into your Prepar3D.cfg file
Processor Information
Help and Other Info
  • Finding Cores and Logical Processors for your PC

    To find the count of cores and logical processors for your PC, open Task Manager by either right-clicking on the taskbar and choosing "Task Manager" from the pop-up menu, or clicking on Start -> and typing "Task Manager"

    When task manager opens, click on the "Performance" tab and look for the cores and logical processor counts as highlighted by the red box in the image below.

  • Learn More - Settings Description from Lockheed Martin

    As shared in this post on the prepar3d.com forums, Beau Hollis explains the new affinity mask settings available in Prepar3D 5.3+. The below is a direct copy/paste with full attribution to Lockheed Martin/Beau Hollis.


    After you run v5.3, you'll see some new entries in the prepar3d.cfg. If you just want to move P3D's main thread off of core 0, you should be able to achieve that by changing just the MainThreadScheduler field. The values below were written out on a system with an 8 core i7 (16 logical cores)

    [JobScheduler]
    //This has been upgraded to a full 64-bit value to support systems with more than 32 logical cores.
    AffinityMask = 65535
    
    //This is new. This mask tells Prepar3D what cores to use for our job schedulers. It should be a subset of
    //the process mask. Masking off some cores from this will leave them open for 3rd party add-ons,
    //and middleware dll which share processes space with Prepar3D.exe.
    P3DCoreAffinityMask = 65535
    
    //For each bit flipped in the P3DCoreAffinityMask P3D will create a job scheduler which works within
    //a thread tied to that logical core by thread affinity. Using these values, you can assign P3D's special
    //purpose work loads to different logical cores. Moving the main thread scheduler will also set the
    //main thread affinity which will affectively move P3D's main application loop and simulation work
    //to this logical core. This core will likely be utilized at or near 100 %
    MainThreadScheduler = 0
    
    //This thread does rendering jobs such as building and submitting d3d12 command lists.
    RenderThreadScheduler = 2
    
    //This thread does per - frame rendering optimization work such as instancing and sorting of objects
    FrameWorkerThreadScheduler = 4
    

    There rest of the job schedulers handle things like terrain loading and batch building so utilization will vary based on what you're doing.

    If you want to also test out the new P3D core affinity mask, you can set that with similar values that you might have used before with AffinityMask. This new core mask will largely have the same effect in terms of moving P3D's workloads onto those cores but without preventing other thread outside of our job system from using them. The ideal use case for this would be for a heavy add-on such as PMDG that may want to thread off some work. In this case. You could do something like this.

    Here is an example using 8 logical cores:

    // Use all cores for Prepar3d.exe affinity mask 0x11111111 = 255
    AffinityMask = 255
    // Let P3D core work with 6 cores 0b00111111 = 63
    P3DCoreAffinityMask = 63
    //Or you could keep p3d work (and the main thread by extension)
    //off the first 2 cores instead 0x11111100 = 252
    P3DCoreAffinityMask = 252
    

    ...

    On thing to note if you use the scheduler settings, is that those index values are relative to the list of available cores. With a p3d core mask of 0b00111111, thread scheduler 0 is on core 0, 1 is on 1 etc. In the case of 0b11111100, thread scheduler 0 is now on core 2 because the first two cores were excluded from the mask.

    ...

  • Additional Info and Configuration Suggestions

    What You are Tuning

    Prepar3D is a whole-world simulator. It fundamentally works different than other games like first-person shooters or other level-based programs in that the CPU cycles not only render the visual, but keep track of where "everything" in the world is and what it is doing. It also isn't a "fast twitch" game that requires extreme frames per second.

    These differences are important in that you should focus on finding settings that reduce the variability in frame rates, as opposed to the highest frame rates. You want to configure your CPU such that you get the fewest long frames (which cause stutters) while maintaining enough of a frame rate to provide smooth visuals. This is typically anything north of 30 frames per second.

    Understanding what each setting does

    These new settings greatly expand the ways a user can configure Prepar3D to operate optimally given their hardware and the way they use Prepar3D. The settings that work best for somebody flying low-and-slow with few if any add-ons may be significantly different than a user with a large number of SimConnect driven interfaces that is cruising high in complex aircraft. So what works for somebody else may not work for you.

    And before somebody asks, yes, this does properly reverse the binary core counts to affinitize the masks properly with Core 0 at the end and not the beginning.

    AffinityMask - Assigning Cores to P3D processes

    The AffinityMask that has been part of FSX/P3D for some time continues on. The purpose of this setting is to assign cores to the entire process space for P3D and any sub-processes that require access to the process space. What that effectively means is that the AffinityMask is how you assign CPUs to anything P3D related. Some examples of things that are required to run in this space are:

    • Prepar3D.exe itself
    • SimConnect processes
    • dll.xml entries (such as those used for complex aircraft, gauges, etc.)
    • exe.xml entries (third-party processes that run as part of P3D, such as AI controllers)
    • Any add-ons that specify a DLL, EXE, or script process that needs to run with P3D

    What this setting does: At the most basic level, the AffinityMask lets you move the process space for Prepar3D off of CPU cores that are utilized by the operating system or other applications running outside of P3D entirely. It also provides some fine-grained control for users that have hyper-threading (or AMD's version - simultaneous multi-threading) enabled to force the Prepar3D process space onto physical cores and not just logical processors. That's about it.

    P3DCoreAffinityMask - Configuring Prepar3D.exe Separately from Add-ons

    The new P3DCoreAffinityMask allows a user to separately configure Prepar3D.exe (and it's core threads and thread schedulers) from everything else that needs access to the Prepar3D process space. For users that have significant add-ons or use complex airliners or other third-party plugins for Prepar3D, this allows fine-grained control of which CPUs/logical processors handle the actual Prepar3D processes so cores can be dedicated to all that other stuff.

    What this setting does: If you aren't a heavy user of complex add-ons or aircraft, this setting may not do much for you practically and you may be better served setting it the same as your AffinityMask. If you are user of a variety of add-ons, it can let you squeak out a little bit more consistent performance by moving the Prepar3D core threads away from some CPU cores that can effectively be dedicated to all that other stuff. Since the Prepar3D main thread will almost always run at or near 100%, every cycle you can give it will help.

    Main Thread Scheduler, Render Thread Scheduler, and Frame Worker Scheduler

    With these settings, you can assign the most taxing parts of Prepar3D to specific cores/logical processors. For those that understand their hardware well, this means you could in theory move the main thread to the CPU core that offers the highest boost clocks, over-clock, or lowest thermals. As new CPUs (such as the Intel 12-series CPUs - 12900K, 12700K, 12600K...) are released with differing core types, it will also allow you to make sure these threads are running on performance cores, instead of efficiency cores.

    What these settings do: They let you assign the heaviest threads to specific cores. This is probably most important for the MainThreadScheduler which will run at or near 100% of the time almost continuously.

  • Beyond Affinity Masks - Optimizing Prepar3D Performance (Prepar3D System Tuning Guide)

    Optimizing Prepar3D

    In addition to tuning the affinity masks for your PC, there are many other things you can do that will optimize the performance of your PC and Prepar3D.

    Table of Contents

    Power Settings
    Disk Settings
    Graphics Settings (Limiting Frame Rates)
    Some Prepar3D Settings that Impact CPU Usage
    Prepar3D Add-Ons
    Windows Anti-Virus Exclusions

    Power Settings

    Windows Power Profile
    If you want the best performance, you should set the power plan in Windows to "High Performance." This will avoid Windows tuning down the voltage and frequency to cores on your processor to conserve power. If you are using Prepar3D on a laptop, be warned: This will greatly impact your battery life.

    1. Go to Control Panel -> Hardware & Sound -> Power Options.
    2. Under the "Choose or customize a power plan", choose the "High performance" plan. You may need to click on the arrow next to "Show additional plans" to find the High performance one.


    Nvidia GPU Power Settings
    In order to have the highest sustained clocks on an Nvidia card, you need to set the card to prefer maximum performance. Again, if you are on a laptop, this will greatly impact your battery life.

    1. Right-click on an empty area of your desktop and choose "Nvidia Control Panel"
    2. Under the left-hand menu, under the "3D Settings" menu, choose "Manage 3D Settings"
    3. In the box on the right, scroll down to "Power Management Mode" and set it to "Prefer Maximum Performance"
    4. Click Apply




    Disk Settings

    As a general rule, the faster the disk the better. For Prepar3D this not only means having Windows on the fastest disk possible, it also means keeping the Prepar3D install directory as well as all of your add-ons on the fastest disk you can. If you have money to spend on a new PC or parts upgrades, buy the fastest solid-state (SSD) drives you can. Ditch the old mechanical drives - They are orders of magnitude slower to scan and read. If you can, and if your motherboard supports it, buy NVME PCIe Gen 4.0 drives.

    Disable File Indexing (and Compression)
    Windows will constantly index files on your various disk drives to make searching the file system faster. If you can live with slow file searches from Windows explorer, disabling file indexing will speed disk performance. This benefits the loading times of Prepar3D, as well as the scenery paging from disk. Note: If you use the same PC that contains Prepar3D for daily productivity use (MS Office, etc.), you may not want to do this depending on how much file contents searching matters to you. But at the very least, make sure compression is turned off.

    1. In Windows Explorer, navigate to the highest level so your disk drives are visible.
    2. Right-click on the drive containing Prepar3D and choose "Properties"
    3. At the bottom of the window that pops up, un-check the box labeled "Allow files on this drive to have contents indexed in addition to file properties".
    4. In the next pop-up, choose "Apply changes to drive, subfolders, and files"
    5. Click OK and Apply. It may take a long time to update
    6. While you're at it, make sure you DO NOT have compression turned on for any drives containing Prepar3D files or add-ons either.


    Disable File Last Accessed Timestamping
    Every time a file in Windows is read, it updates the file attribute that indicates the last time the file was read. Given the number of files that Prepar3D reads, this can provide a very slight boost to your scenery loading/paging performance.

    1. Open up a command prompt window that is running as administrator.
    2. Type "c:" (where "c:" is the drive that contains Prepar3D and/or your add-ons) and hit enter
    3. type "fsutil behavior set DisableLastAccess 3" (without the quotes) and hit enter.




    Graphics Settings (Limiting Frame Rates)

    When setting your graphics for Prepar3D, you should do so in a way that creates as even and constant an FPS as possible. High frame rates in Prepar3D are completely unnecessary as it is not a fast-twitch game like a first-person shooter. You want consistent frames to avoid stutters and unfortunately there's only one real way to do that: Limit the frame rate. And limit the frame rate low enough that it can be sustained in most/all areas and conditions in which you fly. This is likely around 30 fps.

    The frame limiter in Prepar3D can create some unwanted side effects that impact performance and in testing, the most consistent frames are delivered when Prepar3D is vertically sync'ed and the frames are limited outside of the simulator.

    Note: Some people are not particularly sensitive to what many call micro-stutters. If you're one of them, accept or disregard as you see fit. Wanna know how to check? Do this...

    1. Start a flight in an aircraft and area where you typically fly.
    2. Slew or fly to 1,500 feet or so. The altitude isn't super critical but under 2,000 feet will make it more obvious.
    3. Pan your view so you are looking 90 degrees to the left or right from your direction of flight. The stutters will not be as obvious when looking straight ahead.
    4. Look at the scenery below. If you see the scenery move in a way that's somewhat choppy, that's micro-stutters.
    5. Another thing to try is if you have a detailed add-on airport, pan the 90 degrees while you are taking off down the runway and check for choppiness/stutters.

    Limiting the Frame Rate with NVidia
    There are three ways to limit the frame rate externally using NVidia Control Panel, depending on what your monitor supports and your preferences for other applications outside of Prepar3D.

    If your monitor supports 30hz refresh rates (such as a TV used as a monitor) and you do not notice artifacts when moving the mouse pointer:

    1. Right-Click on an empty space on your desktop and choose "Nvidia Control Panel"
    2. Under the "Display" menu on the left, choose "Change resolution"
    3. On the right side of the resolution list, change the dropdown for Refresh rate to "30Hz". If you do not see 30Hz, your monitor does not natively support that refresh rate. There are ways to force it, however you'll need to explore that on your own.
    4. Click Apply



    If your monitor is a standard 60Hz panel and does not support 30hz refresh rates or the mouse movement at 30Hz annoys you:

    1. Right-Click on an empty space on your desktop and choose "Nvidia Control Panel"
    2. Under "3D Settings" menu, choose "Manage 3D Settings"
    3. On the tabs at the right, click on "Program Settings"
    4. Select "Prepar3D.exe" from the program list.
    5. Scroll down in the box settings box and set "Vertical Sync" to "Adaptive (half refresh rate)". For most 60Hz monitors, this will set the vertical sync rate to 30Hz
    6. Click Apply



    If your monitor is a high refresh rate panel or a freesync/Gsync panel that runs above 60Hz:

    1. Right-Click on an empty space on your desktop and choose "Nvidia Control Panel"
    2. Under "3D Settings" menu, choose "Manage 3D Settings"
    3. On the tabs at the right, click on "Program Settings"
    4. Select "Prepar3D.exe" from the program list.
    5. Scroll down in the box settings box and set "Max Frame Rate" to "30".
    6. Click Apply



    VSync Within Prepar3D
    The most consistent way to achieve constant frames is to configure Prepar3D with VSync on and the frame limiter set to unlocked.

    1. Launch Prepar3D and click on Options on the scenario screen.
    2. Choose "Display" from the left hand side. Set VSync to ON (Triple buffering is optional, but useful) and set the frame slider to the far right at "unlocked"
    3. Click OK.




    Some Prepar3D Settings that Impact CPU Usage

    There's many settings that can contribute heavily to CPU usage. I have found that two of them can be controlled in a way that will drastically reduce the CPU usage without really affecting the quality of simulation and the immersion factor. These are autogen draw distance and AI traffic.

    Autogen Draw Distance
    Autogen draw distance will hit the CPU very hard. You can set the draw distance to "Medium" and still get fantastic visuals while reducing the impact on the CPU. This is especially useful in areas with lots of autogen, such as dense cities or add-ons like ORBX TrueEarth regions that include a ton of autogen buildings.

    1. Launch Prepar3D and click on Options on the scenario screen.
    2. Choose "World" from the left hand side. Set ""Autogen and scenery draw distance" to medium.
    3. Click OK.


    In case you were wondering, the simulator still looks pretty good with the medium setting (click for full-size images):

    Departure from KSFO (ORBX TrueEarth Northern California + FlightBeam KSFO):


    Arrival into KPDX (ORBX TrueEarth Oregon + FlightBeam KPDX):


    Arrival into YSSY (ORBX CityScape Sydney and FlyTampa YSSY 2.0):


    AI Traffic - Using a Limiter
    AI Traffic is brutal on the CPU within Prepar3D. Each AI aircraft that is rendered requires the CPU to track position, flaps, power, lights, etc. While you can lower the traffic slider, many traffic add-ons set the traffic level compiled into their BGLs to 1%, meaning that any traffic setting will generate significant amounts of traffic. The best way to solve this is to use a traffic limiter.

    FSUIPC offers a flexible traffic limiter with a variety of settings. You can try different settings to see what works for you. The recommended settings below work well for even large add-on airports with significant traffic, such as EHAM, EGLL, LFPO, KATL, and others.

    1. Make sure you have FSUIPC installed.
    2. Launch Prepar3D and start a scenario.
    3. From the top menu bar, select "Add Ons", and "FSUIPC..."
    4. Click on the traffic tab and set your traffic limits. The picture below limits total AI aircraft within the "render bubble" to 70.


    There are many other traffic utilities and add-ons, however as FSUIPC provides other capabilities that become near omni-present across the entire simulator, I highly recommend everyone purchase a copy of the registered version.



    Prepar3D Add-Ons

    Some add-ons can create stutters from external EXE and DLLs that interface with Prepar3D. Here's some suggestions on configuring some add-ons to improve performance.

    Navigraph SimLink
    If you are a Navigraph Charts user, Navigraph will install an add-on called SimLink that allows P3D to interface your location with other Navigraph software. The problem is that SimLink can often cause a stutter every 3-5 seconds as it broadcasts your position. If you experience this issue and do not use the features that SimLink enables, you can disable the add-on and stop these annoying pauses/stutters.

    1. Navigate to your Prepar3D v5 Add Ons directory (most likely in your Documents directory) and open the Navigraph SimLink sub-folder.
    2. Rename both the DLL and the add-on.xml file, appending the extension ".off". If you do not see file extensions on your system, you'll need to enable this in Windows. Google how.
    3. If you receive an update to Charts, it may re-enable SimLink. You'll need to keep an eye on it.


    Aerosoft Airbus Aircraft (Particularly the A330)
    The Aerosoft Airbus series runs well in P3D and is a fun add-on to fly, especially with the checklists and co-pilot support. There's two options that can make the Airbus a frame rate killer, particularly on long-haul flights in the A330. You can adjust the settings for the nav display and the weather radar to help address these issues.

    By default, the Airbus series are configured to show a large number of airports, waypoints, and navaids on the navigation display. While handy, in most uses there's never going to be a need to display that many items, so you can configure the nav display to show much less.

    1. From the Start menu in Windows, find and open the Aerosoft Airbus A3XX Configurator.
    2. In the upper-right, lower the number of Max Airports, Max NDBs, and Max VORs that are configured to a number less than 100. 20 seems to be plenty. You can also lower the number of waypoints, but that may impact long and complex routes.
    3. Also check that Force ECAM Software Rendering is unchecked. It will decrease the load on your GPU, but will increase the load on your CPU.



    The weather radar in the Airbus series can also cause frame rate drops, particularly during long-haul flights. By default the Aerosoft Airbus will run the weather radar in the background, regardless if it is on, which on some systems can cause a memory/loop processing leak.

    1. Navigate to the directory into which you installed the Aerosoft Airbus.
    2. From there, go into the "Data" directory and open the file named "AB_ND_GDI.ini"
    3. Add this section to the bottom of the file and save:
      [WXRadar]
      WXBackgroundScan=0
      WXBackgroundScanProto=0
      // Remark: Some WX data are normally required to be scanned in background even when WX Radar is switched off.
      // Due to performance reasons on some customersystems currently the user can select between following background scanning modes: 0 = COMPLETE OFF (best frame rates),
      // 1 = LIMITED SCAN, 2 = FULL SCAN (normal status). As long as WX Radar is switched on, this parameter has no affect! This parameter is allowed to be changed at
      // runtime (just change this parameter in INI file and safe it)
      You can change the WXBackgroundScan to 1 if you prefer a limited scan and see no degradation in frame rates.





    Windows Anti-Virus Exclusions

    WARNING: Setting exclusions in your anti-virus means configuring files, folders, and processes that will not be scanned for viruses. This creates a vulnerability and risk on your system. Only you can determine if the risk is manageable given the nature of your PC usage.

    Windows Defender (and other anti-virus options) can generate a lot of CPU usage and slow down file access. With a software like Prepar3D that is constantly accessing a number of files, this can slow down the simulator and increase loading times. You can create exclusions within Windows Defender to ignore files and folders that are specific to Prepar3D.

    1. Right-click on the Windows Security icon in your notification tray (lower-right of the Windows taskbar) and choose "View security dashboard"
    2. Click on "Virus & threat protection"
    3. Under the "Virus & threat protection settings" item, click on "Manage settings"
    4. Scroll down until you see "Exclusions" and click on "Add or remove exclusions"
    5. Click on the "Add exclusion" button and choose folder. Select the base install folder for Prepar3D.
    6. Click "Select Folder". If you receive a Windows Security warning, click "Yes"
    7. Repeat this process for all folders that contain files read frequently from Prepar3D. This includes your scenery add-ons, ORBX libraries installed outside the simulator root, SODE, your Prepar3Dv5 Add Ons folder in My Documents, etc.
    8. Optional: You can also exclude processes. Some of the processes many run are: Prepar3D.exe, ASP3D.exe, ActiveSkyUtils.exe, couatl64_P3D.exe, Immersion Manager.exe, SimObjectDisplayEngine.exe, etc.
    9. Optional: You can also exclude file types. The two most prominent scenery files are ".bgl" and ."agn".




© 2021 izn-flightsim. No part of this work may be copied or otherwise reproduced, in whole or in part, without the express written consent of the author. This tool is provided with NO WARRANTY, either expressed or implied. Mis-configuration or inoperability of software may occur whether through use of this tool or a software defect within it and no support is provided. This tool is an independent development for Prepar3D and is not endorsed, supported, blessed, or otherwise promoted by Lockheed Martin.