Sherief, FYI

The Atomic Walk

In The Atomic Application I mentioned that “With only about a day’s work you can turn your app into a standalone file” - and after talking the talk I decided to put my effort where my mouth is and walk the walk.

I grabbed the source of Quake 2, configured to build with Visual Studio, and began working on transforming it into an atomic application as outlined in my earlier post. The Quake 2 code was very straight-forward and clean, and there was existing scaffolding for abstracting away the filesystem layer. Adding PhysFS was straightforward, and once the filesystem layer was redirected to use it a few bugs were exposed where the code was directly calling into the C Runtime (CRT) instead of going through the filesystem layer - these previously worked since the existing filesystem layer was a paper-thin abstraction on top of the CRT, and so passing file handles back and forth caused no issues. Fixing these issues made it possible to load game assets from a 7z file embedded as a Win32 resource, and then I made some minor modifications to the code so it loads the renderer and game logic DLLs from embedded resources that are written to disk upon launch.

The whole process took less than a day (it was done entirely in one evening), and using the Quake 2 Demo assets I was able to get an end-product that is the Quake 2 demo contained entirely within a 30-something megabyte executable. The entire process consisted of 22 commits.

The code for Atomic Quake 2 is available under the original GPL license used for the Quake 2 source code release.