Monday, August 8 2016

Editing Fallout Shelter saves with OpenSSL and JQ

I’ve been playing Fallout Shelter for a while now, first on my phone (until my vault got big enough to crash the game constantly), then on an iPad Mini, and now also on Windows, where despite its tablet origin, it doesn’t support multi-touch on my Surface Pro. Fortunately, the keyboard controls are so nice that I don’t mind.

I made a few in-app purchases, because I like to pay what I think a “free” game is worth if I keep playing it. However, the items purchased are tied to a specific vault, so if you have 3 vaults and want to buy pets, you have to make three separate purchases; you can’t buy N pets and divide them between your vaults. Worse, if you delete the vault or the save file gets corrupted, you lose your purchases. For the final straw, the basic Lunchbox purchase is a total crapshoot, emphasis on the “crap”; you can spend real money and get nothing worthwhile. The only nice thing I can say is that the new Starter Packs appear to be guaranteed to have useful content, but if you buy an N-pack, they still all go to the same vault.

People quickly discovered how to read the file format and wrote a variety of tools to edit saves, but the most-recommended one runs under the Android emulator. I didn’t care about most of what the tools do, and I have an aversion to downloading anything that’s advertised as a cheat tool, because malware, so I poked around until I found the cleanest solution that used simple command-line tools. Specifically, OpenSSL and JQ.

After a little tinkering, I knocked together a simple (okay, it’s gotten rather elaborate…) bash script containing some common operations. Specifically, decrypt-and-pretty-print, convert to survival/normal mode, rename your vault, “buy” a bunch of lunchboxes and resources, and apply arbitrary JQ filter expressions from a file (for more complicated modding).

As for moving the files around, the PC version puts them in a quite sensible location. The iOS version is only accessible if you’ve enabled iCloud sharing, and then you have to go hunting in obscure sub-directories to copy a save from your iDevice, and to sync it back, the only way I’ve found is to copy it somewhere else, delete it from inside the game, copy it back (possibly increasing the last few digits of the filename), and then click the iCloud checkbox on the now-empty save slot (waiting a bit to give iCloud time to copy back and forth).

If I get motivated enough, I’ll sort through the Dweller data and make a tool to batch-rename them and sort out their relationship data (the game prevents direct incest, but after playing for a few months, I haven’t the slightest idea who bred with who). [update: turns out they don’t accurately track parentage. If a parent dies or is kicked out of the vault, the next person to arrive will inherit their id number, effectively adopting any children.]