Suffering from lag spikes ? Is it rendering or script lag ? CC content clogging your quests ? Equip a ring to receive regular on screen notification on script latency.
This is a diagnostic tool not a solution
Install this mod at any time and the player is given some Elven* forged rings of power:
.SKK Script Latency Ring 05 sec
.SKK Script Latency Ring 10 sec
.SKK Script Latency Ring 20 sec
.SKK Script Latency Ring 30 sec
.SKK Script Latency Ring 60 sec
They will test the latency of the papyrus script environment every NN seconds and OnLocationChange with an on screen message (and debug log output) for an indication of the load on that game system along with a script “frames per second” processing rate, learn more HERE.
Try to stay out of menus, holotapes and notes when you are investigating lag, as each time you open one the test timer is cancelled when the world stops to avoid reporting that on hold time as lag.
Remove the ring to stop the test. Spare rings can be crafted at a Chemlab if misplaced and not in inventory.
Best place is probably last, at the bottom of your load order so it gets the lowest priority to generate worst case reporting. Although that’s hope as the actual prioritization of script processing is not authoritatively documented.
Papyrus script lag diagnostic
The test starts a real time script timer for the specified duration. The on screen message shows the percentage of extra real time the timer ran for, which is an indication of the processing queue – backlog – latency – lag.
If you see no messages, you do not have any detected latency at the moment. After 60 seconds of silence a comfort message [ No script latency detected ] will pop so you know the test is still running.
Using the 10 second timer test, a notification of 50% lag means it took 15 seconds to complete the ticks. Be aware that the Papyrus scripting sub-system is s l o w and only has a tiny amount of compute resources allocated to it compared to the other real time subsystems. Using tools like the (excellent) Fallout Performance Monitor will not show script resource over commit.
The script “frames per second” test runs a set of Utility.RandomInt() functions every test timer interval on a separate thread. Each of those function calls takes one game frame, so its simple to count the number of function calls completed in a known time to get the script frame rate. Yes, it is always the same as the Nvidia overlay FPS counter, so this empirical evidence can help to educate the nonsense opinions passed off as fact on Reddit.
Just too many Papyrus script function calls …
… trying to do too much with not enough real time to do it in. The recent promotion of Sim Settlements and Pack Attack NPC as best ever Fallout 4 mods ever in the history of everness has generated a spike in combined installs. Those users of my real time combat mods like Combat Stalkers and/or Settlement Attack System observe extreme actor response lag and Script Lag Detector reports a significant back-log, especially around workshop combat.
That’s simply too many scripts calling too many functions with not enough script processing time slices to cope with all of those threads in the real time frame rate. There is no PRACTICAL way to rob more time for the script system AND preserve frame rates, you are asking for too much from limited resources. The only solution is to switch off script functions (headshots and limb damage scripts are horrible resource hoovers) in quality mods that provide in game settings or configuration switches. Disable functions, but don’t remove scripted mods from a save game unless the mod has a documented and tested method, that will cause you more problems.
OnCellAttach and OnLoad event scripts
A clean vanilla base game will run with 0% lag until you hit busy rendering + actor AI spaces like College Square, Boston Common and outside Goodneghbor when script lag usually coincides with FPS drops and cell load stutters. The faster you move the more queue or backlog can build up. Console [ player.setav speedmult 200 ] and see what happens when you sprint across those cells.
One of the authors of the Papyrus scripting engine (SmkViper) is authoritatively published that script issues can’t affect the display system, it’s the other way around; frame rate affects script execution. Except where the script is vomiting up spawned actors & objects whicn need to be drawn/rendered so will affect FPS. Point is script function calls themselves do not affect frame rate, its number/complexity of objects and messing with optimisation systems.
Those OnCellAttach/OnLoad visual freezes may be high scenery/actor poly counts, missing previz or broken precombines choking the rendering system, and that frame rate drop slows down script engine processing which is mostly bound to frame rate.
So it must be graphical artifacts that are actually affecting Frame Rate, some of which may just happen to be complex scripted objects like Actors or Workshops, or complex/high volume objects being spawned by script. A tonne of them loading in from over ambitious spawning mods will increase both the the rendering and script processing loads. Ideally this test would run OnCellAttach() to help nail those naughty sources, but there is no generic registerable event for that, so we have to make do with OnLocationChange() which are irregular as location boundaries vary wildly.
Workshop Settlements & polygons
Players love to break precombines to scrap dirty scenery objects in their settlements (or adding yet more stuff to already stressed downtown areas). Breaking precombines generally slows down the frame rate. Frame rate governs the execution rate of many script functions, and settlements are chock full of objects running scripts like settler actors and resources. Double-whammy. Then add in the immersive high polygon 4K UHD texture settler overhauls and hundreds of high poly high texture built items with increased build areas and build budgets … LOL come on, free lunches are only for children.
Actors and Textures
Or it may be that your xEdit custom actor hacks have not regenerated facegen data, or, that face data is strewn around in cancerous loose files rather than fast streaming BA2 archives. As those actors cells load, the game engine has to work extra hard to regenerate the mess that you created, on the fly. Applies to slooty clothing, shiny armor, and awesome weapons as well.
Or it may be that the complexity of all your lovely UHD ponytails, clothing and weapons use so many polygon/triangles that there is just too much stuff to draw. Apparently 100K polygon items (backpacks ? weapons ?) are bad news, so 20 settlers wandering around on screen looking awesome with all that stuff will generate a significant load.
Old model console games regularly lock up in Downtown Boston. Yes there is a haep of scenery to render, bu there are also a tonne of actors in the active area around the player. Whilst most of the base game limits itself to ~50 active actors, downtown finds;
Complex Actors linked to complex scripts
Typically engineering issues are the result of not one but a combination of problems or a cascade of events, so look out for;
(1) Larger settlement areas + increased build budgets + lots of settlers with combat ponytails and immersive eye shadow.
(2) Lots of followers + high polygon backpacks + visible high poly weapons (naturally with ponytails, eyeshadow & the rest).
(3) Massive actor spawning solutions + complex combat AI scripts and corpse retention hacks (ponytails and backpacks optional).
(4) Pick and mix from any and all of the above.
Just too many objects in the world
Skyrim has a limit of 1,048,576 persistent + temporary object references loaded in memory, some say Fallout 4 can cope with double that (unverified). Permanent references are always loaded in memory, Temporary should only be loaded in the active uGrids around the player, but all references in ESP and ESL mods are apparently always loaded regardless of temporary or persistent.
Mods that change, add or create large volumes of object references either static placed or dynamic spawns can cause issues, so count your load order static object references with this xEdit script (it will not detect stuff dynamically spawned in game). Fallout4.esm has 62,700 persistent references, NukaWorld adds 17,000 and the largest SKK mod 4-76 OpenWorld only adds/modifies 155 references (plus up to 2,000 scripted actor spawns when the game runs). Its the overhauls/worldspace mods known to touch, place or spawn 300,000 references to look out for …
Messing about with Papyrus INI settings
Some script intensive mods suggest adjusting Papyrus INI settings such as fUpdateBudgetMS. My observations are that tinkering with this core clockwork causes more issues. Your probably slowing your system down even more by robbing rendering to try and pay for scripting, some of which is tied to rendering and so recursive madness happens.
Some of the principle causes of FPS drops which slows down framerate bound script execution:
> Increasing uGridsToLoad active area from the default 5 (10,240 game unit radius)
> Disabling or breaking static item precombined cells (also breaking precomputed visibility).
> Scripts that spawn complex objects, or large volumes of objects or (best yet) large volumes of complex of objects !
> Large numbers of actors with complex real time scripts in the active area (64 is a working limit).
> Actors without packed face data.
> Unnecessarily high polygon count meshes.
> Uncapping settlement build budgets (too many polygons again).
> Unnecessarily high texture resolutions.
> Loose textures not packed into BA2 archives.
> Too many ObjectReferences loaded in memory.
Who to blame ?
Working out which mod or script is causing lag is the really tough part. If you are on PC, use the debug log to see what may be dumping when the persistent lag starts. For Xbox it’s more qualitative: what were you doing, and which of your scripted mods do stuff around that event or location.
I don’t make any graphical/precombine/actor changes to my games and always find that visual or script lag coincides with high volumes of object and actor OnLoad() scripts firing as the parent cells attach. Look out for mods that generate large numbers of HACKED actors or SPAWN and then DON’T CLEAN THEM UP, or mods that change actors behavior with super-clever scripts. That all costs compute.
Sample Debug Log output (if enabled):
Actual Delta Delta Frame
Cell Location Time Time Percent Rate
This is a 5 minute high endurance sprint from Vault 111 new game start (plain vanilla base game, no DLCs, no mods, no women, no children) to Diamond City main gate. Shows the usual cell load stutters at Sanctuary bridge and passing the Switchboard. Notice how script lag and fps drops are related, but don’t appear to be simultaneous:
If nothing is dumping to the debug log, the only way to be sure is to unpack mod scripts using Bethesda Archive Extractor and run Champollion PEX to Papyrus Decompiler to find things like script recursion, tonnes of real time event handlers or complex OnLoad events and then instrument them with Debug.Trace() output. Unfortunately those forensics need a lot of time and a high level of specialist papyrus scripting knowledge which is not worth investing just to identify broken mods.
To be clear: this diagnostic provides direction, it is not a solution to the poorly constructed or conflicting software you chose to run. Solving latency issues in complex real time systems is an expert job that takes a heap of training and experience.
(1) Screen notifications may stop after long periods in workbench crafting menus. Clears on save and reload.
(2) DO NOT RUN THIS CONSTANLTY it is a diagnostic tool to investigate specific issues. There have been several reports that the framerate script instances can stack up not closing down, even though the calling script has a lockout to prevent multiple active instances.
The mod has no dependencies on extenders or DLCs and does not change any base game assets or objects, its 100% pure new Creation Kit forms and scripts. Remove rings before disabling this mod. Only remove mods if you are happy to accept potential conflicts from load order changes in a save game.
PC manual installation
Copy SKKScriptLatencyTest.esp and SKKScriptLatencyTest – Main.ba2 to your …\Fallout 4\Data directory, enable in the Bethesda mod menu, mod manger or whatever.
> Why is there no ESL version ? Because life contains enough hassle already.
> Wont running this detector cause more script lag ? Possibly, and if starting a timer causes more script lag then your save game has some really serious issues.
(*) None of your superficial Skyrim nonsense here, they are original Ñoldorian designs envisioned by Fëanor in Tirion around 4950 FA / 1450 YT to detect structural issues in the creation of Valinor. Or hobbits, whatever.
If a test is running, ignores Power Armor entry/exit trying to equip and unequip the test ring. Requires Fallout4.exe updated to current 188.8.131.52 (or later) use 006 from old files if you are not up to date.
Even more OnLocationChange reporting information to nail down problematic cells.
Added OnLocationChange trigger as most lag spikes happen on cell or location boundaries.
Added: OnLocationChange only activation ring with no regular timer
Added script processing frames per second measure
Added a “No Script latency detected” message every ~60 seconds for comfort that the system is working
Message flood control only display if Delta > 1%
Stop tests whilst in menu mode to avoid reporting that latent time