Skip to main content
GameDev.net gamedev.net
🔒 Locked

How many lines of code are in the quake engine?

Started by CodaKiller Apr 2, 2009 at 6:29 PM 20 replies 31.7k views
Original Post
CodaKiller
CodaKiller
I'm interested to know how the 3k lines of code in my engine compare to other commercial engines. I'm just wondering how many lines of code are in the quake engine? And if anyone knows how many lines of code are in some of the other engines such as the source engine or the cry engine, I'd really like to know. I am meaning without the code for the APIs, just the main game engine.
Remember Codeka is my alternate account, just remember that!
mkuhlens
mkuhlens
Unreal Engine 3 has 2 million+ lines of code (editor included) and 100,000+ lines of unreal script.
mkuhlens
mkuhlens
Other than sheer curiosity, why are you comparing your engine to commercial engines? There are some cpp files in the Unreal engine that are over 3000 lines by themselves.
bzroom
bzroom
You can download the quake source and other popular (old) games from this very website you are viewing.. just start digging :)

I would just like to make the comment that line count is pretty irrelevant, other then the fact that if it's too excessive you're going to have problems with the size of your executable.

We had a guy apply where i was working who said "my tools have over 100k lines of code" we all just looked at each other like "wtf? our game bearly has 100k lines of code in it.."

More code generally is caused by duplication and that leads to brittle code and a nightmare for refactoring.

Not to say that you should write everything with as few lines as possible, but it should just not be a primary concern (or selling point).
mightypigeon
mightypigeon
Quake 3 has nearly 310,000 lines (including comments and blank lines)

This is comprised of:
Engine: ~64,000
Renderer: ~52,000
Game: ~50,000
Client game: ~42,000
Bot stuff: ~40,000
Then the two different types of UI (vanilla quake 3 and team arena UI) ~30,000 and ~25,000
Then theres a "splines" project, around 9000 lines, except that wasn't used in Quake 3 (I believe it was some early Doom 3 stuff + given to licensees to use for cut scenes).

That doesn't include the tools (radiant, map compiler, code compiler, etc) which I would say would be at least another 10 to 20 thousand lines (if not more).

I don't have the Doom 3 engine code (I wish! But some day soon it will be open sourced) but the game code comes in at around 230,000 lines (almost as much as all of quake 3!). And the Crysis Wars SDK comes in at about 280,000.

And that's all the game SDKs I have on my PC :P But it gives you a rough idea.

It's not really fair to compare yourself to Quake or Unreal, since there is code in Quake 3 that has been around since quake 1 and possibly even since the original Doom. And the Unreal engine structure is still quite similar today to how it was when Unreal 1 first came out in 1998 (I think?).

These engines have several people working on it every day of the year. My own engine comes in at around 15,000 lines, and I've been working on it for over two years. But I can't dedicate a full 8 to 10 hours a day on it - I wish I could - but I don't get discouraged by the fact that Quake 3's menu has more lines of code than my entire engine and game code combined :)

Keep on coding. Don't measure your engine on how many lines of code there are, so long as it does what you need it to do that's all that matters! Keep it up.
[size="1"]
Emergent
Emergent
It's been said (I think by Dijkstra) that judging programs by length is like judging airplanes by weight.

Ah, it was actually Bill Gate:

"Measuring software productivity by lines of code is like measuring progress on an airplane by how much it weighs."

Anyway, the point stands.
nsto119
nsto119
After running a quick little tool I made, the Source SDK has 786691 lines of code, with 196071 comment lines, and 218512 blank lines. That's EVERYTHING though, including the modelviewer, BSP compiler, etc code.
Decrius
Decrius
I would rather say, the LESS lines for the same or more functionality, the better. Beside that, commercial products are bound to time, they often don't have time to really think of good compact ways but only for the result, the product. I'm a hobbyist :P, lots of time, so I really try to perfect my projects.

FYI, my GUI library, which currectly consists of all core elements and only needs to add support for other external libraries and need to add more GUI elements, but beside that, with all core functionality (and 5 GUI elements) the code is 7,000 lines long (code only), or 10,300 in total. Not bad for a light-weight GUI :D. Been working on it since October, but I don't program every day, and some weeks not at all.
[size="2"]SignatureShuffle: [size="2"]Random signature images on fora
RobTheBloke
RobTheBloke
Quote:
Original post by bzroom
I would just like to make the comment that line count is pretty irrelevant, other then the fact that if it's too excessive you're going to have problems with the size of your executable.


WUT? comments do not have any bearing on executable size.

Quote:
Original post by bzroom
We had a guy apply where i was working who said "my tools have over 100k lines of code" we all just looked at each other like "wtf? our game bearly has 100k lines of code in it.."


err, tools are always more complex codewise than games are, and they typically get refactored and re-used over time (whereas portions of game code maybe re-written or re-factored).

Quote:
Original post by bzroom
More code generally is caused by duplication and that leads to brittle code and a nightmare for refactoring.


BS. You're confusing more code, with the abilities of crap developers. A decent developer would have tested and documented every single method and class they wrote. There is nothing brittle in code unless you have failed to test it.
zedz
zedz
how are you counting your lines?

Ive tried Project line counter (IIRC) + it just wont install, I tried 2 years ago on a different windows installation + I tried again a couple of weeks ago.
VS2005 just doesnt recognize it, even though its all setup in the registry + with vsvars etc
Decrius
Decrius
CodeBlocks has it all build-in ;-), really neat IDE.
[size="2"]SignatureShuffle: [size="2"]Random signature images on fora
Telastyn
Telastyn
Quote:
Original post by RobTheBloke
Quote:
Original post by bzroom
More code generally is caused by duplication and that leads to brittle code and a nightmare for refactoring.


BS. You're confusing more code, with the abilities of crap developers. A decent developer would have tested and documented every single method and class they wrote. There is nothing brittle in code unless you have failed to test it.


Even if that programmer did, the next dozen won't. Duplicated code is brittle, and will break over time as code is changed.
Matias Goldberg
Matias Goldberg
I don't want to step in into the nonsense of measuring software by their lines of codes. It has usefull applications, but you have to tell us exactly your intentions. If you just want a Good - Bad comparision, that would be nonsense. And probably discouraging.

If you're reallly interested into measuring lines of code, check out

Clock
A brief explanation in Wikipedia

Cheers
Dark Sylinc
JarkkoL
JarkkoL
Quote:
Original post by mkuhlens
Unreal Engine 3 has 2 million+ lines of code (editor included) and 100,000+ lines of unreal script.

Actually, UE3 is "only" ~1 million lines of code (excluding external libs) + ~400k lines in .uc files.

My engine is ~70k lines now (with the editor) + ~13k for tests. It's quite a baby engine still (:
JarkkoL
JarkkoL
Quote:
Original post by zedz
how are you counting your lines?

Ive tried Project line counter (IIRC) + it just wont install, I tried 2 years ago on a different windows installation + I tried again a couple of weeks ago.
VS2005 just doesnt recognize it, even though its all setup in the registry + with vsvars etc

I use Project Line Counter with VS2008. Note that it doesn't work with Express editions (because Express doesn't support plugins) and for VS2008 you have to do a registry tweak to make it work.
CodaKiller
CodaKiller
After looking at the Quake source I believe the main difference is that I out sourced a lot more. A large majority of the code in the Quake engine is a combination of collision detection / physics, math functions, wrapped OpenGL functions, Tools and I also believe they wrote their own scripting API.

Does anyone know how many lines of source code are in Ysaneya's engine? (excluding shaders, comments and external APIs )
Remember Codeka is my alternate account, just remember that!
zedz
zedz
thanks JarkkoL
strange that they never mentioned this is the installation file

FWIW my current game (see journal) has 173files (max 3000lines in a file, which is way to long)
though prolly only ~40 are actual game files (the rest are the engine)
but as other have said number of lines aint what counts, in fact the more u have the worse programmer I reckon u are (OK this is very depending on the app)
but in coding u should aim for a minimalistic approach I reckon
JarkkoL
JarkkoL
Sure, number of lines is just a ballpark figure of complexity of an app and not something you should use as the only measure of course. Worst thing you can probably do to abuse LOC figures is to measure programmer productivity. Anyway, I used to be very anti-code duplication but pushing the principle far enough has it's downside as well, and in my experience can make code maintenance also more difficult and code very hard to read & debug. So, IMHO you just have to find good balance between reuse and duplication.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.