Back to Projects

PC modding for Pitfall : The Lost Expedition™

Pitfall : The Lost Expedition is a platformer game released in 2004, where the player incarnates Pitfall Harry, the daring adventurer who must rescue the survivors of a plane crash, all while fulfiling an ancient prophecy to save the lost city of El Dorado.
This game, almost as old as I am, has been a great part of my childhood. I remember calling my dad for help in the spirit temples, because I hated them so much... When this game released, it had been shadowed by other big titles releasing around the same time. And so, it isn't very notorious.
At some point, I found a community Discord server oriented towards speedrunning, but welcoming anyone with an interest in the game, either speedrunners, retro gamers, or for the nostalgia like me.

First modding steps

The only mod available at the time was an entrance randomizer for the GameCube version. The many areas in the game were shuffled into a brand new map, and the players had to complete several objectives (and complete the game) all while remembering what area led to where. It was really fun, although limited. The only kind of modding we could do was through changing memory values in real time. No code injection, no custom enemies, and our technical knowledge regarding the game's code was very limited.

Initially, the game released for consoles, but was eventually ported to PC. This meant that we had a version of the game, which ran natively on our Windows systems, for which we knew how to write programs. With the help of dynamic libraries and a mod loader, maybe this would make injecting custom code extremely easy, much easier than on GameCube. And maybe, with more knowledge of the game's code, an entire modding ecosystem would birth right out of our community effort.

Understanding the PC version

Luckily for us, the game's code contains a mountain of human-readable text, which helped us identify sections of code extremely quickly. Most importantly, all of the type names were still left in the game's code. Using these names, we were able to identify all active instances of a certain type within a level. For example, we could retrieve Harry, treasure idols, projectiles, cutscenes triggers, particle effects, enemies, and so on.
Knowledge of the code allowed us to safely inject custom pieces of code in almost any location, and knowledge of memory enabled observing and modifying object properties at will. Unlocking one of Harry's abilities had just become as simple as "harry.skillUnlocked = true", and we weren't going to stop there.
So, a new reverse-engineering effort was on. I threw the game at Ghidra, looked up known code locations from Cheat Engine experimentations, and progressively gained an understanding of various functions. Slowly but surely, we were mapping the game's code.

Messing arou— uh, I mean... experimenting

All of our newfound knowledge of the game was very quickly transcripted into a fresh C++ project, and we were very eager to start swapping 3D models around, making natives 10x faster and spawning TNT rains. And that's exactly what we did.

Oh and, why not play as enemies or NPCs?
Just for the record, every character has unique rigging. This means that I had to map Harry's bone IDs to each character's just for them to animate properly.

A full modding toolkit

The very first PC mod was called "Windowed Mode". Why did I make it? Well, this game is very old. And at its time, not everyone had a beefy personal computer. To make sure the game could harness the full potential of its machine, it ran systematically in fullscreen, responded to keyboard presses even when not focused, and as a bonus, it would lock the taskbar. On a modern, multitasking system where we switch programs a lot, record gameplay, and do other stuff beside the game, playing this version was just unbearable. Before PC got modded, GameCube ruled and remained the preferred way of playing and speedrunning Pitfall.

Eventually, I started rewriting the entrance randomizer, initially for GameCube, into a PC mod. With code injection, it was also comically simple to add polish to the mod. Now, the "New Game" option shows "Play Rando" instead. Moreover, the cards that pop up when approaching a level transition now show the randomized area's name instead of the original. That way, players can just visit every exit without actually going in to know their options. This is especially useful, since sequence breaking this game leads to softlocks in the majority of cases.

Gallery

Click an image to enlarge.

Index