Live data from Hacker News

Source code for Quake 2 rerelease

github.com

211–220 of 232 posts

Re: Source code for Quake 2 rerelease

#211
post #48

My first thought is - what will the modders do. I watched some videos about MyHouse.wad (a Doom 2 level/mod that became popular with the indie horror crowd), and it's seriously impressive. I wonder what happens in the context of Quake, after seeing the community take Doom to places Carmack could never have imagined. I'm a lot more interested in how people mess with the rules of the game without necessarily breaking t…

I honestly don't expect anything nearly as impressive as what we currently have in the Doom community. While there's still plenty of folks making PWADs and IWADs that are vanilla Doom compatible, the ZDoom team has brought the technology of Doom so far that it's some mishmash hybrid of capability of Quake 1-2, and folks not only make amazing free mods for you to grab, there's even brand new games being built and released on ZDoom[0], with aesthetics ranging from "this feels right at home as a Doom game" to "a Doom engine game has no right looking this good" to incredibly stylized, unique takes.

Nightdive did a nice job giving new tools to make modern mods possible (effectively giving us much of the kit they used to remaster Q2). My read is that this isn't an accessibility to be able to make cool mods problem so much as an inertia one.

[0]https://www.doomworld.com/forum/topic/136771-every-gzdoom-ga... (Many of the links to games are various grades of NSFW)

Re: Source code for Quake 2 rerelease

#212
post #101

Earlier quoted context omitted.

It was so good that I would sometimes put the game disc in a CD player just to vibe. Unfortunately that CD cracked, so I no longer have access to the music nor the game.

If you buy Quake 2 on GOG, the CD images are part of it.

it's weird that this isn't the case for the Steam version... base1 doesn't hit the same without Operation Overlord.

Re: Source code for Quake 2 rerelease

#213
post #179

Earlier quoted context omitted.

Talking about clear and coherent, does anyone know if there is a deeper reason for using `break' and `continue' instead of pure structured programming? The snippet i = ent->client->chase_target - g_edicts; do { i++; if (i > maxclients->value) i = 1; e = g_edicts + i; if (!e->inuse) continue; if (!e->client->resp.spectator) break; } while (e != ent->client->chase_target); for instance, from the function ChaseNext in t…

Using % vs comparison and reset was probably more efficient with the compilers of the time; might still be. Also I doubt everyone would agree that the one exit condition is more clear. For example, if I know that if e->inuse is 0 it will continue with the next round. Arguably it's more difficult to understand that from the single combined expression—because it isn't so: if !e->inuse but e == ent->client->chase_target…

Seconded that the main reason was probably avoiding a mod. But it's not because of the compiler, but the processor. Mod and division instructions are always more expensive than additions and multiplications. If this function was on the hot path (and looking at where it's called, it's at least called once per frame), that may have mattered a lot.

Re: Source code for Quake 2 rerelease

#214

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…

Talking about clear and coherent, does anyone know if there is a deeper reason for using `break' and `continue' instead of pure structured programming? The snippet i = ent->client->chase_target - g_edicts; do { i++; if (i > maxclients->value) i = 1; e = g_edicts + i; if (!e->inuse) continue; if (!e->client->resp.spectator) break; } while (e != ent->client->chase_target); for instance, from the function ChaseNext in t…

I find the latter - with all the conditions much less clear. I have to pause and reason about each condition and it’s relation to the others, the order of the comparisons and the effect of short circuits.

The first example makes it very clear that condition A means do it again and condition B means exit this loop while condition C establishes the boundaries of the loop.

Re: Source code for Quake 2 rerelease

#215

Earlier quoted context omitted.

Discovering the drop down console was a revelation. An homage: http://guake-project.org/

I wish I could find a use for that, it is a funny idea. Unfortunately in a world where all of you stuff is in terminals, having one special drop down one is less useful.

I hadn't set this back up after getting a new laptop, but it's great for any of the one-off things you might need to do like confirm that some webserver is down like someone on chat complained it was, or lookup an ip or dns entry.

So the real benefit IMO is that it then lets you keep your actual terminals more clean and focused, and not just interleave that kind of stuff with whatever you are doing.

Re: Source code for Quake 2 rerelease

#216
Quake 2 and especially the Jailbreak mod were my first big foray into online multiplayer gaming. I was in two clans, one named after the band 311 (had no idea what it even was when they invited me to join because I hung out on their server which had a decent ping), and then later a clan named Atomic Slug Slingers ("ASS", haha, get it?).

It's really too bad that the old ways of independent servers and mods went the way of the dodo. Just the other day for no reason at all I found myself repeating the old guttural "Welcome to GameSpy" voice intro to myself.

Re: Source code for Quake 2 rerelease

#217
post #34

If I wanted to read the source code of just one version of Quake, to learn from it, which do you think would be the most interesting?

I would wait for Fabien to write a book on Quake I :) https://fabiensanglard.net/three_books_update/index.html

Thank you! Didn’t know these existed, so I should actually start with Doom. :)

Re: Source code for Quake 2 rerelease

#218
post #179

Earlier quoted context omitted.

Using % vs comparison and reset was probably more efficient with the compilers of the time; might still be. Also I doubt everyone would agree that the one exit condition is more clear. For example, if I know that if e->inuse is 0 it will continue with the next round. Arguably it's more difficult to understand that from the single combined expression—because it isn't so: if !e->inuse but e == ent->client->chase_target…

Seconded that the main reason was probably avoiding a mod. But it's not because of the compiler , but the processor. Mod and division instructions are always more expensive than additions and multiplications. If this function was on the hot path (and looking at where it's called, it's at least called once per frame), that may have mattered a lot.

A modern optimizing compiler would quite likely do induction variable elimination/strength reduction and replace the % with increment-and-reset if it deemed it more efficient, so it’s also about the compiler.

Re: Source code for Quake 2 rerelease

#219

Earlier quoted context omitted.

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 ac…

You can see places in the Q2 code where it has been incrementally tweaked a bunch. The player movement code got a bunch of changes, and you can see blocks of it that are commented out or have #if 0. There are some comments explaining the thought process, but it’s not very clear.

Re: Source code for Quake 2 rerelease

#220
post #54

Earlier quoted context omitted.

Quake 3 was still completely C, IIRC. You might be thinking of Doom 3?

the rerelease mentioned here rename .c to .cpp globally but the code base is still c, why is that? I thought it was rewritten in c++.

It's a light touch (looks like the original structure is mostly intact) but if you search for 'std::' in, say, https://github.com/id-Software/quake2-rerelease-dll/blob/mai... you'll see there's some C++ stuff floating about.
Post reply on HN