So I was thinking about JKA, a game I easily had over 10k hours in back when I was a teen and stumbled across this piece of history.
It turns out that back in 2013, right when Disney bought Lucasfilm and shut down LucasArts, the devs at Raven Software panicked that their work would get locked in a vault forever. So they hastily dumped the entire source code for Jedi Outcast and Jedi Academy online.
Because it was a sudden dump, they didn't sanitize any of the internal dev comments. The whole thing is a time capsule of stressed out programmers losing their minds trying to make lightsaber physics work in the Quake 3 engine.
If you look at the main combat file (bg_saber.c), the entire lightsaber melee system is essentially one massive 5000 line switch spaghetti statement.
I scoured the codebase and found some GOATed comments:
1. sv_savegame.cpp - A dev had to write a fake loading loop just to keep a "Saving" popup on the screen long enough for the player to read it.
// I'm going to jump in front of a fucking bus if I ever have to do something so hacky in the future.int startOfFunction = Sys_Milliseconds();// ...a few dozen lines later...// The first thing that the deferred script is going to do is to close the "Saving"// popup, but we need it to be up for at least a second, so sit here in a fucking// busy-loop. See note at start of function, re: bus.
2. AI_Jedi.cpp - Trying to program bots to use force powers and navigate 3D maps on a 2003 CPU was clearly a bad time.
{ //fuck, jump instead{ //fuck it, just force it
3. Dismemberment G2_bones.cpp - JKA used a custom skeletal animation system to handle cutting off limbs, overriding joint angles led to this note.
// why I should need do this Fuck alone knows. But I do.
4. bg_pmove.cpp - Someone spent way too long trying to get character models to stop sliding on flat surfaces.
{ //on ground and not moving and on level ground, no reason to do stupid fucking gravity with the clipvelocity!!!!
5. NPC_reactions.cpp - The actual code logic for when you stand there holding your crosshair directly on a friendly NPC's face.
//ask them what the fuck they're doing
6. quake math (q_math.cpp) - This (inf)famous bit hacking trick was inherited directly from John Carmack’s Quake 3 engine, even the Raven devs reading it years later had no clue how it worked.
i = 0x5f3759df - ( i >> 1 ); // what the fuck?
7. mhead.c - When the engine hits corrupted MP3 or WAV file data headers.
return 0; // fuck knows what this is, but it ain't one of ours...
8. fatal crash error (win_glimp.cpp) - What happens if the graphics renderer completely fails to load on Windows.
// error box that'll only appear if something's seriously fucked then I'm going to fallback to
void FuckingWellSetTheDocumentNameAndDontBloodyIgnoreMeYouCunt(LPCSTR psDocName){if (gpLastOpenedModViewDoc){// make absolutely fucking sure this bastard does as it's told...gpLastOpenedModViewDoc->SetTitle(psDocName);}}
// Need to extern these. We can't #include qcommon.h because some fuckwit
//SIGH... fucks him up BAD // ...18 lines later... //SIGH... spine wiggles fuck all this shit
{//aw, fuck it, clients no longer take impact damage from other clients, unless you're the player
{//just get the fuck out
{//just blow the fuck out of them
It is wild to think that one of the highest skill ceiling multiplayer games ever made runs on this exact code. Shoutout to the OpenJK team for cleaning up this spaghetti and keeping the game alive today.