Nightdive Studios has released the Mac source code for the original System Shock under GPL. Recovered by OtherSide Entertainment, helmed by LGS' very own Paul Neurath, all and sundry can now check it out on GitHub and even create their own versions. Not that this is likely to happen, given how ancient it is, but hey, at least it's possible.
Although Nightdive recently put the brakes on its high-def remaster after losing its way, it hasn't stopped the developer following through with its plan to punch out the code for 1994's System Shock, which introduced us to SHODAN, the creepy AI with a fetish for meat bags.
Imagine you're a programmer, working on a video game almost two decades ago. No one outside the studio is ever going to see your code, so you can name methods and write comments however you like, right?
Unfortunately, you can't just grab the code, make some changes and play away. System Shock's Mac version is native to the Power Mac platform, so you'll need to run an emulator to get it working (among other details).
If you're not particularly keen to dig into the code yourself, Nightdive has already had a poke around:
- The game uses fixed point for all the math instead of floating point. However, some blitting functions, after being optimized in the Macintosh version, use floating point registers and operations to speed up copying stuff.
- System Shock uses the rendering-with-unique color trick (similar to http://www.opengl-tutorial.org/miscellaneous/clicking-on-objects/picking-with-an-opengl-hack/) to detect object clicks and shooting targets. This same trick is used to show nearby objects when online help is on.
- In order to draw outline fonts, System Shock draws the same string 10 times. First they are rendered in black with a 1-pixel displacement into each of 9 directions, and then the desired color at the center.
- There are various pieces of code commented out or disabled (using the preprocessor's conditional compilation) meant to deal with a level editor and play testing.
- Internally, the game usually treats the screen resolution as if it were 320x200 in order to achieve resolution-independent code.
- The game is mostly written in C, except for the physics library written by Seamus Blackley (EDMS, the Emetic Dynamics Modeling System) and the fixed-point library it uses, which are written in C++, and some Assembly modules.
For those of you who just want to see funny comments, well, you've been catered for, thanks to this /r/programming thread. A few gems:
// oh oh oh baby oh baby oh self modify height delta step baby now baby please // really, this wants to become the threaded nightmare assembler point coder from hell
// Although this seems a very stupid way to do this, it's actually not... // woo hoo, watch me pull odds out of my butt // don't ask me why i have to do this - but i do
Well. Yes. If only we could all pull odds from our butts, the world would be a better place.
When I think about retro games, forget Mario, Sonic or even Tetris. I think Zork. The quirky text adventure, published by Personal Software (and then Infocom) back in 1980, screwed with players in many, many ways (when it wasn't sending grues after them).
System Shock (PowerMac version / Official GPL Release) [GitHub, via Reddit]