Metamorphism Quake - Part 4

By Kevin, March 17th, 2021

Now that we had a game server up and running on AWS, there were a few remaining bugs to iron out. These caused the game to crash pretty much immediately on connecting to the server.

At this point it looked like I was in the home stretch, but a few showstopper issues remained before we could play the game. 

Entering the help menu crashes the client

Calling up the help menu in the game was causing a fatal error and ejecting the player from the game. The best I could see from what little logs that were generated had to do with a missing model file.

Unfortunately, neither the original game nor the mod files from SourceForge had a copy of this file. 

The purpose of this switch is that when the help menu is entered, the player model goes invisible to the rest of the world. I really had no option here but to not use this file. Oddly enough, it looks like it only tried to do this if the game was running in QuakeWorld. Setting it to blank resolved the issue.

That wasn't the only problem though. It looked like there was some special handling of the help system depending on if the game was running locally (Quake on LAN) or on QuakeWorld. Also, the help system file wasn't even being compiled into qwprogs.dat (the file needed on the server to run the game server for clients to connect to) so it wasn't available. That was also fixed in that commit.

Now players could connect to the server and use the help system without the game crashing on them.

Taking damage crashes the game

The next issue I encountered was that taking damage also crashed the game. The log on the server made some mentions about a 'bodyqueue' entity. I had to litter the collision/harm functions with debug statements to find how far the client was getting before crashing.

That led me to find that the function that determines this was slightly different in the QuakeWorld source files than in the regular Quake files. Again, can't say for sure why that is - maybe it was unfinished changes. But by copying the same function over, this resolved the issue observed. Falling from high areas, dying, or self harm (like using the Thunderbolt gun under water) no longer crashed the game.

There was another questionable area of code that was causing the game to crash too, removing it fixed that and caused no visible issue in gameplay.

Dying with resolution higher than 1024x crashes the game

This bug I never actually figured out. All I can gather is there is likely some graphics driver incompatibility coupled with the game being pretty old. If your screen resolution in the game is higher than 1024x768, the game client will crash any time you die.

At this point, I had become pretty adept at making changes, building and pushing to the server then restarting the server with a few commands. Entering the game and exiting in fullscreen mode was slowing down the feedback loop - I started debugging it in a small window to rapidly test code changes:

Testing Quake 1 in windowed mode
Debugging Quake in windowed mode for faster feedback - checking for code hits to find the logic causing a crash

While debugging with the game in windowed mode I noticed that the game wasn't crashing anymore. Turns out that it was the resolution size causing the issue. I can't say for sure if there is something in the code that may trigger the crash, but it definitely does not happen at resolutions below 1600. This could be because I am running it on Proton (Wine) on Steam, or my host OS is Linux, or the core game code can't handle higher resolutions (it is the original engine - not the updated ones).

I was about to give up entirely on this one - had I not been debugging in a window and reading logs while the game was running, I may never have figured out that it had to do with the resolution. But you can play just fine at 1024x768! So I've noted in the README to not attempt to play the game on higher resolutions.

With that last "bug" out of the way, this completed all the visible issues and made the game completely playable the way it used to be back in the 90s!

Final Thoughts

This was a fun journey that only took a few weekends to do start to finish with a nice trip down memory lane. I got to spend some time with one of my favorite games ever, tool around in C, fix issues and get something classic up and going again. It felt really good.

The "final" version/result of this effort can be downloaded here. I don't have much time to dedicate to it now, only for a few moments on snowy weekends back in January. I have a lot going on in my career and the rest of my year is pretty booked up. But that's okay! We work really hard to be great and go far.

My hope is that, like myself, someone comes along, finds it and is able to care for it and bring it to a new generation of players. That said, I am available to talk about it on Slack or GitHub. As always, I am very generous with my time.

In addition, another outcome I was not expecting from taking on this small project was that the people and players I was playing against 25 years ago found me talking about this and reached out to me on LinkedIn. So now I am reconnecting with those folks and setting aside some time in the future to play some old school Quake deathmatch and Metamorphism with them when time permits. This was a welcomed surprise!

For now, its time for me to return to other projects and effort them along!