The Gruntz source code recreation project
Jul 31, 2020 11:37:30 GMT -8
SwordGrunt, Zu, and 3 more like this
Post by Tomalla on Jul 31, 2020 11:37:30 GMT -8
A month ago (give or take) I started a very interesting project. I grabbed the Gruntz binary and started reversing it from the ground up. As a result I'm recreating the entire source code base of the game Gruntz and WAP32 game engine. Here I whipped up a repository where you can look up my current progress:
GitHub Gruntz Repository
Before I go any further let me make one thing clear: it's a hell of a project and may take several years provided I persevere. The project may be dropped at any point. But it looks promising so far.
Here's a few interesting facts I've discovered so far:
If a project like this will somehow be completed some new possibilities may arrive - switching the rendering engine from DirectDraw to OpenGL (which would already make it available for Windows 10), getting rid of all WinAPI dependencies, moving it over to CMake, porting it to other operating systems and adding modding support. All of this while keeping it backwards compatible with the original game. Right now however it's too good to be true and I don't want to get anyone's hopes up. I might drop the project after a few months after all. But I'll try to keep you posted with some interesting facts I discover along the way while I'm at it.
Cheers.
GitHub Gruntz Repository
Before I go any further let me make one thing clear: it's a hell of a project and may take several years provided I persevere. The project may be dropped at any point. But it looks promising so far.
Here's a few interesting facts I've discovered so far:
- originally there was a "lobby launch" mode: if the game was run with a "LOBBYLAUNCH" command line argument and there was another game instance already running, it would find it and send it a message to launch a lobby, whatever that means. Unfortunately in newer Windows operating systems this feature stopped working (it uses some deprecated WinAPI structure fields for that purpose).
- some of you know that if you press Shift when running the game an advanced options dialog will be shown. What you might not know is that you can also press a Ctrl key or even a Home key to achieve the same result. The advanced options dialog box is also shown if you run the game with a command line argument containing any of the following strings: "adv", "ADV", "optionz" or "OPTIONZ". So you can run the game with: "Gruntz.exe AAAADVFOO" and it will show the options dialog unconditionally
- the routine of checking for the Gruntz CD in the CD-ROM drive is quite simple - it iterates over all available CD-ROM drives and if any drive contains a file "\GAME\GRUNTZ.EXE", it assumes the Gruntz CD is present.
- the WAP32 game engine uses polymorphism extensively. At the top level there are classes: CGameApp (which takes on application management duties and runs the game message loop), CGameWnd (responsible for managing the game window itself) and CGameMgr (managing game logic and resources). Gruntz derives its own classes from the base WAP32 classes and overrides virtual methods with game's logic: CGruntzApp, CGruntzWnd and CGruntzMgr. Obviously there's way more of these classes, I've just gone this far with the reversing process.
If a project like this will somehow be completed some new possibilities may arrive - switching the rendering engine from DirectDraw to OpenGL (which would already make it available for Windows 10), getting rid of all WinAPI dependencies, moving it over to CMake, porting it to other operating systems and adding modding support. All of this while keeping it backwards compatible with the original game. Right now however it's too good to be true and I don't want to get anyone's hopes up. I might drop the project after a few months after all. But I'll try to keep you posted with some interesting facts I discover along the way while I'm at it.
Cheers.