Forgot your password?
typodupeerror
Quake First Person Shooters (Games) Open Source Games

Quake 3 Source Code Review 107

Posted by Soulskill
from the sleep-is-for-the-weak dept.
An anonymous reader writes "id Software has a history of releasing the source code for their older games under the GPL. Coder Fabien Sanglard has been taking it upon himself to go through each of these releases, analyze the source code, and post a detailed write-up about it. He's now completed a review of the Quake 3 source code, diving into the details of idTech3. It's an interesting read — he says he was impressed in particular by the 'virtual machines system and the associated toolchain that altogether account for 30% of the code released. Under this perspective idTech3 is a mini operating system providing system calls to three processes.'"
This discussion has been archived. No new comments can be posted.

Quake 3 Source Code Review

Comments Filter:
  • by For a Free Internet (1594621) on Saturday June 30, 2012 @11:12PM (#40508567)

    Todays compotor scientists program with pure thought connected by JSON/XMLhttpREQUEST to a HTML5 document tree located in four-dimensional time on the APP STORE. This "code" shows that Id software is living in the PAST and won't be arouned for long, it is a DINOSORE and I am going to eat its stock markets for BRUNCH with BEAUTIFUL HOOKERS and jesuse!!!!!

    • by Anonymous Coward on Saturday June 30, 2012 @11:29PM (#40508631)

      You have just spouted utter nonsense, and have made a more valuable comment than most other people here.

    • Re: (Score:1, Funny)

      by Hal_Porter (817932)

      If this Carmat guy had spend more time updating his skills with modern languages like PHP his website wouldn't have got pwned

      http://doom-ed.com/ [doom-ed.com]

      <?php
      define('DB_NAME', 'wp_doomed_com'); // The name of the database
      define('DB_USER', 'wp_doomed_com'); // Your MySQL username
      define('DB_PASSWORD', 'wp15'); // ...and password
      //define('DB_HOST', 'localhost'); // 99% chance you won't need to change this value
      define('DB_HOST', 'mysql25.secureserver.net'); // 99% chance you won't need to change this value
      define('M

    • by AaronLS (1804210)

      what is a DINOSORE?

  • I'm a dumbass- (Score:2, Interesting)

    by WiiVault (1039946)
    But I can't help but revel in the growth and extension of public domain engines and assets by willing companies. As a dum-dum, I still see a lot of value in Q3 based projects. They really look good enough(for me), and I hear good things about the netcode. It isn't the end-all-be-all of engines, but it really is one of the first modern commercially sold engines available to the rest of us. If I may be so bold; gentlemen start your engines. I can't wait to see what you come up with.
    • Re:I'm a dumbass- (Score:5, Insightful)

      by mrchaotica (681592) * on Saturday June 30, 2012 @11:23PM (#40508603)

      "Start your engines; I can't wait?" Dude, this was released years and years ago. In fact, the guy in the article previously reviewed the Doom 3 source code (which is much newer) and just decided to go back and do this old engine for completeness' sake.

      Wikipedia has a list [wikipedia.org] of games that already exist that are based on the GPL Quake 3 source. You need to crawl out from under your rock a little more often!

    • Yes, you are- (Score:5, Insightful)

      by MrEricSir (398214) on Saturday June 30, 2012 @11:29PM (#40508623) Homepage

      "But I can't help but revel in the growth and extension of public domain engines and assets by willing companies."

      Just so we're clear, Quake 3 and its source code are NOT in the public domain.

    • Re:I'm a dumbass- (Score:4, Interesting)

      by Smauler (915644) on Sunday July 01, 2012 @10:07AM (#40510271)

      I still see a lot of value in Q3 based projects. They really look good enough(for me), and I hear good things about the netcode.

      Literally yesterday, I was looking at a bridge in Lord of the Rings Online (which is quite pretty otherwise), and thought to myself : Why isn't it curved?

      It seems the fashion with engines now is to drop curved edges - I'm not sure why. They look so much better, and have been around for ages. Quake 3 did these brilliantly, and when it came out, I thought that would be the end of crappy lumpy bridges, etc. No such luck, they're still with us, over a decade later.

      Anyone with knowledge of this issue, and why they're still about?

      • Re:I'm a dumbass- (Score:5, Interesting)

        by parlancex (1322105) on Sunday July 01, 2012 @07:55PM (#40513173)

        Q3 engine's curved surfaces are actually quadratic bezier spline patches (9 control points per patch). The patches had to be designed with special tools in an editor and were tessellated at runtime to an appropriate detail level based on the computer's graphics settings. The engine did not support any kind of collision detection with these surfaces so they had to be enveloped in invisible brushes to appease the BSP system for collision and culling.

        While they were interesting at the time the reasons nobody really does this anymore are probably:

        • The special tools required to design curved surfaces need to be supported by the artist's tools and entire game toolchain, creating more work for artists and tool programmers
        • Quadratic bezier patches are one of the simplest types of curved surface but can still be difficult to work with. Certain shapes are hard to construct properly with them.
        • Lastly I'd say they've been kind of superseded by smooth / detail surfaces available through subdivision algorithms which can work on conventional geometry and conventional tools, and is supported on modern cards in hardware
        • by Anonymous Coward

          That's incorrect. The Quake3 engine does have collision detection on curved surfaces. It generates triangular collision volumes along the curve at a pre-defined level of tesselation. What the curves don't do is participation in the BSP tree generation, so you are required to place "caulk" brushes behind them to seal the level if on an outside edge, or to block visibility if this is an internal wall.

    • by hairyfeet (841228)

      I'm sure i'll get hate for saying this but WTF, truth is truth:

      It is NOT the engines that are the problem, hell there are still plenty of guys playing games like Freelancer and Far Cry I out there and those are pretty damned far behind the curve, its the simple fact that the FOSS community simply won't put in the work to make decent games.

      Now don't get me wrong, not saying making games is easy, just that the engine isn't the problem. i mean what did we get from the last source code releases? 50 bazillion ri

      • Re:I'm a dumbass- (Score:4, Insightful)

        by Smauler (915644) on Sunday July 01, 2012 @03:43PM (#40511993)

        Content is the most difficult thing about games now. Seriously. The engine is not where most of the resources go.

        It's a hell of a lot more difficult creating a decent in game universe than creating an engine. Think about it - games now require _loads_ of textures someone has to paint. Loads of voiceovers someone has to do. Loads of text someone has to write. And debug, optimise, etc. The engine is not the tough bit. A lot of it is dull, dull work.

        That being said, there are success stories, but they are few and far between. Fall from Heaven (civ4), Magna Mundi (EU3) - (though look at how that has turned out now), quite a few for X3, and obviously the old poster boy, counterstrike. These mods relied upon a large initial userbase.

        Seriously, content is king now, and it's hard to do without loads of work.

        • by savuporo (658486)
          If i had mod points .. What a lot of people don't realize is that direct coding budget is often less than 10% of any major title nowadays. A chunk goes to middleware licensing, and the rest is all pretty much content creation, be it story writing, 3d/2d artwork, audio, acting etc.
        • I would have written quite a few games myself... Except I absolutely suck at content. It's not like programming is hard at most levels (Optimization is a different story).
  • by loufoque (1400831) on Sunday July 01, 2012 @10:41AM (#40510435)

    From a quick reading, I don't get the point of this system.
    Couldn't they just compile their C code to a dll normally and then load that dll and call vmMain?

    I don't see what those "virtual machines" are bringing.

    • by Andor666 (659649)
    • I was thinking the same thing. But I would imagine this was done to restrict what the code run by the VM can do. This way, the code is guaranteed to not to interfere with the core engine. Imagine what would happen if all the Quake 3 modders out there were able to do anything they wanted in C code. Invariably, most mods would probably have bugs in them that would cause the game to crash all the time. And I guess this wouldn't apply just to the modders, but also other game developers building on top of the Qu
      • by loufoque (1400831)

        I see, so the whole system exists for sandboxing.
        But then why not do a simpler approach where each module runs in its own process and communicates with the master through an IPC mechanism (sockets, shared memory, named pipes...)?

        • My guess is performance. It's probably faster to have code running within the same process, rather than having the IPC overhead. You have to remember how slow the hardware was when Quake 3 was released. I'm impressed at how smooth that game ran on that slow hardware.
          • by loufoque (1400831)

            Whatever overhead an IPC mechanism would have would be insignificant compared to the overhead of running interpreted code as was initially desired.

            • by purpledinoz (573045) on Sunday July 01, 2012 @01:33PM (#40511373)

              Apparently, he got around this by compiling the bytecode to x86 code on the fly:

              Moreover their design is much more elaborated: They combine the security/portability of Quake1 Virtual Machine with the high performances of Quake2's native DLLs. This is achieved by compiling the bytecode to x86 instruction on the fly.

              And here's the evolution of this:

              Trivia : The virtual machine was initially supposed to be a plain bytecode interpreter but performances were disappointing so the development team wrote a runtime x86 compiler. According to the .plan from Aug 16, 1999 this was done in one day.

              • by loufoque (1400831)

                This was decided later. It still doesn't explain why they'd think their system would be faster than inter-process communication.

        • by Anonymous Coward

          Security. Viruses can't be implemented in mods if they run on a VM.

    • by gl4ss (559668)

      simplicity, reproducibility, not needing the level scripters & etc to constantly be compiling the engine itself.

      anyhow, you can do .dll mods for q3.
      but unless I'm totally mistaken, only the other type of mods which are ran in the vm thingy can be loaded on the fly from the server.

    • Portability is a HUGE advantage to the VM architecture. Quake 3 has been ported to many OSes and CPU architectures that didn't even exist when the game first came around (or many of the mods). With the QVM, it's no problem to have a native Quake 3 port to Linux x86_64 and still run all the old mods without having to rebuild them. Additionally, ports to Android (Qauke 3 on ARM) also don't affect mod compatibility.

      I think it's a huge step back that they regressed on the role of the VM in Doom 3.

      • by loufoque (1400831)

        What kind of advantage does that have over recompiling the mods for a new architecture?

        • by Dog-Cow (21281)

          Um, is this question for real?

          Only a few handfuls of people on the planet will have access to the source for the vast majority of mods. Who's going to recompile your favorite mod for you for some new Android toy when the mod hasn't been updated at all in 4.5 years?

          • by loufoque (1400831)

            So essentially the advantage of this virtual machine is that it forces mod providers to provide a retargetable source of their mods?

    • by HPXX (1189589)
      From http://fd.fabiensanglard.net/doom3/pdfs/johnc-plan_1999.pdf [fabiensanglard.net] "The interpreted code has two prime benefits: portability and security." He also discusses the VM in http://fd.fabiensanglard.net/doom3/pdfs/johnc-plan_1998.pdf [fabiensanglard.net] "With significant chunks of code now running on the client side, if we stuck with binary dll's then the less popular system would find that they could not connect to the new servers because the mode code hadn't been ported" The documents are interesting, if you get the some time for
  • I was an APL biggot in the late 70's and early 80's. I could get more done in an hour than an excel expert, a gui expert, a numerical analyst, a text manipulator expert could do if given a Monday Morning assignment.

    I finished a project to convert several thousand TSO and JCL scripts in about three hours that in the contest with the System Programmers, took them about 10 days.

    The SP guys wanted something that was low overhead. I needed something NOW. Surprisingly, my solution worked and was used for anot

"Stupidity, like virtue, is its own reward" -- William E. Davidsen

Working...