3 ms·
I don’t know about quake, but in quake 2 it consisted of a big list of: else if (strcmp(cmd, “somecmd”) == 0) somecmd() I remember reading it at t
by wmanley 3y ago
I don’t know about quake, but in quake 2 it consisted of a big list of:
else if (strcmp(cmd, “somecmd”) == 0)
somecmd()
I remember reading it at the time and being inspired by the simplicity of it. It didn’t need to be more complicated than it was, and so Carmack didn’t make it more complicated. That was in stark contrast to a lot of the object oriented c++ design stuff that I was also reading at the time.
So much of the quake 2 game source was like that. Beautifully straightforward code.
- hyperthesis 3y agoLinear time is fine for small n, and console commands aren't time critical anyway. People famous for optimization also know where it matters. Optimization obscures.
- wmanley 3y agoHere it is: https://github.com/id-Software/Quake-2/blob/372afde46e7defc9dd2d719a1732b8ace1fa096e/game/g_cmds.c#L946 https://github.com/id-Software/Quake-2/blob/372afde46e7defc9...