Back

Prince of Persia: The Sands of Time

Very early decompilation experiments with REA and Codex, learning how the original game was put together. Very, very WIP.

Notes

Prince of Persia: The Sands of Time was probably one of my favorite games toward the end of high school, and one of the few I actually finished. I love video games, but I don't play many of them. Following the wave of decompilation projects, like Ocarina of Time, made me want to revisit this one and understand how it was built.

This is very, very WIP. I'm exploring the original PC executable and its data with Codex and REA, Reverse Engineer Anything. REA gives the coding agent tools to inspect the binary, read decompiled functions and follow calls. The work is still a lot of tracing, checking and discovering what I misunderstood.

The Prince in the first level during the reconstruction experiments

The aim is to gradually reconstruct parts of the game in the browser from what we recover. For now, the interesting part is learning how they made it. Following a movement means working through animation data, collision checks and the conditions that let the Prince switch actions. A wall run looks effortless when you play; pulling apart the machinery behind it is another experience entirely.

What surprised me was finding assets named in French, like 0101_Entree_rempartgauche.gao. Today I'd expect almost every asset name and identifier in a big studio's codebase to be in English. These names suggest that, back in 2003, a team at Ubisoft could still have worked entirely in French. The names alone don't tell us whether that was the case, but it's a possibility I hadn't considered.

Modernizing it a little

Playing it again, some things have aged badly, so I tried to bring the game up to date without touching what makes it work.

The first was Farah's outfit. The Prince is covered from neck to boots, while she climbs, fights and shoots her bow through the palace in a cropped top and a slit skirt. So I dressed her for what she actually does: a long tunic over trousers, wrapped boots and leather bracers. Her face and hair are untouched, and the new clothes follow the original skeleton, so all her animations still work.

Farah's original outfit on the left, the reworked one on the right

Then came the Prince's lines. The game has no subtitles, so I first transcribed all of its voice clips to read the script. Most of it holds up, but a few of the Prince's lines are very early 2000s: monologues about showing women who's in charge and taming Farah's insolence, and a fair amount of teenage ogling. His vanity is part of his arc, since the story spends its time humbling him, so I kept it and pointed it at himself instead. The rewritten lines were then recreated with voice cloning, so they still sound like the original cast. The version you can play in the browser includes both changes.

Still early, still incomplete. I'll add notes as I understand more.