Sunday, December 15, 2019

Debugging Lakeview Manor in Skyrim DLC

Ok, enough with getting lost with the tools.  My task is to actually debug some stuff. My primary objective is debugging some of the mess that I have encountered with the Hearthfire DLC.

Here is my tail of woe.

I purchased and built out my Heljarchen Hall house.  No problem.  Learned how to do it, had some fun, moved stuff around then wished I had built different wing options.

Then I picked up Winstad Manor and started working on that.  Critically, I was still building and adding furniture options, ran out of resources and went adventuring to get some more.

Then I picked up Lakeview Manor and started working on that.  Then the bugs started.  I could not get the door between the starter house and the main hall to appear at the Lakeview site.  None of the construction for the main hall foundations and wall would appear.  So I tried a bunch of stuff... then went back to Winstad for supplies and noticed that shit had gone wrong there.

Where Previously I had already completed the rooms in the main hall, it seemed to have reverted the 3D assets and I now had both walls with doors into the wings and walls without doors.  Almost like the walls I was trying to build at Lakeview had turned up at Winstad.... sound of penny dropping!

It seems to me that within the script to build the different buildings, there is a script that is assuming which location is being build, or a variable that is setting the location, is not being correctly updated when I fast travel between the two building sites.  And so, stuff that is being build is turning up on the wrong site and trashing my existing house rather than being added to the correct build site.

No problem thinks I... Just try to roll it back... however, it between figuring it all out, I had done a bunch of other stuff,  played about with my mod list, made a mess of my save files and generally lost track of where I was up to.  So trying to dig into the scripts of the BYOHhouse scripts seemed like a simpler solution... ROFL.  Or at least more interesting to the programmer in me... famous last words.

So, I have started poking around, learning where stuff is, how it works etc.  Hindsight suggests that what I am trying to do is fairly ambitious and potentially really really ignorant as it requires doing a lot of stuff backward... but such is the situation.

So here is what I have learned so far.

The assets for the house building are from the Hearthfires DLC.  The source for this DLC is included with the Creation Kit.  So download and install the Creation Kit from Steam... figure out where the source files are, unpack, navigate... start playing a guessing game based on a very random naming convention and very little in the way of comments.

Dig into TES5Edit and poke around in the Hearthfires esp.  See a whole bunch of the named objects but still get no clear idea of how all the bits interact.

Look around the internet and find that the main solution to this kind of tangle is to roll back to an earlier save and get on with your life.  Fair enough, as trying any other solution is probably futile for the average gamer.

So, in my playing, I have formed a rough idea of where all the bits lay. As with any game, we have three bits to potentially mess around with:

1) The static game files which, together with the engine will at runtime, create the dynamic game state.

2)  A running instance of the game with all the assets and such loaded.

3) A save file, which represents some subset of the dynamic state, from which a game instance can re-create enough of the dynamic state to keep the player amused.

While its interesting to get to understand how the bugs happened and the scripts involved, the only way to "fix" the issues without rolling back to a save where the issue does not exist, is to mess with dynamic state or the save file.

I spent some time playing around in the dynamic game tying to patch the bugs.  I tried resetting the quest for the lakeview manor build but could not get it to "reset" the building site in any way.  It may be possible but I figure that there is already substantial "stuff" at the building site that cannot be deleted by any of the build scripts.  So resetting the quests seemed to be a useless idea.  I tried using console commands to delete some of the assets, but could not figure out how to target them, or if it would be possible to reset the build quest in such a way as to "re-start" the build process.

The save file starts looking like a potentially better angle of attack.  Surely someone must have figured out how to unpack the save?

So there is documentation on the save file structure,  however, there is no way I want to try to to a low tech hack on a binary file of about 20MB size.

https://en.uesp.net/wiki/Tes5Mod:Save_File_Format
http://www.uesp.net/wiki/Tes5Mod:File_Format_Conventions

So, look for tools or roll my own.  Also a huge job.  There are a number of save file editors:

Random bits on Github
https://github.com/navinparray/tesv-skyrim-save-reader
https://github.com/OpenNingia/tesvsavedump

There are also short notes and clues around the web about how to use TES5Edit to manipulate save games. 
https://www.reddit.com/r/skyrimmods/comments/2w31vh/tesv_ess_editor_is_great_and_fixed_a_broken_save/

Tools on Nexus

Savegame Script Scalpel (Also called Papyrus Data Transfer or PDT)
Save Game Script Cleaner (Also called SaveTool) (Bit minimal but may be useful.  Does not work with Crash Fixes mod)
FallrimTools - Script cleaner and more  (Also called ReSaver)

FallrimTools seems to be the most up to date and is still supported. (Fallrim Docs

Youtube Resources

PDT resources on youtube (Savegame Script Scalpel)
https://www.nexusmods.com/skyrim/videos/428/?  (No audio so hard to guess whats going on)


FallrimTools/ReSaver resources on youtube
Modding Short Tutorials #3 Using Resaver fixes a glitched quest  (Virtually no useful information)
UPDATE VIDEO BLOG 5 - FALLRIM TOOLS  (how to install. No useage information)
Skyrim Special Edition Script Cleaner Tutorial ( Fallrim/ReSaver Basic usage tutorial but dated...)
Fallrim Check  (Current 2019 with some interesting hints...)
Skyrim How To Clean Your Saves Tutorial (Fairly current, more basic usage)

Save Game Script Cleaner resources on youtube
Skyrim Modding Tutorial - Save Cleaning  (Basic Usage)
Skyrim | Save Game Script Cleaner (SGSC) Tutorial  (Usage information once he gets through some blather)
Skyrim Mod of the Day - Episode 260: Save Game Script Cleaner ( Fairly comprehensive usage)
Skyrim Save Game Script Cleaner Review!  (2014  Basic Usage )


A possible solution is to use Save Game Script Cleaner to reset the whole of hearthfire.esm.  This will trash all my houses and all their content, adoptions, etc etc.  Pretty much a sledgehammer to kill a mosquito.





No comments:

Post a Comment