How a small group of GTA fanatics reverse-engineered GTA 3 and Vice City without (so far) getting shut down
Grand Theft Auto 3 and Vice City are both now fully reverse-engineered – a passion project from a small group of fans years in the making.
It means fan-created source code for both games is now available on GitHub. The code can be used by anyone to play both games on PC – with the hope others will take it and improve upon it further.
Re3 (reverse-engineered GTA 3) and reVC (reverse-engineered Vice City) offer a raft of eye-catching improvements over the original games that are available to play officially today on PC. The video below showcases the work and the changes made possible.
Bugs have been fixed, a debug menu and camera are available, there’s instant compatibility with current controllers, no loading screens between islands, and widescreen support with a properly scaled HUD, menu and field of view, among other improvements. There are even improved effects from the PS2 versions. Re3 also includes a map of Liberty City in the pause menu – something missing from all original versions of GTA 3.
It’s an exciting development for the video game reverse-engineering subculture that has so far avoided retribution from Rockstar and its parent company Take-Two.
“Open source GTA has probably been a dream for many of us GTA fanatics,” project leader “aap” tells Eurogamer.
“We’d been injecting our code into the games for many years for modding but of course that’s sort of tedious and you’re still limited in what you can do.”
Over the years there have been multiple attempts at recreating GTA 3, the 2001 action-adventure game developed by DMA Design and published by Rockstar Games.
One such attempt, dubbed Open ReWrite, or OpenRW, saw some active development but now appears dormant. There have also been projects that recreated Grand Theft Auto 3 in engines such as Unity and Unreal. aap, though, was more interested in reverse-engineering the original code into source code. At some point in 2016, aap began to reverse engineer the GTA 3 code on a casual basis, getting to the point where the player could fly around the map.
aap then focused on reverse-engineering collision and physics code, injecting this into the actual game for testing. This is how the re3 project began. aap replaced the functions of the original game until everything was replaced by the spring of 2018.
“I had no idea if this project would ever be finished,” aap explained. “I was still working on it alone at the time, but it seemed like the most promising route to an open source GTA.”
The skill, time and energy required to reverse-engineer a video game should not be underestimated. This is not an easy thing for professionals to do – let alone enthusiasts. There’s a huge amount of code to work through, and mistakes are inevitable, especially if they don’t result in any obvious wrong behaviour in the game. There are almost certainly still bugs in the re3 code that aren’t original, aap admits.
Still, it’s a remarkable achievement. Here’s how aap and co managed it, in layman’s terms:
“GTA 3 and Vice City were originally written in C++,” aap explains. “The compiled executables that are shipped are in machine code. So the general task is to go from machine code back to C++.
“Machine code can be (more or less) mapped 1:1 to a human readable form called assembly language, but it’s still very tedious to read.
“To go back to C++ is by no means a simple 1:1 mapping, but over the last 10 or so years decompilers have appeared that help with this process.
“So what we typically do is work with the output of the decompiler and massage it back into readable C++. This is sometimes quite easy and sometimes hard, but in any case it’s a lot of code and you’re bound to make mistakes.”
Thankfully, the code for GTA 3 on PS2 and Android includes debug symbols. Debug symbols contain all the extra information needed to debug a game during the development process, but are often stripped out for release executables to avoid bloat. For whatever reason, Rockstar left these symbols in, giving the reverse-engineering team a huge leg-up.
“We were very lucky we had symbols for the games,” aap says. “PS2 [GTA] 3 and all the Android releases have names for the global stuff (functions and global variables). This was a huge help and I don’t think we’d be anywhere near reversed GTA without them.”
The video, below, shows aap analysing the code for the rubbish that’s lying around on GTA 3’s virtual streets. It’s a dense watch.
aap stopped working on re3 for a year, then picked it up again in the spring of 2019, and in May 2019 pushed the work to GitHub. Approximately 15,000 lines of code were reversed at the time.
Others took notice and joined the effort. After work stalled in the second half of 2019, the project was picked up again in early 2020 as the hackers found they had more time on their hands due to the coronavirus pandemic. In April 2020 the re3 team had its first standalone executable. The core team was just six people.
Why choose GTA 3 in the first place? “It was the first game of that era, the smallest (so less code to reverse), and generally liked by everyone on the team,” aap explains. After GTA 3, Vice City was the logical next step. It’s similar to GTA 3, after all, and much liked. reVC was started in early May 2020, and the team called it done in December 2020.
Looking to the future, aap says he’d like to see the games’ physics fixed at high framerates, and, once that’s taken care of, a virtual reality mod “would be cool”. Another project could see Renderhook, which brings ray-tracing to GTA, ported to re3. “We’ll see…,” aap says.
Already we’ve seen some interesting work-in-progress ports spring from re3, including Wii U, Nintendo Switch and PlayStation Vita versions. The video below, from YouTuber Modern Vintage Gamer, showcases the WIP Nintendo Switch port of re3:
“The Wii U port was certainly a surprise,” aap says. “I think an Android port will have to be done sooner or later, but nobody from the team has any experience with android so it would probably have to be a third-party again.
“PS2 is something I absolutely want because it’s the original platform for GTA, but I don’t see anybody but me doing this (at least I do have a PS2 devkit). PS3 is also something I’d like to see or even do myself, but I don’t have the time (at least I, again, do have a devkit).”
It’s busy times in the GTA reverse-engineering community. Some of the PS Vita hackers who worked on re3 and reVC managed to get the Android version of 2004’s Grand Theft Auto: San Andreas running on Sony’s handheld (it’s here on GitHub). This isn’t reverse-engineered source code, but the inspiration, aap says, came directly from being able to play GTA 3 and Vice City on the Vita. Other Android games are being ported to the Vita as we speak.
It’s natural to wonder why Take-Two and Rockstar haven’t at least had a word with aap about his projects. re3 requires PC game assets to work, so you must own a copy of GTA 3. And aap stresses on GitHub that the code should only be used for educational, documentation and modding purposes. “We do not encourage piracy or commercial use,” aap says.
But Take-Two and Rockstar have a reputation for taking a hard-line with fan remakes and others who tinker with their code. Was the team worried about an intervention?
“Yes, we were very much worried about that and tried to stay under the radar for as long as possible,” aap says.
“We got a lot of attention when the Switch port happened but nothing from Take-Two. We took that as a sign that they don’t care (or are really blind).”
aap and co consider the fact the Super Mario 64 reverse-engineering project is still on GitHub as a good sign “because Nintendo is about as aggressive as Take-Two in these matters”. So far, so good then. But for how long?
aap isn’t waiting to find out. Up next is reLCS, a reverse-engineering project for 2005 PlayStation Portable game Liberty City Stories. Work on this began in January 2021, and, once finished, it’ll be the first time that game has had a proper PC port.
And then? Grand Theft Auto: Vice City Stories, which aap describes as “probably the holy grail of GTA reversing right now”. VCS added features to LCS, but never saw an Android port. Because of this, there are no symbols for it in its code. Reverse engineering the 2006 PSP game is a huge challenge.
“We’ll see what we can do about it when the time comes,” aap says.
Source : Eurogamer