Skip to content

Instantly share code, notes, and snippets.

@LockeBirdsey
Last active August 6, 2022 13:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LockeBirdsey/706a09ca46a35bec7c8e721f9bdd708d to your computer and use it in GitHub Desktop.
Save LockeBirdsey/706a09ca46a35bec7c8e721f9bdd708d to your computer and use it in GitHub Desktop.
Pathfinder: Kingmaker has this realllllllllllllllllly annoying save system (it just dumps Unity components from a scene into a Json and each zone has persistence so these Jsons stay large forever). This is a little (and very hastily put together) bash script to find which zones are creating the most trouble
# NEEDS jq installed
# sorry for how lazy this is
# run this inside an uncompressed save file directory (you know, the one with dozens of json files and png fog of war masks)
# this will help you find which are the zones causing the most save lag
# run this, install UMM + Cleaner (and NoHistory to be extra clean) mods and travel to largest zones and run the "Clean" option provided
# by the Cleaner mod
echo > zones.txt; for f in *.json; do s=`stat -c "%s %n" "$f"`; j=`jq '.m_MainState.SceneName' "$f"`; echo $s $j >> zones.txt; done; sort -n --reverse zones.txt > zones_sorted.txt;
# output is:
# sizeinbytes filename zonename
# zonename can be null, in which case ignore it
# if a zonename has 'outdoors' in it, that either means its an actual zone or an overworld e.g. `BrevoyBorderlandsOutdoorBase_Mechanics`
# I've knocked a few seconds off each save and dropped the compressed size down from 28MB to 22MB.
# I hope when I get around to PF:WotR the save system will either be better or Cleaner will be working nicely for it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment