If you’re a fan of DOS games from the 1990s, you’ve almost certainly used DOSBox to replay them on a modern computer. It allows you to run software in a virtual environment that replicates an era-appropriate computer. That’s great for historical accuracy, but doesn’t do you much good if you’re trying to leverage modern computing power to breathe some new life into those classic titles. For that, you need to dig in a little deeper.
For the last two and a half years, [Nikolai Wuttke] has been doing exactly that for 1993’s Duke Nukem II. The end result is RigelEngine, an open source drop-in replacement for the original game binary that not only runs on a modern Windows, Linux, or Mac OS machine, but manages to improve on the original in a number of ways. An accomplishment made even more impressive once you learn that the original source code for the game has been lost to time, and that he had to do everything blind.
In a blog post chronicling his progress so far, [Nikolai] explains the arduous process he used to make sure his re-implementation was as accurate as possible to the original game. He spent untold hours studying the original game’s disassembled code in Ida Pro, handwriting out pages of notes and pseudocode as he tried to understand what was happening behind the scenes. Once a particular enemy or element of the game was implemented in RigelEngine, he’d record the gameplay from his version and compare it to the original frame by frame so he could fine tune the experience.
So what’s the end result of more than two years of work and over 25K lines of code? Thanks to the incredible advancements in computing power since the game’s release nearly 30 years ago, [Nikolai] has managed to remove the need for loading screens. His engine is also capable of displaying an unlimited number of particle effects on the screen at once, and multiple sound effects can now be played simultaneously. In the future he’s looking to implement smooth character movement (in the original game, movement was in 8 pixel increments) and adaptive volume for sound effects based on their distance from Duke. Ultimately, RigelEngine should be able to replace the original graphics with new high resolution textures once some issues with the rendering buffer gets sorted out.
It’s hard to overstate how important some of these classic games are to those who grew up playing them. With John Romero still releasing DLC for the original DOOM and hackers disassembling nearly 40 year old games to fix bugs, it doesn’t seem like they’re in any danger of being forgotten.
15 thoughts on “Hail To The King, Baby: Reverse Engineering Duke”
Are you sure there’s an editor, or is that the position hackaday is hiring for?
“but manages improves on the original”
“made even more impressive once learn that the original”
And what does the grammatical error take away from the article? Hackaday isn’t Encyclopedia Brittanica…
It’s not Encyclopaedia Britannica either!
+1 We’d hereby like to offer you a position here at Hackaday.com, as Editor-in-Chief. Please contact Brian Benchoff so you can interview him as a potential employee, and to sign your contract if they pass the employer interview.
This is amazing. I played Duke 1 and 2 endlessly until I figured out how to get Duke3D to run. I know which ones my kids get to play.
The one with the pixelated strippers?
He used IDA with sadly is really expensive. I would love to see such an exploit(?) with FOSS-tools like radare2. It looks really weird but i am really a reverse engineering beginner.
Try Reko Decompiler
Looks interesting but… it’s mono-bloatware. Urgh. Maybe inside a VM…
In the blog post, he says he used the free version.
Oh yes, there is a free version, i forgot. But it’s only for x86 iirc, no ARM and such. And Windows-only i think.
You don’t need IDA Pro. It provides tools which can speed up understanding, but it’s not like the decompiler is a one click solution – you still need to read the raw disassembly to understand exactly what is happening. And the free version of IDA doesn’t have that anyway.
But if you really need a decompiler, Ghidra’s got one that is excellent, and it’s only going to get better now that it’s been released.
It’s not a one click solution but it probably makes live a lot easier.
Talking about Ghidra, it might be excellent but sorry, i just don’t trust the NSA, even for open source…
See also Ghidra.
I’d like to see something that can convert 6502 disassembly to C or VB.
1800- A2 FF LDX #$FF
1802- 9A TXS
1803- 20 9A 18 JSR $189A
Please be kind and respectful to help make the comments section excellent. (Comment Policy)