Quake 3 Source Code Review 107
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.'"
"code" is OBSOLETE, loosers!!!! (Score:3, Funny)
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!!!!!
The most insightful comment. Ever. (Score:5, Funny)
You have just spouted utter nonsense, and have made a more valuable comment than most other people here.
Re: (Score:2)
Or an aneurism of shit.
Re: (Score:3, Funny)
I believe it spelled "aneurysm". They were discovered by Aneurysm Bevin, evil inventor of British death panels.
Re: (Score:1, Funny)
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]
Re: (Score:2)
what is a DINOSORE?
I'm a dumbass- (Score:2, Interesting)
Re:I'm a dumbass- (Score:5, Insightful)
"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!
Re: (Score:3)
Yes, you are- (Score:5, Insightful)
Just so we're clear, Quake 3 and its source code are NOT in the public domain.
Re:Yes, you are- (Score:5, Informative)
Public domain? No. GPL? Yes, which is probably what the OP meant (and to be pedantic, it is the engine that is GPL, not the game as such).
Re: (Score:2)
The gamecode is open source as well. id just chose not to release the art assets necessary to create a functioning copy of Q3 for free.
Re:I'm a dumbass- (Score:4, Interesting)
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)
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:
Re: (Score:1)
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.
Re: (Score:3)
Re:I'm a dumbass- (Score:4, Insightful)
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.
Re: (Score:3)
Re: (Score:1)
Re:I'm a dumbass- (Score:5, Informative)
Re: (Score:3)
Because you have source code to it and you can make it do new things because of that, while also learning something.
Re: (Score:3)
Re: (Score:3, Insightful)
Why use the quake 3 engine when you can use the newest unreal engine with all the tools the professionals use for free?
Because you might want to release the game one day? Then you have to pay for both the engine and royalties.
Also, you may want to produce a game that can run on a tablet or normal notebook, in which case the Unreal engine requirements disqualifies it.
Re: (Score:3)
Re: (Score:3)
Re:I'm a dumbass- (Score:5, Informative)
Re: (Score:2)
Re: (Score:1)
n short, they take 25% if you sell the game, but only if your game makes more than 50.000.
So in other words, one is better off using IdTech3/4, unless one plans to sell more than $50k, in which case the Unreal engine might be a viable option.
25% of sales is HUGE.
Re: (Score:2)
Re: (Score:2)
With a completely free game, how does one recoup the $99 per platform per year fee for a developer certificate?
"Please send me a dollar for the ad-free version"
Re: (Score:2)
"Please send me a dollar for the ad-free version"
If you have ads, that counts as income from Epic's perspective, and so does the dollar in donations.
Once you hit the $50,000 mark in total, they want 25% of both your ad revenue and donations.
Re: (Score:3)
App store fee (Score:2)
With a completely free game, how does one recoup the $99 per platform per year fee for a developer certificate?
I do not understand what you don't understand about "do not need to pay anything."
It costs per year to get onto the iOS App Store, Mac App Store, Amazon Appstore, or Windows Store, even for applications priced at $0.00. Epic sees none of this. So let me rephrase: With a completely free game, how does one recoup the $99 per year fee payable to Apple for a developer certificate?
Re: (Score:2)
Re: (Score:2)
Or just release the game on your own website instead of App Store
Which would mean each user would have to buy his own developer certificate to install it. I guess I could make it exclusive to PC and Android.
Re: (Score:2)
$99 is a drop in the bucket. How do you recoup the $100/hr that you as an independent contractor should be charging for your labor?
Unless of course your time isn't worth anything.
Re: (Score:2)
Looking for a first job (Score:2)
Re: (Score:2)
Consider the case of somebody who doesn't (yet) have a job in a given industry. A job seeker will want a portfolio to present to those responsible for hiring, and I don't see how anybody will pay a job seeker to build a portfolio.
Welcome to the modern world. Not long ago, vocational schools encouraged students to build a portfolio, and graduation ended with the student presenting a major work, which became the crown of the portfolio and basis for acceptance for apprenticeship (and later in life, the major work would hopefully be replaced by a masterwork).
Some countries still put great value in technical and trade schools.
And some schools still allow or support students in building a portfolio. But yes, times have changed, and empl
So? (Score:2)
So what?
You want to build an app for IOS, sell it for a buck or 5 and act like a pro.
If you want to give it away as portfolio material so someone might give you a job. The stop whining and spend the $100 as a cost of education. Maybe you'll get a job or maybe not. But its still a drop in the bucket compared to the amount of money you don't make by not having a job, or the amount of money you spend getting an education.
Re: (Score:2)
Re: (Score:2)
So if a programmer seeks a job in the video game industry, what should be in his portfolio, and how should he support himself while building it?
I would think that a game or demo developed while studying would be a good start. If painters are expected to present example paintings at the end of their study, it's surely not to much to ask that a games developer can present a game or demo?
Games including what? (Score:2)
I would think that a game or demo developed while studying would be a good start.
I agree with this. However, Slashdot user CronoCloud has told me that certain games that I have made available on my web site would be a net negative in my portfolio for various reasons. What aspects are video game companies looking for in the games and demos in one's portfolio?
Re: (Score:1)
Call your parents and tell them you need $99 for cocaine, hookers, lawyers etc? Hell I'd ask for more.
Re: (Score:2)
Call your parents and tell them you need $99 for cocaine, hookers, lawyers etc? Hell I'd ask for more.
If your parents are happy to pay for your cocaine and hookers, why the fuck would you worry about getting a job anyway?
Re: (Score:1)
Re: (Score:1)
..... Your momma.
Re:I'm a dumbass- (Score:5, Informative)
"Also, you may want to produce a game that can run on a tablet or normal notebook, in which case the Unreal engine requirements disqualifies it."
unreal engine isn't so bad on tablets... http://epicgames.com/infinityblade/ [epicgames.com]
it's a fine engine. what you render with it is what makes all the difference if it runs well or not.
Re: (Score:2)
unreal engine isn't so bad on tablets... http://epicgames.com/infinityblade/ [epicgames.com]
Except that that isn't the "free for development" UTK x86 engine we were talking about here, but a much more costly license.
Re: (Score:2)
So you can learn how to implement engine components on top of an existing engine that you didn't write. You can do that with unreal as well, but it's done differently, each has its place.
So that you can do something where you had anyone who wants it the entire source code if you're trying to demonstrate a new idea (e.g. a new bot AI).
Re: (Score:2)
I laughed when he said the first striking thing was that the solution had multiple projects in it.
Is the second striking thing that id used an existing 3D API for rendering?
Re: (Score:3)
The third striking thing where he he discovered "circular buffers" but calls them "Array index cycling." Are programmers really that clueless that they don't realize MOD N can be optimized with AND N-1 ??
http://fabiensanglard.net/quakeSource/quakeSourceNetWork.php [fabiensanglard.net] ;
arrayIndex = (oldArrayIndex+1) % 64
arrayIndex = (oldArrayIndex+1) & UPDATE_MASK;
Which came from:
Network Model (Part 3 of 5)
The array cycle with the famous binary mask trick I mentioned in Quake World Network (Some elegant things).
Re: (Score:1)
Are programmers really that clueless that they don't realize MOD N can be optimized with AND N-1 ??
you forgot about the part where gcc compiles both variants to exactly the same assembly...
Re: (Score:2)
Not a programmer. Did gcc do that back in the Q3 days or does it do it now?
Re: (Score:2)
Correct.
Compilers do it NOW but they didn't always use to UNLESS you turned optimizations on. Debugging un-optimized code is a lesson in pain. Especially when you are trying to debug a real-time system and can't due to performance issues.
Re: (Score:2)
That trick is only guaranteed to work if N is a power of two. It's much better to just use mod and let the compiler figure out how to optimize, lest you run into mysterious bugs when someone changes N.
What's the point of this system? (Score:3)
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.
Re: (Score:1)
RTFA:
http://fabiensanglard.net/quake3/qvm.php [fabiensanglard.net]
Re:What's the point of this system? (Score:4, Interesting)
I wrote this very comment *because* I read that article.
Re: (Score:2)
Re: (Score:2)
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...)?
Re: (Score:2)
Re: (Score:2)
Whatever overhead an IPC mechanism would have would be insignificant compared to the overhead of running interpreted code as was initially desired.
Re:What's the point of this system? (Score:4, Informative)
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.
Re: (Score:2)
This was decided later. It still doesn't explain why they'd think their system would be faster than inter-process communication.
Re: (Score:1)
Security. Viruses can't be implemented in mods if they run on a VM.
Re: (Score:2)
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.
Re: (Score:2)
Linking a DLL does not require recompilation.
Re: (Score:3)
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.
Re: (Score:2)
What kind of advantage does that have over recompiling the mods for a new architecture?
Re: (Score:2)
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?
Re: (Score:2)
So essentially the advantage of this virtual machine is that it forces mod providers to provide a retargetable source of their mods?
Re: (Score:1)
Any SlashDotters ever develop with APL? (Score:1)
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