Live data from Hacker News

Source code for Quake 2 rerelease

github.com

161–170 of 232 posts

Re: Source code for Quake 2 rerelease

#161

Quake II was my first experience writing C. The code is clear, coherent, and straightforward. I’m not going to say it’s the best source code I’ve ever read, but it set a high bar. I’ve read source code to games since then, and I’ve seen all sorts of weird stuff… I’ve seen functions with nesting levels that go past the right side of the screen, I’ve seen functions a mile long that do a million things, you know. It was…

"I’ve read source code to games since then, and I’ve seen all sorts of weird stuff… I’ve seen functions with nesting levels that go past the right side of the screen, I’ve seen functions a mile long that do a million things, you know. It was an early lesson that you could do cool things with simple code."

Guilty as charged!

I used to chronically write macaroni code. So you would have like 25 lines of code that ended up being the back bone of like a dozen things that would have another dozen things stacked on top of each. Would execute super fast BUT would amount technical debt quickly and eventually said functions would become untouchable because you would risk breaking a lot of stuff build on top of stuff.

Comments would try to clear it up, but communication skills where not the best. Explain function but not workings. Things like - "Does SINE table". "Table Defrag". "Binary resolve" etc.

Get a lot of people going "What the F*K is this shit?! But... it does the job damn fast". If it was any field other that video games, I would not have lasted long and neither would the product...

Re: Source code for Quake 2 rerelease

#162
I played the original Quake in college the year it came out. They gave away so much of the game on demo floppy disks that your could play deathmatch for free. We took over a whole computer room in the journalism school (trash 486s, but nobody really used that room so we were left alone).

Quake II was at my first proper job, at DEC. I worked on the server/storage support team. At 5pm when the phone lines closed we'd fire up Quake II on a server and at least 20 people would hang around for an hour or two after work to smoke cigarettes and play Q2. The mods are terrific. One person used a perfectly crafted Homer Simpson mod, complete with sounds effects sampled from the show. Also remember a "Bananas in pyjamas" skin and a small floaty robot (which was a bit of a cheat because it was harder to see than Homer). And the maps! Christ, so many great maps. Some of them are in Xonotic, and I still play DM in them occasionally.

Re: Source code for Quake 2 rerelease

#163

Earlier quoted context omitted.

"Girobot", do you mean the "Gyrobot" by "Gyro Gearloose" [1]? Also, I believe KQP had ZeusBots included (for reference). [1] https://github.com/Jason2Brownlee/QuakeBotArchive

ZeusBots were where it was at, for me. First few computers were too slow to run Quake effectively, but then I had a Duron 900 (they ran slow AND hot!), bought a 'PC Powerplay' magazine that came with a CD full of quake mods, and a map with 20-40 of ZeusBots worked just fine!

Oh man, PCPowerPlay! I had my q3 mod written up in there in 2000 [1].

[1] https://github.com/Jason2Brownlee/HumanDebrisArchive/blob/ma...

Re: Source code for Quake 2 rerelease

#164

Quake II was my first experience writing C. The code is clear, coherent, and straightforward. I’m not going to say it’s the best source code I’ve ever read, but it set a high bar. I’ve read source code to games since then, and I’ve seen all sorts of weird stuff… I’ve seen functions with nesting levels that go past the right side of the screen, I’ve seen functions a mile long that do a million things, you know. It was…

I never scrutinized the id software source, but man have I seen some horrifying game source. The bar is extremely low. What's surprised me is that successful, fun to play, and stable enough games have been shipped with such absolute unmitigated disasters behind the curtain. It makes me question sometimes all the effort(and time) I put into preventing the chaos, when such carelessly bodged together garbage can be perf…

That's usually because the high level gameplay code needs to be incrementally tweaked over months or years based on very subjective feedback like "this doesn't feel quite right, can you maybe try...".

You can start with a great plan, but no plan survives gameplay- and balance-tweaking for very long.

Ideally the lower layers are much more structured though, usually those need to be maintained over a longer time and across games.

Re: Source code for Quake 2 rerelease

#165
post #15

What are people's thoughts on using "_t" as a suffix for types in C/C++, as this source does? My understanding is that it is technically reserved for language defined types, but I haven't come across a reasonable alternative (and having no suffix makes for odd code, for example a custom type for a "viewport" is better imo as "viewport_t viewport;" than "viewport viewport;")

It's totally fine and legal. Only POSIX reserves the _t for types, but POSIX is not the C standard (but even when writing code for POSIX, it's not like POSIX changes much these days, so unexpected type collisions because of POSIX updates will be very unlikely).

Re: Source code for Quake 2 rerelease

#166
post #15

What are people's thoughts on using "_t" as a suffix for types in C/C++, as this source does? My understanding is that it is technically reserved for language defined types, but I haven't come across a reasonable alternative (and having no suffix makes for odd code, for example a custom type for a "viewport" is better imo as "viewport_t viewport;" than "viewport viewport;")

Where I work the style guidelines for C specify to use "_type". Interestingly enough, the huge code base for embedded products with a custom OS does not rely on types for fixed-width integer types: "uint32_t", for example. Instead, a company-wide header defines "uint32" etc. without the "_t" suffix. I don't know what guided that decision.

For a very long time the fixed-width types in stdint.h were not universally available, or in other headers, especially Visual Studio trailed behind. I guess this problem has stuck even after all C compilers caught up with C99.

Re: Source code for Quake 2 rerelease

#167
post #95

Earlier quoted context omitted.

> Glad to see the source code released! In case you were unaware, this is actually the source code of the rerelease of Quake II. The source code for the original Quake II has been released for many years[0], along with many of the id Software classics[1]. [0]: https://github.com/id-Software/Quake-2 [1]: https://github.com/id-Software

In case you were unaware, the source code of the original is included along with the re-release in this repository, as stated in the first sentence of the readme.

I think Zambyte just wanted to let the GP know that the code for the original had already been released before this one. No need to be mean.

Re: Source code for Quake 2 rerelease

#168

Quake II was my first experience writing C. The code is clear, coherent, and straightforward. I’m not going to say it’s the best source code I’ve ever read, but it set a high bar. I’ve read source code to games since then, and I’ve seen all sorts of weird stuff… I’ve seen functions with nesting levels that go past the right side of the screen, I’ve seen functions a mile long that do a million things, you know. It was…

I never scrutinized the id software source, but man have I seen some horrifying game source. The bar is extremely low. What's surprised me is that successful, fun to play, and stable enough games have been shipped with such absolute unmitigated disasters behind the curtain. It makes me question sometimes all the effort(and time) I put into preventing the chaos, when such carelessly bodged together garbage can be perf…

That garbage code brought about the speed run culture, highlighted by charity events like Awesome Games Done Quick. The speed runner and their crew on stage will explain the latest level skips, wall clipping to avoid tedious areas, enemy weaknesses and exploits, and frame perfect input strings needed to accomplish those. And some will perform speed runs blindfolded with only the audio cues to work with.

Re: Source code for Quake 2 rerelease

#169
post #129

Quake 2 was surprisingly playable online even with late-1990s-era ping times. I played the hell out of the LMCTF mod back in the old days. Great times.

We had a thing in university where most of the research staff would do a few rounds of Quake 2 death match around the end of the afternoon. We were all on the same local network; so ping times were great. The same levels over and over again. Great fun. And very satisfying to hear the groans of agony after a rail gun blast.

Re: Source code for Quake 2 rerelease

#170
post #81

Earlier quoted context omitted.

It was one of the very first FPS games where you had true mouselook. All the predecessors either didn't (wolf3d/doom/rott), or faked it (ultima underworld). Notable exception is Descent (which is probably the actual first 3d FPS game), but IMO controlling a spaceship in 3d was a barrier to entry that Quake didn't have.

Descent had mouselook? Now I feel stupid. Or maybe I just didn’t have a mouse when I used to play it with friends, can’t remember.

Descent was closer to DOOM tech, not fully 3d but kind of a 2.5d . Quake was one of first true 3d games
Post reply on HN