How Many Lines of Code in a Commercial Game?

Started by
17 comments, last by Spindle 22 years, 8 months ago
I can guarantee you that the projects with numbers in the millions of LOC are adding in not just normal engine/gamelogic code, but also specific game scripts. Yes I know some people will argue "but it''s still code!", but I still have a problem with it.

People can take code-driven or data-driven approaches to all sorts of different problems. Plenty of specific scripted situations can be done both in code-driven form (via a simple scripting language), or in a data-driven form (some kind of dialog-box-based thing that indicates the actions that occur at certain times in a tabular manner). I reminded myself of this recently when doing some skeletal animation work.

Adding in script code that handles common/essential game logic (like damage or weapon control or primitive AI or whatever) is fine, and that should certainly count in terms of LOC. But scripts for things like "on level 3 I want this guy to play this sound and then run to this point over here" should certainly *not* count, because in theory the same thing could be done in a data-driven manner, and you wouldn''t add data into an LOC count.

I''m pretty certain if you took out all the LOC for these kinds of scripts, the LOC count would drop back out of the stratosphere into something more in line with the rest of the projects.
Advertisement
Am I the only one that doesn''t see "2 million lines" worth of AI in Black and White? Honestly, the AI didnt impress me at all. It may have been using all sorts of mathematical mumbo jumbo, but in the finished product, you get a creature that can learn to poop on villages. The whole environment of black and white isn''t very versatile at all, and there isn''t all that much possibilities for the creature to do stuff. I really think the AI code was an ego trip, they could have accomplished much of the same with far less code and a simpler approach. Isn''t that what game programming is anyway? Taking shortcuts that allows us to do stuff that traditionally requires far more complex methods?

This is kind of off topic, I know but I really think Black and White wound up wasting a huge amount of development resources for what it accomplished.
BetaShare - Run Your Beta Right!
quote:Original post by LordElectro
Am I the only one that doesn't see "2 million lines" worth of AI in Black and White? Honestly, the AI didnt impress me at all. It may have been using all sorts of mathematical mumbo jumbo, but in the finished product, you get a creature that can learn to poop on villages. The whole environment of black and white isn't very versatile at all, and there isn't all that much possibilities for the creature to do stuff. I really think the AI code was an ego trip, they could have accomplished much of the same with far less code and a simpler approach. Isn't that what game programming is anyway? Taking shortcuts that allows us to do stuff that traditionally requires far more complex methods?

This is kind of off topic, I know but I really think Black and White wound up wasting a huge amount of development resources for what it accomplished.


Not all of it was AI, there was scripting, sound, graphics, and that sophisticated "gesture" system also. Compared to the billions of "instructions" our brain processes per second I'd reckon that they did an okay job. The ai is better later in the game, too. At the beginning all you have is one dumb creature.

Oh, and you can bet that it's not 2,000,000 lines of C code. No doubt they added quite a bit of assembly as well.


Edited by - gph-gw on August 2, 2001 9:31:51 PM
quote:Oh, and you can bet that it''s not 2,000,000 lines of C code. No doubt they added quite a bit of assembly as well.


What makes you certain they added quite a bit of assembly? You know, compilers are pretty darn good these days, and processor pipeline issues are getting more and more complicated to where a person has a hard time knowing all the rules all the time.

Where do you think any significant amount of assembly was used? I mean, I used to love working in assembly, but the reality is there simply isn''t enough of a need for it anymore except in the most extreme inner loop cases (and those inner loops are inherently small in size and thus don''t require "quite a bit" of assembly). Not only that, but projects these days are so expensive to develop that the extra time (and resulting cost) to put a large chunk of code into assembly, and maintain it thereafter (maintaining being the difficult part) generally overrides any possible speed gain you might hope to achieve.

A few small inner loops? Okay. Large chunks? Heck no.
Well, with a game with a budget like Black and White it would make sense to use some assembly, like you said. But have you ever actually carefully examined output from VC++? It''s not the same quality thet you could get with fine, hand tuned asm. Certainly, since the source is closed, we aren''t going to know until they decide to release it, if they ever release it. It also uses MMX and possibly SSE or 3DNOW, right? So unless they used the intel c/c++ compiler they''ve used asm. And it''s best if the code is uniform, right? So therefore it makes sense if they use a good amount of assembly. You''re right in that most of the code is not asm because if not then it would be a $20 million and take 5 years.

There''s no evidence either way, so we could post about it until our ears bleed without getting anywhere.

And you could argue that a few small inner loops could constitute "quite a bit of asm".
quote:and that sophisticated "gesture" system also


Someone posted a gesture recognition program somewhere around here a couple of months ago. The recognition core fit in a single page of code. So unless Lionhead did something massively different, that''s not really contributing to the 2 million lines of code
quote:Original post by gph-gw
And it''s best if the code is uniform, right? So therefore it makes sense if they use a good amount of assembly.

That''s a very bizarre argument. They''re not going to have coded a lot of it in assembly just because it would make the code uniform. They''re going to want as much of the code as high-level as possible, because it is easier to understand and debug, with any assembly used only in the very tight loops. Remember the Pareto Principle in this context: 80% of the execution time is spent in only 20% of the code. The Lionhead guys are smart, realise this, and wouldn''t waste time on using assembly where a high level language would do. A lot of games released these days don''t even have a single line of assembly. So it makes sense to assume there was no or little assembly unless there''s evidence to the contrary.

What I meant by uniform code is that it''s clean, not sloppy, and that everybodys code works together very well. I didn''t mean they coded everything in assembly just because a bit of it was.

I would believe that in a 2,000,000 line game there would be a larger number of tight code spots than in a 500,000 line game. So they would optimize those sections of code further. Especially since they spent so much time on it, perfecting it. I''m able to run it at semi-high quality and I don''t have a super fast computer. That suggests there''s some kind of optimization.

quote:Original post by gph-gw
Not all of it was AI, there was scripting, sound, graphics, and that sophisticated "gesture" system also. Compared to the billions of "instructions" our brain processes per second I''d reckon that they did an okay job. The ai is better later in the game, too. At the beginning all you have is one dumb creature.

Oh, and you can bet that it''s not 2,000,000 lines of C code. No doubt they added quite a bit of assembly as well.


Edited by - gph-gw on August 2, 2001 9:31:51 PM


The two million was in quotes for a reason

The point is that the AI of BW has become such a big deal and supposedly took huge amounts of time. However the end result is a creature that no matter how much you train it, wont really be all that exciting and neat. Okay, so it will poop on the villagers. Yea, you can make some complex AI mumbo jumbo, or you could just write a few simple lines of code so that sometimes the creature will decide it''s a good idea to poop on the villagers and eventually be trained out of it using a system similiar to that of the Windows/Office menus where only the stuff you use often is shown. All you need is some counters and bit of randomness. I''m sure that scientifically speaking, the AI in BW is amazing, but it''s a huge waste because the game world it was placed in is extremely limited. It has some trees, some rocks, some villagers, some wood, and that''s about it. And those things can be used in very limited ways. So what you wind up with is a lot of code that has gone to waste, while critical aspects of the game were made oversimplistic (likely because they wound up with no time to make them better) and very limited gameplay.

Lionhead fell into the trap of using all this advanced stuff, and wound up with a huge game significantly less fun than PacMan. That should tell you something about where gaming is going :/
BetaShare - Run Your Beta Right!

This topic is closed to new replies.

Advertisement