Earlier quoted context omitted.
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.
Never use sudo again! make the drop down be always at your root shell.
Source code for Quake 2 rerelease
181–190 of 232 posts
Re: Source code for Quake 2 rerelease
#182Quake 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…
The best reason not to re-write for style reasons is you break it.
Re: Source code for Quake 2 rerelease
#183Earlier quoted context omitted.
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
Re: Source code for Quake 2 rerelease
#184Earlier 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…
No, the continue statement will jump to the test part also for `do' loops:
"The continue statement is related to break, but less often used; it causes the next iteration of the enclosing for, while, or do loop to begin. In the while and do, this means that the test part is executed immediately"
-- "The C programming language (Second Edition)"
Re: Source code for Quake 2 rerelease
#185Earlier quoted context omitted.
It was absolutely revolutionary in its time, it’s difficult to think of any current day parallels because the industry has matured so much. For instance, Quake was the first FPS where the maps were truly 3D and could have one piece of floor on top of another. It would be considered insane for a game to not have that now. Quake(World) was the first truly massive online gaming FPS. Quake II was the first game I ever ow…
> For instance, Quake was the first FPS where the maps were truly 3D and could have one piece of floor on top of another Bethesda's Terminator: Future Shock predated Quake by a year and also had truly 3D maps - which were often more expansive than Quake's (also you could drive vehicles, fly a helicopter or something like that IIRC, enter various places to find loot - though the loot variety was limited to basically a…
2: Doom's impact was more huge than Quake. The MOD community still releases PWADs today. Doom basically boosted LAN multiplayer matches.
Re: Source code for Quake 2 rerelease
#186Earlier 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…
Pretty sure your line 3 and the original lines 3-5 are not equivalent. Check it with `i` entering the loop with value `maxclients->value`. The best reason not to re-write for style reasons is you break it.
Re: Source code for Quake 2 rerelease
#187Earlier quoted context omitted.
Pretty sure your line 3 and the original lines 3-5 are not equivalent. Check it with `i` entering the loop with value `maxclients->value`. The best reason not to re-write for style reasons is you break it.
Thanks, now corrected.
Re: Source code for Quake 2 rerelease
#188Earlier 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 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
#189Earlier 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…
I think it's debateable which is clearer. Your while condition requires some mental parsing of the booleans whereas the original can be analysed one at a time. I'd say I prefer the original.
do {
...
} while (p);
guarantees that p is false after the loop and this makes it easier to reason about the program. With breaks, however, the loop could be "lying" so to speak.Re: Source code for Quake 2 rerelease
#190Quake 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…