Engineering Archivable Torchlight 2 Characters

[Update: It’s been less than 24 hours since this post, and Runic have release patch 1.16. The patch allows me to play VonMalefic again (joy). Looks like it was more the game choking on a legitimate game file, rather than the file corruption I was afraid of.]

I’m in a painful place since the weekend, where patch 1.14 of Torchlight 2 caused a night of game crashes with my main character. Patch 1.15 came down the wire the next morning and bam, I can no longer even load the character without the game crashing.

Seem that this is a known issue on the forums (and here too). The toon has a full set of Mondon armour and Twitch (a legendary greatsword) that I spent quite a bit of time trading bits for to eventually complete.

Here is the toon VonMalefic, in a Steam screenshot I took jJust after the last piece of Mondon kit was added:

VonMalefic in better days

VonMalefic in better days

Now, I’m not pleased about game save-file corruption at any time, but at the peak of my obsession with a new computer game, it’s doubly painful.  It’s a software issue, and what does any self-respecting programmer do when he runs into a software issue?  They get all Bob-the-Builder on the issue!

Now, Steam is a great environment for ensuring off-site backups, but if a file gets corrupted, now I have an off-site backup of a corrupt file.  What I need is an archive of toon history that I can roll back to a “known-good point” with.  What’s the difference between a backup and an archive?  Well you see…. ahh screw it, here’s something that does a better job of nailing the difference between backups and archives better than I care to in this post.

My threadbare archiving solution?  I set up a Subversion repository on the machine, and write a very basic Perl script to automatically copy save-file games into the repository and take a snapshot.  My heart belongs to Git nowadays for file repository management, but last I checked it was still crap at binary files, so it’s Subversion all the way.

And finally, that threadbare script (I’m emulating the game using Wine under Ubuntu, which is why the directories look a little odd to Windows users):

#!/usr/bin/local/perl

package ArchiveTL2Toons;

use strict;

$ArchiveTLToons::SaveFileDir = "/home/linds/.wine/drive_c/users/linds/My Documents/My Games/Runic Games/Torchlight 2/save";
$ArchiveTLToons::ArchiveDir = "/home/linds/TL2ToonArchive/WorkingCopy";

sub copySaveFilesToArchive() {
  `cp -r \"$ArchiveTLToons::SaveFileDir\" $ArchiveTLToons::ArchiveDir`;
}

sub getNowTimestamp() {
 my ($sec, $min, $hr, $day, $mon, $year) = localtime;
 return sprintf("%04d-%02d-%02d %02d:%02d\n", 
       1900 + $year, $mon + 1, $day, $hr, $min);
}

sub snapshotArchive() {
 my $timestamp = &getNowTimestamp();
 my $cmd = "svn ci $ArchiveTLToons::ArchiveDir -m \"Commit of changes @ $timestamp\""; 
  #print $cmd;
  `$cmd`;
}

sub archiveTL2toons() {
  &copySaveFilesToArchive();
  &snapshotArchive();
}

&archiveTL2toons();

The script currently only handles character file changes easily. Any time I add or delete characters, I currently need to manually tell Subversion about the additions and deletions. Still, right now it gets me a very basic archiving solution, allowing me to recover from save-file corruption in the future.

On a final note, I’m conflicted on what to do now. I’ve lodged a support ticket with Runic in the (remote) hope that the save-file is somehow salvageable. I’ve resigned myself to that path being unlikely, so I’ve re-rolled Von. The replacement toon (Dawnshammer) will be more thoroughly Min-Maxed than Von, who bares the scars of my n00bishness with the game.

Still, Von wasn’t too bad all things considered, and entirely fit for the end-game grind. I’d rather have Von back over re-investing all that development/trading time with Dawnshammer. Fingers crossed Runic deliver some magic on this one.

Advertisements

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