Monday, June 3, 2013

How to make your Kongregate Flash savegames portable

Okay, I often see people complaining about how their Kongregate savegames aren't portable to a different PC. Yes, it's annoying. It's also easy to fix; I offer below a series of steps (with some minor technical illumination) to ameliorate this problem in certain circumstances.

Some caveats before we start.

  • In theory this should work on Windows OSes as old as Windows Vista. I have only done it on Windows 7. The mklink command was introduced in Vista (anything older than that will require a different solution) so it should be viable. YMMV.
  • Corollary to the above, this only works on Windows systems. The general theory should apply to Macs but you're on your own to figure out the specifics.
  • This only works with Flash games. I haven't bothered to analyze Unity saves yet, they may or may not be amenable to this general method. Certainly they'll be in different directories.
  • If you don't understand anything I'll make reasonable efforts to respond in comments. I will not teach you how to use Windows.
  • There may be Flash games that store their .SOL files in a different directory than those below. You're on your own to isolate those directories but once you do you can use the same steps below to synchronize those as well.
  • If you break something you're on your own. I offer no guarantees or warranties. Do not attempt this if you don't FULLY understand each step.
I think that covers it. Lets proceed.

First the executive summary. What we're going to do is move all the .SOL files (the files that Flash uses to store data locally) into a Dropbox folder. Next we'll create a link that directs Windows to look in the new location for these files. Then we'll link another computer into the Dropbox .SOL storage. Finally we'll discuss the browser based differences (yes, in 2013) and gloss over the extra credit option of syncing Google Chrome (if you get this far it'll be easy).

Pre-Reqs
So obviously first you'll need to install Dropbox if you don't already have it. It's incredibly straighforward just make note of what directory your Dropbox is in.

Step 1 - Find your SOuL
There are a couple of ways to find your SOL files. In the interest of making this easy I'm just going to tell you. 
--Option 1
Your SOL files (assuming you're on Windows 7 and not using Chrome) are in
C:\Users\[username]\AppData\Roaming\Macromedia\Flash Player\#SharedObjects\[random]

! Yes, there. In Chrome it's even uglier. Moving along. [username] is the username you logged in with. [random] is just a random string of characters. There should only be one [random] folder. That's your .SOL root dir.

If you're not on Windows 7, there's more than 1 [random] folder, you don't know your username, or for some other reason can't reach that location then you'll have to take option 2. If you're on Chrome then look at the extra credit below to find your .SOL root dir.

--Option 2
Oh, a hard case eh? Just open a Flash game and save it (most save automatically after you play for a bit). Now open Windows' file search function and search for files named '*.sol' that have been edited today. That'll show you the rabbit hole your save is in. Now walk back up the directory tree until you get to the [random] directory. That's your .SOL root dir.

Step 2 - Create a SOL Storage Directory
Now open your DropBox folder. I'm going to describe the way I build the directory structure but you're welcome to do it your own way. You're the one that gets to troubleshoot it not me.

Create a directory called 'Sync Directory'. This is where you're going to copy the Kong folders. I use this same directory to sync the save files for several games, among other purposes. I also keep a handy text file in here describing what each is for and the local directory it's supposed to link to. You know, for documentation. Because I keep several sync functions in here I create a 'Flash SO Object' directory and put the Kong files under that to keep things tidy.

Step 3 - Move the SOLs
Now with the Sync Directory open go back to your .SOL root dir from Step 1 and find the 'chat.kongregate.com' and the 'assets.kongregate.com' directories. For reasons unknown to me (and probably unimportant to this document) Kong's Flash games store data in both these directories. So move (not copy, MOVE) them both to the Sync Directory or whatever subdirectory you want to use.

Step 4 - The Magic of mklink
If you copied the folders in the last step then this step will fail and I don't want to hear about it. Moving right along.

Now we're going to need to go to the command line. If you can't find it google it.
Once you're on the command line you'll want to enter something like this
mklink /j "[full path of .sol root dir]\assets.kongregate.com" "[full path to sync directory]\assets.kongregate.com"

In order to get the full paths your best bet is to open the relevant directories and copy the path from the location bar at the top. Then you can right click in the command line window and paste it in (CTRL-V doesn't work; GJ M$ :/ )

Rinse and repeat for the 'chat.kongregate.com' directory...
mklink /j "[full path of .sol root dir]\chat.kongregate.com" "[full path to sync directory]\chat.kongregate.com"

Now before you move to the next step... open your browser and go to Kong to verify that Flash still reaches the SOL files. If it doesn't... ~~>PANIC FORMAT<~~  j/k. If not then go back over the steps mentally and make sure you didn't miss something. This stage is critical; make sure you can open the SOL files before proceeding or you'll waste your time.

If you can't figure out the problem you can post a comment and I'll try to help.

Step 5 - Reciprocation
Now you've got your SOLs in a different directory from the vanilla install (you savvy techie you) and your browser is ignorant of the extra layer of indirection. Yay! This is mostly useless mental masturbation. Let's get the important part done.

Go to some other computer and find its Flash .SOL root dir (refer to step 1 for assistance if you've forgotten already). Now find the chat and assets directories for Kongregate and either delete them or move them to a safe place. But I hear you asking Why save them? Simple. If these files are different and contain, for example, valued saves for the same game, then you'll have to figure out how to mesh them into the sync folder. For that you're on your own; it'll be different for each game and I can't be bothered to research it. If there aren't any saves you care about then by all means delete these folders.

Now re-refer to step 4 and create links for these directories the same way you did on the first PC. Voila! Once Dropbox is all up to date (you did think to install it on the second PC right? right!?) open your browser and verify it's opening the SOL files as expected. And you're done. You can repeat this step for any additional PCs you want to connect to the sync folder.

!Additional Caveat!
Do not play the same game on multiple PCs simultaneously. You'll cause conflicted versions, eat up HDD space like candy, and possibly corrupt the SOL file. If you try this I don't want to hear about it.

Extra Credit - Oh So You Like It Shiny Do You
Chrome thinks it's special, bless its shiny heart. In case you didn't know, Chrome doesn't use the version of Flash you installed for IE, or Firefox, or Opera, or whatever random browser Mosaic you happen to use. Chrome uses its own internal Flash engine (assuming a vanilla install, you can make it use the other one but typically there's no reason). As such it saves its SOLs in a different place. Specifically on Windows 7:
C:\Users\[username]\AppData\Local\Google\Chrome\User Data\Default\Pepper Data\Shockwave Flash\WritableRoot\#SharedObjects\[random]

!!! Yes. It's even uglier. Sometimes the OS will barf on a directory path that long (depends on how legacy it's feeling at the moment). GJ Google. Anyway. This is basically the same as in step 1 just with a different path. The [] segments are the same as described above. You can take that path once you identify it and replace it for any .SOL root dir referenced above. Indeed, you can make the Kong folders in it link to a Dropbox sync dir and do the same with the other Flash .SOL root dir and have all your browsers magically reference the same files. On all PCs. Nirvana. Or some reasonable facsimile thereof. :>

Extra Extra Credit - Or, wtf are you still doing here?
What, that wasn't enough for you?!? Ingrate. Fine, a little protip at the end for you skiddies with nothing better to do. You may not be aware of it but Dropbox saves old versions. Basically, you can use it as version control-lite software for any file you want, including the SOL files. It only saves back to a certain age, or maybe a certain number of changes. I've never cared enough about this aspect to explore it fully. But if you make a fatal mistake in a game or corrupt the file you can retrieve an older copy from the Dropbox website. Additionally Flash itself has been known to prune its SOL files by age; Dropbox can be used to prevent this.

I'll leave the full understanding of the extra-extra-credit items as an exercise for you because, to be honest, I've not needed to explore it and so don't really know the full details.

Enjoy!