Jump to content
  • entry
    1
  • comments
    31
  • views
    656

2020 Skyrim LE Stability Guide


mrsrt

16,143 views

This is the most actual stability guide that will help you to fix known crashes, technical problems, bugs and improve overall gaming experience as much as the old 32-bit game engine allows. 

 

Philosophy of Crashes

Complete text

Spoiler

Before we start to work on something we should understand what exactly we will work with. Crashes-To-Desktop (CTD) always caused by Unhandled Exceptions inside the game process. It means something went bad in a way when the game engine cannot continue its work. For example, we need to read a value in some configuration file. We read the file, find the required variable and parse its value. But what if we try to read a file that is not exist? - Exception will be thrown that potentially may crash your game. Developers must check first if the file exists and only then try to read it. 

 

Skyrim is a game, considered to be a modding sandbox. It was developed to be modded, special tools was shared for modmakers to help them create new content for the game. Everything was done in a way to allow players make mods. Except file validation. 

You can replace any file you want for the game whether it will be esp, animation, texture or skeleton, but the game engine completely have no checks for what is that file. You can simply create a txt file, rename it to skeleton.hkx, put it for some creature and the game seriously will consider the file as a skeleton. No checks for structure, no checks for resource data at all. And this is the most common reason of CTDs in 2020 skyrim.

Let's say, you downloaded a new remodel for sweetrolls, it has a mesh and the mesh was built with some new format that game engine doens't know. It will have the same extension and look like valid, it will even work, but under some circumstances some data inside the mesh will be different, the game engine will not expect that and in result it may lead to crash. Simply because the mesh format is not correspond to one, expected by engine. Is it fault of modmaker? - No, this is a completely developer's fault. If a file is expected to be replaced it must pass checks and only then used. 

 

Ofcourse, this is not the only reason for CTDs. The second most common reason of crashes are bad designed mods/scripts. The game gives to modders quite wide opporunities to create stuff. If a modder doesn't know how to use them properly or simply made a mistake it may also lead to unhappy consequences, especially with SKSE usage. The game can crash and even ruin your gamesave because of one 10-lines script.

 

The game also have unsafe memory design, internal bugs, 32-bit app limitations, legacy code that works by miracle, but these 2 reasons above cover 95% of CTDs of modern skyrim by my analysis. In other words, if you're modding your game you're always risking to get crashes.

 

 TL;DR

Spoiler

Most of modern skyrim crashes caused by 2 main reasons:

- The game engine has no resource checks

- Bad designed mods

If you're modding your game you're always risking to get crashes.

 

 

Part I - Memory Patches

Skyrim's memory model was designed to work with fixed sized memory blocks. There're a lot of memory blocks in the game process, but we're insterested in 2 main blocks. These blocks hold dynamic in-game data such as NPCs, quests, items and models of everything you see in the game together with script data and something else. It's obvious, the more you mod your game the more data will be stored inside these blocks. But, their sizes are fixed and if stored data overflow crash happens. 

 

We have 2 ways to fix the problem:

- SSME: Largely increase their size to fit appetite of modern skyrim.

- OSAllocators: Remove these blocks and store its data in shared area using OS allocations. 

 

Both ways work, both ways have its pros and cons, and both ways will be shown here. You can choose yourself what path to go:

 

SSME (Recommended):

+ Found by me as the most stable way

+ Uses default alloc method that engine supposed to work with

- Block size increased but still limited (enough for vast majority of players)

- Size of Block 2 cannot be modified (but it's very hard to overflow the block even with a hardly modded game)

 

OS Allocators:

+ Blocks completely unlimited, all data stored in shared process area

+ Supposed to be faster

- Less stable by my tests and much more sensitive to resource data

- May require additional calibrations 

 

Opinion: I always prefer SSME way. for me it behaves more stable and less buggy, however, if your game is very very extremely modded limitations of SSME way may affect. However, I met only one person yet who was able to mod the game to such condition. If you still don't know what to choose go SSME way, it will fit 99% of players.

 

SSME way:

Spoiler

SKSE configuration

Spoiler

SKSE is an extender for Skyrim that expands its script language, allows mod makers to create native functions and much more. It is mandatory to have installed SKSE nowadays. In case for some reason you didn't install SKSE yet, it can be found here: https://skse.silverlock.org/

After installation you need to create a file named SKSE.ini in directory Data/SKSE. If you already have it make sure that u have right values for variables as below. The most important config here is DefaultHeapInitialAllocMB it is responsible for Block 1 size, we set it to 1280 (default 256) that will fit even extremely hard modded games. 



[General]
# Warns us if some mod is missing when we load a game save
EnableDiagnostics=1
# Skse will do clean up if u have dirty removed some mod from a game save  
ClearInvalidRegistrations=1

[Memory]
# Memory patches with recommended values
DefaultHeapInitialAllocMB=1280
ScrapHeapSizeMB=256

[Display]
# Higher quality of makeup textures for characters. 2048 should be pretty enough. Default: 256
iTintTextureResolution=2048

[Debug]
# If your skyrim has crashed it will create a mini crashdump that we may use to determine the reason of it
WriteMinidumps=1 

 

CrashFixPlugin

Spoiler

This is the main stability plugin for Skyrim LE as it fixes many consequences caused by lack of resource checking as well as other crashing places. Can be found here: https://www.nexusmods.com/skyrim/mods/72725/

 

EnbSeries

Spoiler

It is mandatory to enbseries be installed for skyrim nowadays not just because it's beautiful, but for memory management and other features. Install the last version from here (if not installed): http://enbdev.com/download_mod_tesskyrim.htm

Once installed find your enblocal.ini in the main directory. It is a config file with basic local options for enbseries. 

 

ReduceSystemMemoryUsage - delegates texture data storage to another process(es). This is the most important option that should always be enabled. Greatly frees the game process memory from texture data what prevents the game from crashes caused by 32-bit app memory limitations. 

 

VideoMemorySizeMb - don't forget to put here the amount of your video memory size (mb). This way enb will know how much it can use. Or if you are too lazy or just don't know turn AutodetectVideoMemorySize to true.

 

ExpandSystemMemoryX64 - experimental option that enables blocks storage on the bottom of the process memory. May help with stutterings. Not recommended due to inability to work with block 1 more than 768mb. You can play with the option if you want but firstly you should set DefaultHeapInitialAllocMB=768 in SKSE.ini, otherwise CTD on loading happens.   

 

EnableFPSLimit - disable this if you want to play with uncapped or higher than 60 fps. 

 

If you still have some technical problems with enb or the game itself try to use the ISSUES AND BUG FIXES section here: https://www.nexusmods.com/skyrim/mods/38649 If your PC is not strong enough you also may find enboost useful.

 

DO NOT REPLACE YOUR enblocal.ini WITH ANY ENB PRESETS! This is your own configuration file for your PC.

 

Safety Load

Spoiler

This mod fixes the annoying bug when your loading between cells becomes infinite. It happens because of deadlock which the mod fixes. Can be found here: https://www.nexusmods.com/skyrim/mods/46465

 

 

OS Allocators way:

Spoiler

 SKSE configuration

Spoiler

SKSE is an extender for Skyrim that expand its script language, allows mod makers to create native functions and much more. It is mandatory to have installed SKSE nowadays. In case for some reason you didn't install SKSE yet, it can be found here: https://skse.silverlock.org/

After installation you need to create a file named SKSE.ini in directory Data/SKSE. If you already have it make sure that u have right values for variables as below:



[General]
# Warns us if some mod is missing when we load a game save
EnableDiagnostics=1
# Skse will do clean up if u have dirty removed some mod from a game save  
ClearInvalidRegistrations=1

[Display]
# Higher quality of makeup textures for characters. 2048 should be pretty enough. Default: 256
iTintTextureResolution=2048

[Debug]
# If your skyrim has crashed it will create a mini crashdump that we may use to determine the reason of it
WriteMinidumps=1 

 

CrashFixPlugin

Spoiler

This is the main stability plugin for Skyrim LE as it fixes many consequences caused by lack of resource checking as well as other crashing places. Can be found here: https://www.nexusmods.com/skyrim/mods/72725/

Also we need a plugin preloader to make it work proper: https://www.nexusmods.com/skyrim/mods/75795/ (be sure to put the dll to the same directory with skyrim.exe)

Once everything installed find the config file: Data/SKSE/Plugins/CrashFixPlugin.ini and set UseOSAllocators=1

If you have any problems you can also take attention on options like CustomMemoryBlock and others. All options are pretty well described.

 

EnbSeries

Spoiler

It is mandatory to enbseries be installed for skyrim nowadays not just because it's beautiful, but for memory management and other features. Install the last version from here (if not installed): http://enbdev.com/download_mod_tesskyrim.htm

Once installed find your enblocal.ini in the main directory. It is a config file with basic local options for enbseries. 

 

ReduceSystemMemoryUsage - delegates texture data storage to another process(es). This is the most important option that should always be enabled. Greatly frees the game process memory from texture data what prevents the game from crashes caused by 32-bit app memory limitations. 

 

VideoMemorySizeMb - don't forget to put here the amount of your video memory size (mb). This way enb will know how much it can use. Or if you are too lazy or just don't know turn AutodetectVideoMemorySize to true.   

 

EnableFPSLimit - disable this if you want to play with uncapped or higher than 60 fps. 

 

If you still have some technical problems with enb or the game itself try to use the ISSUES AND BUG FIXES section here: https://www.nexusmods.com/skyrim/mods/38649 If your PC is not strong enough you also may find enboost useful.

 

DO NOT REPLACE YOUR enblocal.ini WITH ANY ENB PRESETS! This is your own configuration file for your PC.

 

 

 

Part II - Animation Fixes

Installing too many animations may bring unwanted consequences, in the worst case you'll not be able to load or start a new game. Even if you don't have additional animations it's still recommended to go through the part. 

 

FootIK Solution

Spoiler

When you install too many animations the first problem you meet will be the FootIK error. Usually it happens on the first game loading in open spaces. There're several ways to fix the error. Choose one.

 

ContinueGameNoCrash

Spoiler

This mod will help us to prevent FootIK error (and probably others) when loading a game save with many fnis animations installed. It works with a simple trick: if we load a game save directly we risk to get error, but if we start a new game and only then load the save the error never happens. And this is what exactly the mod does. Can be found here: https://www.nexusmods.com/skyrim/mods/78557/

I recommend to put esp of the mod on top of load order.

Warning: the version has a little bug, when you start a new game and want to load another save you need to load it twice. Happens only once after a new game creation. Can be fixed with pressing F5 F9 F9. 

 

Load Game CTD Fix

Spoiler

The new version of ContinueGameNoCrash. Works without esp, dll only. Also fixes first loading bug and correctly shows messages with missed esp's. Can be found here: https://www.nexusmods.com/skyrim/mods/85443

Warning: may impact on fps. I found the dll consumes up to 5 fps for me what made me refuse the solution for personal usage.

 

Animation Loading Fix v1.0 (Recommended)

Spoiler

Is a modern solution that preloads animations what allows to pass FootIK initialization correctly. I didn't use the solution for long but it should be the best one. Can be found here: https://www.nexusmods.com/skyrim/mods/98204 Get version 1.0.

Warning: VERSION MUST BE STRICTLY 1.0. DO NOT INSTALL VERSION 1.1 OR HIGHER, IT'S INCOMPATIBLE WITH THE NEXT PLUGIN. 

 

 

Animation Limit Solution

Spoiler

Skyrim has internal limit of numStatcNodes when passing which the game will always crash on loading until you remove some animations. There're 2 solutions to fix this. Choose one.

 

Animation Limit Crash Fix LE (Recommended)

Spoiler

This plugin was created by me while debugging the crash. It always drops the numStatcNodes register what prevents crashing and also may increase FPS and loading speed. Can be found here: https://www.nexusmods.com/skyrim/mods/100672

Details about performance impact can be found here: https://www.nexusmods.com/skyrim/articles/52477

 

Animation Loading Fix v1.1

Spoiler

This plugin since version 1.1 has it's own solution to fix the limit problem but with no performance impact. If you don't care about FPS and don't want to hold additional dll's you can use this solution. Can be found here https://www.nexusmods.com/skyrim/mods/98204 Get version 1.1.

 

 

Part III - Optional 

This part is not strictly required, however can improve overall game quality and/or stability under specific circumstances. 

 

 HDT Physics Extensions Crash Fix

Spoiler

If you're using HDT-PE (the mod that gives you physics for hair, body and other things) you may suffer from random CTD's on game loading. Or may not. Btw, I recommend to install the plugin if you're using HDT-PE because the problem can appear anytime as the cause is not yet completely clarified, especially why one suffers from it and another one not. My bet is it depends on physics preset, so if you gonna change it you probably risks to obtain the problem. 

The plugin can be found here: https://www.loverslab.com/files/file/12301-hdt-physics-extensions-crash-fix/

 

Papyrus performance

Spoiler

Do you have any problems with papyrus (e.g. big delays between scripted actions, something happens longer than intended, actions happens not in the right time)?

No

Spoiler

Then you don't need to do anything.

Yes

Spoiler

It may happens because of the overloaded script engine or a bad designed mod. As tests shown, it shoudn't happen in a normal working game with well tested mods. Highly likely you have a mod that causes these problems or the mod where it happens have problems by itself. However, for overloaded script engine may help these options:

 



[Papyrus]
fUpdateBudgetMS=1.6
fExtraTaskletBudgetMS=1.6
fPostLoadUpdateTimeMS=1000.0
iMaxMemoryPageSize=8192
iMinMemoryPageSize=256
iMaxAllocatedMemoryBytes=67108864
bEnableLogging=0
bEnableTrace=0
bLoadDebugInformation=0
bEnableProfiling=0

Put them to the Documents/My Games/Skyrim/Skyrim.ini

It will not cure your problems, but may smooth them. 

 

If you want to continue configuring Skyrim.ini I recommend to use this guide: https://wiki.step-project.com/Guide:Skyrim_Configuration_Settings But be careful and make backup before any changes. 

 

 

High FPS Patches

Spoiler

This section mainly designed for those who want to play with uncapped fps, but will be useful for everybody. 

 

Havok Fix

Spoiler

Havoc (physic engine) should be synchronized with frame rate, but it's static by default and can be configured with fMaxTime option. By default it's configured to work with 60 fps, if your fps goes above or below physic and/or sound glitches may appear. Havok Fix Plugin was created to synchronize frame rate with Havok update time what prevents these glitches. Can be found here: https://www.nexusmods.com/skyrim/mods/91598

Warning: may impact on fps as it works every frame. To lower the performance impact I recommend to set fixed update time with 'freq' option. I play with 50. 

 

BugFixPlugin

Spoiler

As the name mentions, it fixes several game bugs. Also option FixVerticalLookSensitivity fixes the annoying camera sensity bug with high fps. Mod can be found here: https://www.nexusmods.com/skyrim/mods/76747

 

 

Windows 7 users warning

Spoiler

If you're a user of Windows 7 x64 your 32 bit Skyrim cannot work with more than 2GB (by default). It caused by Data Execution Prevention which doesn't work properly with LAA (Large Adress Aware) flag in this version of Windows. To allow Skyrim consume up to 4GB you should disable DEP for exact this application. You can easily do this following this instruction: https://www.online-tech-tips.com/windows-xp/disable-turn-off-dep-windows/

It is very important for Skyrim to have enough memory. If at some point the game engine will not be able to find enough memory it will simply crash. 

 

Critter Spawn Fix

Spoiler

Vanilla critter spawn in Skyrim has very poor performance and architecture, it damages our papyrus viability and may lead to problems in some cases, especially for heavy scripted skyrim. Completely redone critter spawn can be found here: https://www.nexusmods.com/skyrim/mods/76139

 

Dangerous Mods

PlayerSuccubusQuest (https://www.loverslab.com/files/file/667-psq-playersuccubusquest-for-sexlab/) - cum inflation feature of this mod produces infinite threads what eventually breaks papyrus script engine together with your game save. Disable this feature if you want to play the mod safety. 

 

Simply Knock & StorageUtil (https://www.nexusmods.com/skyrim/mods/73236) - this mod uses StorageUtil on gamesave loading to get configuration with relative access "../SimplyKnockData/Common.json". The path is converting by StorageUtil with codecvt function which in that case may work incorrect on Windows OS and access null ptr what crashes the game. It is not really a Simply Knock or PapyrusUtil problem, however are triggering by them. Crash is platform dependent and not guaranteed to pop up for everybody.

 

Dragonborn In Distress (https://www.loverslab.com/files/file/8215-dragonborn-in-distress/) - may cause CTD while save attempt in active quest stage for unknown reasons (I didn't investigate it). Since ver 2.03+ seems to be fixed. 

 

 

Recommendations

- Don't alt-tab from the game. It's simply not supported by Bethesda even with vanilla game. But if you really need to alt-tab at least make a savegame, because returning back you may meet a CTD. 

- Do not disable your mods from load order during game time. It may break your scripts, quest and gamesave completely even if clean it up.

- Always make backups. For everything. For example some mods replace vanilla scripts and if you turn off a mod like this it may break the script completely. So it is very important to do a proper clean up and restoration after deletion. Backups saved my Skyrim many times.

- Keep your main save away from new mods and even mod updates. You cannot know will you like this mod or not, will it bring any problems and so on. If you want to try a new mod i recommend to start a new game and try it out. And after some time if everything looks good include the mod to your main save.

- If you pack your mods into BSA be careful with seq files. BSA archive should have proper flags if contains a seq file. Otherwise it will be unable read and break the mod. Furthermore, new game will be required even if you fixed it.

- If you want to try a new mod, at first better to put it at the end of the load order. If you do it this way the new mod will override everything it needs and it will be less chances to break something for the new mod because of incompatibility with others. However, with this action you still can break old mods in case of incompatibility.

 

Useful

Game paths

Spoiler

Papyrus logs: Documents/My Games/Skyrim/Logs/Script

SKSE crashdumps: Documents/My Games/Skyrim/SKSE/Crashdumps

Regedit Skyrim installation path: HKEY_LOCAL_MACHINE/SOFTWARE/WOW6432Node/Bethesda Softworks/Skyrim

Loadorder: %AppData%/Local/Skyrim

 

Links

Wide collection of guides and useful links to solve many game related problems by @worik https://www.loverslab.com/blogs/entry/6768-patchwork-how-do-i-fix-this-and-that-a-link-collection/

 

Well done blog about how to properly setup and mod the game by @donttouchmethere https://www.loverslab.com/blogs/entry/7521-conglomerate-01-basic-setup-for-modifing-skyrim-le-well-my-skyrim-got-messy-now-i-have-to-clean-it-up-so-i-thought-to-myself-why-not-start-a-blog-about-that/

31 Comments


Recommended Comments



VERY neatly arranged. 👍

Even I can understand it on first glance 🧐

Extra plus: Alternative ways to find a solution!

At last I understand the difference between SSME and OSA way to manage memory. I'm sure it often gets mixed up.

Link to comment

Quite instructive, with detailed explanations and clear instructions for each point.

 

I did read the memory one, and as I have only the crashfix plugin (which is insufficient to handle large battles like the ones created by the "28 days and a bit" mod), I'm gonna apply the modifications you suggest for this part. Thanks for the share ! Smiley_jap_HFR.gif

Link to comment

My favorite guide, works for me. Still think you should add something about bashed patches though because they have been at least rumored to resolve certain crashes to do with level list conflicts.

Link to comment

Not sure of you should include the Continue Game No Crash mod. It is, as is obvious from the mod's page, obsolete and recommends using Load Game CTD fix.

 

You mention Warning: VERSION MUST BE STRICTLY 1.0. DO NOT INSTALL VERSION 1.1 OR HIGHER, IT'S INCOMPATIBLE WITH THE NEXT PLUGIN.  with the Animation loading fix 1.0, it is incompatible with which next plugin?

 

Thanks for the guide especially mentioning the critter patch.

Link to comment
9 hours ago, RohZima said:

Still think you should add something about bashed patches though because they have been at least rumored to resolve certain crashes to do with level list conflicts.

As I said in the old topic, I don't think leveled lists can be directly related to crashes. Furthermore, there're no "conflicts" between them, one list simply replaces another by load order priority. If you have any links or info about leveled lists and ctd relation, please, provide it here. As for now, I consider bashed patch as a game-mechanic patch which fits pretty well game-modding guides like linked on the bottom of the guide, but has no relation to stability and/or performance. 

 

3 hours ago, myriad said:

Not sure of you should include the Continue Game No Crash mod. It is, as is obvious from the mod's page, obsolete and recommends using Load Game CTD fix.

I included it as option. I didn't test enough time the Animation loading fix to recommend it 100%. Also, this is not a gamesave preloader, it helps strictly only with FootIK error, and I'm pretty sure there can be more problems that are triggering on loading a heavy modded game. Gamesave preloader potentially could fix them. 

As for Load Game CTD, I personally detected fps impact by the dll, probably it injects in the render thread what may decrease performance. Also it decreases loading speed even between cells. As for me, I don't think it worth when the old one gives the same benefits with less price. 

 

3 hours ago, myriad said:

You mention Warning: VERSION MUST BE STRICTLY 1.0. DO NOT INSTALL VERSION 1.1 OR HIGHER, IT'S INCOMPATIBLE WITH THE NEXT PLUGIN.  with the Animation loading fix 1.0, it is incompatible with which next plugin?

Animation Limit Crash Fix LE I meant. It's incompatible with ver 1.1 because does the same work in the same place, but in a different way.

Link to comment
On 2/24/2020 at 3:25 PM, mrsrt said:

I included it as option. I didn't test enough time the Animation loading fix to recommend it 100%. Also, this is not a gamesave preloader, it helps strictly only with FootIK error, and I'm pretty sure there can be more problems that are triggering on loading a heavy modded game. Gamesave preloader potentially could fix them. 

As for Load Game CTD, I personally detected fps impact by the dll, probably it injects in the render thread what may decrease performance. Also it decreases loading speed even between cells. As for me, I don't think it worth when the old one gives the same benefits with less price.

Fair enough, I have a very beefy machine here and can load any save without issue. On my old machine, always had to start in the LAL dungeon or on a small level.

Link to comment

Wrong link on Part II animation fixes

 

You recommend Load game CTD but then add that;

 

Warning: may impact on fps. I found the dll consumes up to 5 fps for me what made me refuse the solution for personal usage.

 

Next, when we get to animation limit section you say this

 

"This plugin was created by me while debugging the crash. It always drops the numStatcNodes register what prevents crashing and also may increase FPS and loading speed. Can be found "

 

But the link you added is for Load game CTD

Link to comment
On 5/2/2020 at 12:09 PM, Tyrygosa said:

Could you test/weigh in on this thing https://www.nexusmods.com/skyrim/mods/102610 released yesterday on nexus?

I have tested the plugin and it ruined a half of working software on my PC including browser and even file explorer's instances until reboot. It means the plugin has dirty and faulty memory management. 

The description is quite hard to understand, it was written on english but still chinese. If I understand it correctly, it takes some static memory address and starts to use it as an additional skyrim's pool without any checks and allocations. This is unacceptable.

- The memory area can be used by other software that allocated it, in the best case it will just crash the software's instance.

- The memory area can be written by other software, this way it will crash your game.

I strongly do not recommend to use the plugin because of this. If you still wanna try it, use AddressExtension = false, probably it will solve the problem. 

 

The next thing it provides is "Memory Buffer". It sounds pretty similar to OS Allocations by CrashFixes with doubtful performance changes. I have no idea how exactly it works as author didn't provide any source code. Personally, I didn't notice any performance difference. 

 

The "Free Memory" feature lacks of description. But even so I can say that this feature is redundant because the game has a well done internal memory cleaner that works pretty well. Additional cleaner will bring only risk to break using memory.

 

Process affinity and priority you can set yourself with a bat file or a task manager. 

 

Script repairing with a dll sounds pretty weird. What's the point to use native/memory calls if you can edit scripts directly?

 

"Embedded Game Window" sounds even more weird. If you're frequently alt-tabbing it's better to just use a borderless window, provided by OneTweak, for example. It's good if it works btw, but the impact is insignificant to install dll just for this with risks the dll brings.

 

The FPS Booster, according to description, just disables some effects through enb. Cannot comment as I didn't test it but sounds like editining ini through dll.

 

So far, I see a potentially dangerous plugin that may ruin not only your game stability but also active software on your PC. I do not recommend to install the plugin and will not add it to the guide unless some significant changes will be done and source code released what I asked him for. 

Link to comment
4 hours ago, Tyrygosa said:

What's up with Skyrim Memory Optimizer - Plugins ? Was on hotfiles for a week on nexus, should we use it instead of something else that we used before?

First of, this is a new version of a dangerous plugin that was released in May. I left a detailed report after pesronal test that can be read above. I also have tested the newest version but not for long and not widely. It seems to be safe to use now, but as of ~5 hours of test I encountered an additional gamesave loading CTD with code 0xF53759. Error said a function got incorrect argument, what can happen only by incorrect calls with dll. Removing dlls solved the problem.

 

I didn't notice any difference while playing neither with FPS, nor stability, nor loading speed as ppl say in comments. Completely no changes. My game was built leading the guide and I have no CTD or stability issues. It's possible that it helps to those who doesn't use memory patches as it pretends to replace crashfix plugin by meh321. For those who has already a properly built Skyrim, it seems, brings nothing. In this case I prefer to use the widely tested crashfix plugin.

 

UPD: Seems te be still unsafe. My software started to behave weird after launching Skyrim with that plugin. Not sure if it's really caused by the plugin, but pretty similar to what I saw in the previous version. Please, inform me if your PC goes wild after installing that plugin, need at least one more confirmation as I cannot properly test it now due to work. 

Link to comment

That thing is stupid and outright dangerous.

I just took a look at the .exe's VB source code, not only is the thing dangerous, but it's written with chinese variable names and comments. Do asians even understand the concept of lingua franca?

 

Let's take a look at some of this stupid shit.

 

        Dim MAX_PATH As Integer = 2048 - 1
        MAX_PATH *= 1024
        MAX_PATH *= 1024
        
        Result = VirtualAllocEx(hProcess, NULL, MAX_PATH, AllocType, PAGE_EXECUTE_READWRITE)

Why in hell are you forcing a 2 GB heap allocation on top of the initial heap allocation that SKSE already does? Not only that, but this thing does it even if the main process isn't needing that much allocated memory, further exhausting available system RAM for other processes, such as enbhost.exe. Plus, take a look at this comment from SKSE code:

	// clamp to these values because going over that is stupid
	const UInt32 kMax_defaultHeapInitialAllocMB = 1024 + 256;
	const UInt32 kMax_scrapHeapSizeMB = 512;

 

Result = SetProcessAffinityMask(hProcess, SingleThread)

He calls it "EnableUnsafeThreadCrashFix". KEK!

 

Result = SetPriorityClass(hProcess, 优先级)

User processes should never be set above normal... Ever!

Ex: If you want to make a process (such as a web browser) faster while you are doing something CPU intensive but otherwise automatic (such as decoding videos), you lower the priority of the process doing intensive CPU work, this way the browser (and other system resources) get CPU time priority over that automatic but intensive process that you are running in the background.

Raising the priority of TESV.exe above normal while all the other system resources are running on normal priority means that TESV.exe will get CPU time priority over critical components of your system, which may lead to system instability, deadlocks, lack of entropy for RNG engines, etc. Simply don't do it!

 

        Do
            Pid = GetPid(ProcessName)
            MemUsage = CInt(MyProcess.WorkingSet64 \ 1024 \ 1024)

            If MemUsage > WorkingSetSize Then

                If EnableSwap = True Then
                    SetProcessWorkingSetSize(hProcess, Empty, Empty)
                End If

                If EnableRealloc = True Then
                    GetProcessWorkingSetSize(hProcess, Min, Max)
                    SetProcessWorkingSetSize(hProcess, Empty, Empty)
                    SetProcessWorkingSetSize(hProcess, Min, Max)
                End If

                If EnableEmpty = True Then
                    EmptyWorkingSet(hProcess)
                End If

            End If

            Threading.Thread.Sleep(SwapCycle)

        Loop While Pid <> NULL

What's the point of this other than to force paging everytime TESV.exe's working set is bigger than "MemorySwapBlockSize"?

Paging crazy like this will cause a huge performance drop and chances of heap corruption by constantly swapping between RAM and disk.

And what the fuck is the point of SetProcessWorkingSetSize(hProcess, Empty, Empty) and EmptyWorkingSet(hProcess) under two different options? They do exactly the same thing.

https://docs.microsoft.com/en-us/windows/win32/api/psapi/nf-psapi-emptyworkingset

Quote

You can also empty the working set by calling the SetProcessWorkingSetSize or SetProcessWorkingSetSizeEx function with the dwMinimumWorkingSetSize and dwMaximumWorkingSetSize parameters set to the value (SIZE_T)(-1).

 

I didn't check the SKSE plugin (.dll) because I didn't find a source code for it and it's not like I am ever going to use it to even consider reverse-engineering.

 

TL;DR: Don't use it. Use SKSE's initial heap size/OSAllocators from Crash Fixes + ENB's Memory:ReduceSystemMemoryUsage (its IPC overhead is far more desirable than constant paging).

Link to comment
3 hours ago, Hawk9969 said:

Don't use it.

Thank you for the analysis, it saved me some time that I don't have completely now. 

 

3 hours ago, Hawk9969 said:

Ex: If you want to make a process (such as a web browser) faster while you are doing something CPU intensive but otherwise automatic (such as decoding videos), you lower the priority of the process doing intensive CPU work, this way the browser (and other system resources) get CPU time priority over that automatic but intensive process that you are running in the background.

Raising the priority of TESV.exe above normal while all the other system resources are running on normal priority means that TESV.exe will get CPU time priority over critical components of your system, which may lead to system instability, deadlocks, lack of entropy for RNG engines, etc. Simply don't do it!

Not sure about older Win versions, but Win 10 handles process priorites pretty well. You can set priority up to High for your important processes. But efficiency of the action is doubtful, to see noticable impact all cores of your CPU should be busy, only in that case priorities will be used by the thread broker. As of system stability, your process will compete for resources with system processes only if it was set in Realtime priority and never above them. 

A popular game now CoD: Modern Warfare also automatically sets its process priority to high. But what I don't understand in this process-priority meta is why game process sets priority itself if it should be decided by user and nobody else? If user needs priority for it he can just start the game process with required priority and affinity with a bat file. There's no point to do that with dll or anything else.

 

What really makes the plugin dangerous is that it affects RAM outside of process memory. Every time I launch the game with that plugin it ruins my IDE and browser instances. Firstly I thought it was fixed in the new version as browser behave well but then my IDE stuck while commit merging... Players should be notified about the threat the plugin brings. 

Link to comment

I see him allocating memory to the .exe's heap, but those memory blocks are allocated properly and is never used by the .exe. I assume he is accessing those inside his SKSE plugin.

 

The above code where he forces paging, notice that he never updates the handle for the process nor the MyProcess variable inside the loop?

Assume the following:

The exe is currently blocking at Threading.Thread.Sleep(SwapCycle).

TESV.exe exits, orphaning the exe.

The exe resumes its loop after sleeping because "Pid <> NULL" will evaluate true (PID is updated BEFORE the sleep).

Both MyProcess and hProcess are now invalid and might be pointing to a newly created process/module or part of it.

"MemUsage > WorkingSetSize" ends up evaluating true because we are now grabbing data from invalid handles.

Forces resizing of an invalid working set.

exe now exits because PID == NULL.

 

This is just guessing though, as I haven't seen what his SKSE plugin actually does.

Link to comment
10 hours ago, Hawk9969 said:

Both MyProcess and hProcess are now invalid and might be pointing to a newly created process/module or part of it.

Yes, that's probably possible, but in my case I don't close IDE instances before game launch as I have 32gb ram, so they shouldn't be affected this way. Furthermore, Intellij Idea keeps everything inside existing processes. 

When I tried the first version of this plugin released in May it was ruining not only IDE instances but also browser and file explorer as well. It looked like he writes memory somewhere by static pointer and something like that was written in the description. 

Link to comment

I didn't see the code for the first version and just from the VB source code for the exe, there is nothing there that should be corrupting memory elsewhere.

The Static Memory INI options are just for the .exe to call HeapAlloc and HeapReAlloc on itself, which is what new, malloc, calloc and realloc end up calling on Windows anyway.

 

I assume his SKSE plugin spawns the exe process via CreateProcess (with PROCESS_VM_READ and PROCESS_VM_WRITE) and then transfer data between them with ReadProcessMemory and WriteProcessMemory, which is no different from what ENB's Memory:ReduceSystemMemoryUsage does already; the difference likely lies in what kind of data they cache in separate processes. ENB only caches renderer stuff (textures, vertices, etc), which is completely fine, since these are the big datas anyway. Moving engine data and other datas that get constantly accessed/written to another process is only going to contribute to the game's performance degradation due to IPC overhead.

 

In any case, from just looking at the VB source code and not at the SKSE plugin, nothing points at any kind of "memory optimization", be it on performance or storage, despite the mod's name. You also should not be running out of virtual address space with both TESV.exe and enbhost.exe running, unless you've a really bad SKSE plugin leaking memory (my TESV.exe process never goes above 2 GB).

Example of a bad SKSE plugin leaking memory:

try
{
    char* data = new char[4096];

    do
    {
        DoSomethingWithItButDontEverReleaseIt(data);
    }
    while (data = new (std::nothrow) char[4096]);
}
catch (const std::bad_alloc&)
{
    DoError();
}

 

So, dubious "features", forced swapping, doesn't really do anything that ENB doesn't do already and probably does it worse, degrading performance.

Don't fix what's not broken. If you've SKSE initial heap memory patch or OSAllocators and TESV.exe has enough free virtual address space, just go with it, if your memory monitor shows it going higher than ~3.5 GB (or always crashing when loading a save game), enable Memory:ReduceSystemMemoryUsage within ENB. At this point all of your 32-bits virtual address space problems should be solved without any further action or mod needed.

Link to comment
13 hours ago, XarisZ said:

What about his new mod https://www.nexusmods.com/skyrim/mods/104438 ?

Is this one harmfull as well?

 

According to the description, it looks like he adds thread.sleep() inside the infinite loop, while CPU waits for GPU to render a frame. Well, it definitely will reduce CPU usage in that case, but may increase input lag coz frame can be done while sleeping. This way developers prevent 100% CPU core utilization with infinite loops in server developing for example, such as loop of a socket selector. But..

1) I don't think it is viable for games, especially for render thread which needs to be work as fast as possible with the smallest delay.

2) It will be completely useless if GPU works faster than CPU in processing game ticks.

So, this plugin is more useless than harmful (unless there're some critical bugs inside). However, if you have some problems with CPU cooling or power consumption you could be interested in this. 

I'll test it for a while when I have time.

Link to comment

Yes, I took a quick look at the source code and that's all he does: Sleep(Sleeptime) before a call to IDirect3DDevice9::Present.

 

No point in ever using this one aswell, renderer threads will already block on its own until the GPU is ready to render another frame, otherwise you would be at 100% CPU usage for the CPU/core running the renderer thread.

This "optimization" WILL DEGRADE PERFORMANCE if the CPU is bottlenecking the GPU (GPU is ready but the thread is currently blocking by the Sleep call).

 

P.S. I think there might even be some stack corruption there.

    bool SKSEPlugin_Load(const SKSEInterface* skse)
    {
        _MESSAGE("Present Plugin loaded.");

        GameHook();

        BlackScreenHook();

        return TRUE;
    }
__declspec(naked) void BlackScreenHook()
{

    __asm
    {
        mov eax, eax // 代码对齐
        nop

        retn 0x4

        ...
    }
}

This looks like to have been placed there to reserve 6 bytes (not sure why not 5 bytes for a 32-bits near jump/call) for runtime hooking, Microsoft does it like this for Windows API functions.

However, the data of that address is never changed and he calls BlackScreenHook() only once at SKSEPlugin_Load.

 

Now what happens is this:

  1. When BlackScreenHook() is called it pushes the EIP register (instruction pointer for the next instruction) into the stack.
  2. mov eax,eax is nop, does nothing.
  3. nop, does nothing.
  4. retn pops the instruction pointer from the stack, write it to the EIP register and the operand pops another 4 bytes from the stack; you've now corrupted the stack as you would've needed to pop only 4 bytes (instruction pointer), but you end up popping 8 bytes.
Link to comment

First, I want to thank you for this guide, a lot of useful information and, accordingly, many questions arose ...

 

My game is Skyrim LE. System  - Windows 7 x64 Ultimatum. i7 (4 Core, 8 treads)

 

According to the guide  https://www.nexusmods.com/skyrim/mods/74427/? I used the plugin nvac.dll.  I would like to receive your comments regarding the use of this plugin.

 

I am also very interested in your opinion about  PrivateProfileRedirector

 

Your opinion on this (from here)

 

Quote

C) For each CPU number you want to run the application on, replace 0 (off) with 1 (on) in the binary number for the CPU numbers.

For Skyrim, if I wanted to run the application only on CPU 0, CPU 2, CPU 4 and CPU 6 then my binary number would be changed to 01010101. (see screenshot below):

444.png.c5f251f5a033250eaf19f86b80a90ed4.png

 

Concerning DEP… Do I need to add to exceptions ENBhost?

 

Is it safe to switch from Method 2 (OA) to Method 1 (SSME), or is it a new game?

 

What is the limit of Method 1?

 

Further, a little background ... I don't remember exactly when and why, it seems after reinstalling Windows, my CK stopped working correctly. Namely, every time the plugin was saved, it crashed. This helped:

 

Quote

333.png.8fe3396192582e6ffeb1a2560c311523.png

 

Today I decided to try this method for TESV, SKSE and ENBhost. It seems to me that work has become more stable, but I would like to move from “it seems” to a professional opinion.

 

Thank you again for your work.

Link to comment

Привет!

8 hours ago, Dimom76 said:

According to the guide  https://www.nexusmods.com/skyrim/mods/74427/? I used the plugin nvac.dll.  I would like to receive your comments regarding the use of this plugin.

It looks like CrashFixes but made for NV. It doesn't rly fits Skyrim because:

1) Exception addresses from NV highly likely will be different in Skyrim. 

2) We have CrashFixes already with handling of most known Skyrim specific crashes.

However, some addresses may correspond and some generic fixes could help as well (if they're exist). I cannot tell you more coz there's no src provided. In other words 95% of the plugin will not work for Skyrim, however 5% could be effective, but most likely there's no 5% and the plugin is redundant. I'll test it on my setup. 

 

8 hours ago, Dimom76 said:

I am also very interested in your opinion about  PrivateProfileRedirector

This thing already is very interesting. Most of ini options are loading while game launch and will be stored in process memory until you close the game without any additional dll's. But, according to author's research all params are going to be read from file for each installed esp, so it could be really slow with enough mods installed on slow file system. The plugin doesn't rly fix the issue but at least caching these params to be read from ram. Is a good optimization, but not for everybody, for example, I have NVME disk for Skyrim and have no issues with loadings, however it could help extremely well for those who has HDD or slow file handling. 

Thank you for mentioning the plugin, I'll include it in my guide with the next update. 

 

8 hours ago, Dimom76 said:

Your opinion on this (from here)

It's CPU affinity. This is quite long and complex topic to speak, I'll try to be short. Most of modern CPU's have technologies to handle two threads on one physical core (Intel Hyper Threading and AMD SMT). It works pretty well with multi-threaded applications and OS overall, but has its drawbacks: your single-core performance will be less. Skyrim is not a real multi-threaded application and its fps mostly depends on single-core performance. This way if you disable Intel HT or AMD SMT you get FPS boost in Skyrim but less system performance (note: FPS boost is possible only if CPU was the bottleneck in giving you FPS for your setup). To avoid disabling the technology completely you can do this only for one process on OS level with CPU affinity. Disabling every second (virtual) core like shown in the screenshot will do the trick. So, you'll get performance boost only if:
1) You have a CPU that supports Intel HT or AMD SMT and is enabled.

2) Your GPU renders a frame faster than CPU processes the frame. Otherwise, CPU will process faster and wait longer for GPU.

3) Your framerate is not stable/static. 

 

8 hours ago, Dimom76 said:

Concerning DEP… Do I need to add to exceptions ENBhost?

Yes, it also can go up to 4Gb. However, if there's no more space ENB will create another process. 

 

8 hours ago, Dimom76 said:

Is it safe to switch from Method 2 (OA) to Method 1 (SSME), or is it a new game?

I recommend to start a new game, but the game should adapt to changes after save cleanup. Personally, I was switching these modes without new game creation and saw no difference, but I remember Genio said some problems can occur. 

 

8 hours ago, Dimom76 said:

What is the limit of Method 1?

You setup your limit yourself with SKSE.ini, it's the DefaultHeapInitialAllocMB option, but the real value is: DefaultHeapInitialAllocMB - 256. I recommend to set 1280, so the maximum block size will be 1024. 1280 is the max value you can set for DefaultHeapInitialAllocMB. Comment from SKSE devs:

f8c7b1980d381368f06eb28e9f07.png

Personally I have never seen consumption for my skyrim more than 600mb. However, it's possible to patch up this value to allow set more if needed.

 

8 hours ago, Dimom76 said:

Today I decided to try this method for TESV, SKSE and ENBhost. It seems to me that work has become more stable, but I would like to move from “it seems” to a professional opinion.

Compatibility options change environment for a working program. If developers created their application in an environment that is completely different with yours then yes, it could give you some problems, but I didn't hear about any such problem for skyrim. This option mostly affects window handling and it could make some difference to game window and game loading, but overall there shouldn't be much changes. 

 

Good luck with stability!

Link to comment

Another question... do I need to move all plugins (DLLs) to the ...Skyrim\data\skse\plugins root folder when using MO2? I've heard it somewhere, but it's been a long time and I can't give the source.... Something related to user rights...

Link to comment
13 minutes ago, Dimom76 said:

Another question... do I need to move all plugins (DLLs) to the ...Skyrim\data\skse\plugins root folder when using MO2?

The correct folder for skse plugins (DLL's) is Data\SKSE\Plugins. I don't know about MO2 much as I'm installing everything myself by hand. It's better to ask in some MO2 specific topic

Link to comment

×
×
  • Create New...