Sync saved games with DropBox

Posted: July 27, 2011 by jellymann in computers, gaming, tech, windows

If you use Steam you probably know that some games sync your saved games to the Steam cloud (e.g. Half-Life), so owning multiple gaming-capable computers doesn’t become a chore. However, not all games currently support the Steam cloud (e.g. Terraria). For those games you can use DropBox to sync your saved games across multiple computers and, due to its cross-platform nature, multiple operating systems (e.g. if your game runs on a Mac, too).

For this how-to I am going to use Terraria on Windows as an example, but it can be easily translated to other games and operating systems as well.

Firstly, locate the necessary folders. Your DropBox folder is wherever you put it, probably in Documents. Your game’s save folder is wherever they put it. Terraria’s saved games are in My Documents\My Games\Terraria, or more specifically:
Windows Vista/7: C:\Users\Username\Documents\My Games\Terraria
Windows XP: C:\Documents and Settings\Username\My Documents\My Games\Terraria

Secondly, copy whatever saved files you want into a folder in your DropBox folder. For Terraria I just copied my Players folder, config file and my primary world into a folder called …DropBox\savegames\Terraria. Some people working off very slow connections or strict data caps might want to leave the worlds, as they can get relatively big. After copying the files and/or folders, make note of where their originals are and what they’re called (exactly), for example World 1 is called world1.wld and is in …\Terraria\Worlds. Next, delete the original files that have been copied to your DropBox.

Thirdly, create symbolic links (symlinks). A symlink is like a shortcut to a file or folder but looks like an actual file or folder to the operating system instead of a shortcut file. Thus if we create symlinks in the Terraria save folder that point to the copies in DropBox, Terraria won’t notice the difference. To create a symlink to a file, use the command mklink in a command prompt. To create a symlink to a folder, use mklink with the /D flag set. For example, if I copied config.dat from Terraria to DropBox, I’d create the symlink with the following command:
mklink "C:\Users\Username\Documents\My Games\Terraria\config.dat" "C:\Users\Username\Documents\DropBox\savegames\Terraria\config.dat"
And I’d create the symlink to the Players folder with the following:
mklink /D "C:\Users\Username\Documents\My Games\Terraria\Players" "C:\Users\Username\Documents\DropBox\savegames\Terraria\Players"
Just replace Username with your Windows user name, and change the drive letter and/or DropBox location where necessary. Once the symlinks are created you can begin playing and your savegames should be synced to their new folders.
Note: If you’re not concerned with data usage, you can move the entire Terraria folder into DropBox and just do one directory symlink, e.g.:
mklink /D "C:\Users\Username\Documents\My Games\Terraria" "C:\Users\Username\Documents\DropBox\savegames\Terraria"

If you get stuck with making symlinks, the command mklink /? might help.

Useful tip

Create environment variables for your DropBox and the game’s save location:
set DROPBOX="C:\Users\Username\Documents\DropBox"
set TERRARIA="C:\Users\Username\Documents\My Games\Terraria"

You can then use these variables in your mklink commands like this:
mklink /D "%DROPBOX%\savegames\Terraria\Players" "%TERRARIA%\Players"

Other OS

In Linux (and possibly the same in Mac OS) the ln command creates symlinks. However, there are a few differences from mklink:
link and target are swapped, the -s flag must always be set if you want to make a symbolic link, and there’s no need for the -d flag to be set for directories, as this only applies to hard links.
If you get stuck, read the man page! (man ln)

Advertisements
Comments
  1. Ellie says:

    Hi there,

    Okay so I followed your instructions, and deleted the original files and whatever back up files I had (I placed those in my jumpdrive). I opened the command prompt, typed in everything just as you did but I get a message saying “Cannot create a file when that file already exists.”

    I’ve deleted every back up copy I had made, so I’m not sure what the problem is or how to fix it. Help, please?

    • jellymann says:

      Try swapping the target and link paths in the mklink command. Double check which one goes first by typing ‘mklink /?’.

      • BarryBostwick says:

        Great tutorial! Thanks! And Ellie is correct. The order of the command is incorrect. It needs to be reversed. Ex:

        mklink /D “C:\Users\Username\Documents\My Games\Terraria” “C:\Users\Username\Documents\DropBox\savegames\Terraria”

      • jellymann says:

        Thanks, I have fixed it.

  2. We says:

    Hi, I loved your two tutorials on coding java games using Slick. Is there any chance of you going back and continuing the series?

  3. SeD says:

    Thank you very much for this howto! I didn’t even know that there are symlinks in Windows. I thought they are only in Linux.

  4. Sam Rumbelow says:

    Thanks for this. Your “useful tip” is still the wrong way around? Updated it a little and put it into a batch file using notepad that I can edit and run as administrator: “symlink.bat”
    ======================
    @echo “remember to delete the save game folder after copying files to the dropbox folder”
    set DROPBOX=”C:\Users\Sam\Dropbox\Savegames\Xcom”
    set GAME=”C:\Program Files (x86)\Steam\steamapps\common\XCom Apocalypse\XCOMA\SAVEGAME”
    mklink /D %GAME% %DROPBOX%
    @pause
    =======================

  5. Drowhunter says:

    For those of you who dont want to F-around with command line to create symlinks
    i suggest you download and install Link Shell Extension (http://schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.html) for windows

    it allows you to create symlinks using the right click on your mouse or using drag and drop

  6. voji says:

    If you doesn’t want to create symlinks, try SyncToCloud (http://www.synctocloud.net/) to backup saved games to cloud. It’s platform independent, and can sync saved games (based on custom rules) to your Dropbox folder.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s