Tuesday, May 31, 2011

On My Mind: Journey through Debug land

This post is one that hits very close, and it won't seem that interesting or relevant, but it's a fun story, at least I think it is. At the very least, you get a peek into how I do debug (or basically how designers and testers would do debugging for a game).

One of the new things I get to do with my new state of employed-ness is to actually finish games. It's not really a "plus", but I'll take whatever I can get. My next victim, Prince of Persia: The Forgotten Sands. Well, it was, until a game breaking glitch early in the game has rendered the game unplayable on my profile now. So, where do I start.

The issue point:

At a fairly early part of the game (within first hour of play), you unlock the rewind magic. Right after, as you walk, you will fall, and trigger an in-game cutscene, where you are taught how to use rewind.

What happened:
When rewind happened, the game and system became unresponsive, for over half a minute, you can still hear sound, and pressing the XBox guide brought up the sound too. Then it got weird. I then suddenly unlocked "Ding! Level Up!" (For purchasing an item), followed by "Not how it Happened" (use rewind 20 times). Well, this was interesting. The game, by this point, has locked up, and wasn't going anywhere, so time for me to restart.

The next time (and every time since then if I get this far), the game resumes with the previous checkpoint, plays cutscenes, and either a) locks up right away or b) insta-kill me as if the rewind didn't count.
This is what it looks like when it locks up (99%) of the time, it's right after he finishes talking and the game is about to resume.

The Test Cases:

So, at this point, the possible causes are:
a) Hardware/System issues
b) Disk
c) Save Data
d) Game Bug

So, to test the easy things first, I did the following:

1) Test the game on a different 360 (nope)
2) Test the game without using HDD install data (nope)
3) Test the game with my profile and save data in different locations (HDD, USB, MU) (nope)
4) Test the game with bout title update and no-update (nope)
5) Recovered my gamertag from MS.

This pretty much ruled out Hardware issues (and the fact that it still play other games kinda proves it)

Next worry is the disk being scratched/damaged. However, since I have no way of getting a second disk, I had to assume it's not the disk, and try something else to get to that part. The idea is, if a different save data gets me past there, then it's not a disk issue right?

Since I didn't want to delete my current save, I got a new profile, and a new save data, and ran the game. Played for almost an hour and got to the offending point, and...

...it got past it.

Well, this removes the whole disk damaged theory. So, let's delete my save game on my profile, and start over (it's only an hour, right).


In starting a new game using my profile and no saved game, the game crashed at the first loading screen.

Well, this is bad.

Interestingly, my intuition suggested to try a cleaver trick: Load a new profile and start a new game; while the game is running, sign in to my own profile, and see if it works. (Why I did this? Pure intuition. Signing in/out seems to be one of those edge cases that programmers should test for, right?)...

... and it did work. And I managed to start a new game on my own profile, only to be halted back at the same point again. One interesting thing to note, at this point, was that I was still earning new "cumulative achievements", such as break 100 pots. This tipped me off to something...

I started looking around for things that are saved other than game progress, and guess what, it seems that options aren't tied to saves either. I had disabled tutorial one time, removed the save data, and started again, tutorial stayed disabled. Most troubling find, was this screen and how I stumbled upon it:

This screen was accessed at the start of new game with no save data on my profile, it's the upgrade menu. This menu (confirmed by Ivan, a friend) isn't accessible via back button at the start of the game. So a) why can I access this, and b) why is it filled with stuff? Testing with my new profile and new save, this screen becomes unlocked after where my old game has crashed, and is an empty grid.

And this is where my search ends, and most likely me playing this game.

The Theory

In my mind, given all the facts and what I know about how the save system works, I have a few ideas of what the issue is.

1) The "unearned achievements" is a simple one to explain: when the game was unresponsive, it was incrementing something internal, and blew up some data storage/variables as it was looping. This would explain how I got "Not how it happened (rewind 20 times" even though I've done 1 rewind.

2) If that was being incremented, and as the magic screen as indicated along with the achievement, who knows what other values that were stored blew up. (Since these save data is suppose to be small, it's entirely possible that the game wasn't careful and saved it as a NaN, a large negative number, or other corrupted data.

3) Deleting the save file and starting new causing the game to lock up at the start screen, combined with loading the game with that magic screen, points to three things:

a) The game is saving achievements and other data within the profile, and is retrieving them for use. (This can be verified with other games, some games don't even have a save data, and it's saved within the profile) It's the only explaination for how the magic window is still open.
b) When game does a check at the start of the new game and , it checks for this data in the profile (since my profile already has some of the potentially bad data saved in, it fails a check, crashes)
c) My fun cleaver trick to bypass it and starting a new game on my profile? Someone was lazy, and didn't check for profile data if I sign in in-between the game. I think this would have been a pretty major bug.

How would this be fixed? Well, at this point, I don't know if Ubisoft would be willing to issue a patch for a game this old, the patch would be pretty simple: it's entirely around the whole magic system being unlocked, and when unlocking it, set to 0. All the issues seems to point to values not be checked for out of bounds cases.

The other, probably easier one, is letting me removed PoP from my profile (and in theory, remove all internal data stored with that game in the profile), which would let me start anew and hope not to run into the same bug.

The Fixes:
Throughout today I've been in contact with XBox Support on twitter and Ubisoft Technical Support. The XBox team was pretty helpful, and actually went through pretty much all the test cases I went for. In the end, they've said to contact the publisher's side as it seems to be a game thing. I've asked whether it's possible to delete game titles off the profile (which they did allow a few years ago with 0 achievement games), but they've stopped short of suggesting that.

Ubisoft's side, as of this writing, was less than hopeful. I had written a brief summary of the issue (noting the crash, where it happened, etc.), and their generic reply was that it was a gameplay issues, and I should look up a guide to get past that section of the game.

I guess this means it's the end of my Prince of Persia Playthrough.

No comments:

Post a Comment