Jump to content
  • Advertisement
Sign in to follow this  
Fulgent

Number of lines of code for a game?

This topic is 3085 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've been looking in search engines to find out how many lines of codes there are in a game. I was thinking about looking for a programmer to help me with this game idea I had, but instead I find myself trying to figure out how code works<I feel like learning it for some reason, but I might be better off finding somebody who has already invested years into it.>

Anyways, I found that simple games might total only a mere 5,000 lines, while other games are in the millions<or some are 20,000 pages worth of lines was another measure I read.> So my question is, is there anyway to tell how many lines of code a game might have based on its genre? I would assume an RPG would have far less than a 3D action game<physics must take up a lot of lines I assume.> I'm doing this to figure out how many lines of code the game I plan to make would amount to, and how I could trim it in order to slash down its estimated development time<at least, when I have a better understanding of how it actually works>. I have heard of inefficient coding which will result in a game having excessive code for actions that would have only taken a lesser amount to do.

My other question is, how much time would it take to learn the syntax? Does programming language take as much time as learning a new language? It took me about 3 months to write a story of 82,000 words total. I type at 70 wpm on average. So if say I knew how to program, 82,000 words total would amount to what kind of game?

Share this post


Link to post
Share on other sites
Advertisement
There is no way of knowing how many lines of code it will take to create a game. This is because everyone has different coding styles, some will toss more on one line others, while me for example, will use whitespace freely to visually organize code. If you wanted to, you could write a full game on a single line.. One really long line. Also I would not care about your wpm. It is pretty useless in a coding standpoint. Because you constantly will have to back track to deal with issues you didn't see, add items to old code, and reuse old code. Coding is a process, a living process.

Share this post


Link to post
Share on other sites
It isn't about lines of code. It is true that large software projects generally take longer to complete than small projects but at the level of detail you are looking for lines of code isn't really relevant.

What's important is what exactly you want to develop and the skill of the developers.

Generally it probably isn't practical to expect to find someone to write a game for you, unless you are planning to pay that person, in which case ask them how long it will take them, have them break it down for you with milestones etc.

Share this post


Link to post
Share on other sites
Agreed that wpm is useless. You don't really need to type fast to program (although sometimes it helps) as the majority of your time will be spent in thinking/planning/debugging not writing code.

Also agreed that number of lines is useless. Regardless of number of lines how difficult/time consuming your project is depends on the project ideas. If you have never programmed before it is going to take much longer than if you have been doing it for years. Even less so if you have been programming video games for years. You did hit upon one key thing and that was finding ways to reduce the amount of code needed to be written. There are definitely various ways to do that. There are entire engines you can use, then there are various Middleware APIs that can be used to do some other more specialized tasks (engines sometimes have specific Middleware APIs built in.) Id go more into these, but there are dozens of posts on this forum about engines, free and commercial to sift through.

It is also true that some games take up more time and effort than others. In general you just need to be careful about the "scope" of your game. How much is there to do in your world, how much is new gameplay (which is typically not provided by an engine)

Share this post


Link to post
Share on other sites
Quote:
Original post by Fulgent
...
Not sure where your logic is coming from.

There is no worth to 1 line of code. There also isn't really a standard lines of code to functionality ratio. There isn't even a good way to count lines of code, since there may be different standards for counting those lines! Do empty return statements count? Do bracket styles count? What about long function signatures that are spread out to 1 argument per line for clarity, or screen spacing issues?

Even if you strip out all the white space, and remove unnecessary, optional, statements, you can't judge the functionality or complexity of a program based on line count. Code can be organized, and expressed in many different ways.

That 5,000 lines simple game you use as an example may also make use of libraries. Each of those libraries will have their own code bases which will have thousands (or millions) of lines of code of their own.

Just like in writing. The amount of ideas expressed in a few paragraphs will vary wildly between writers.

Share this post


Link to post
Share on other sites
Quote:
Anyways, I found that simple games might total only a mere 5,000 lines, while other games are in the millions<or some are 20,000 pages worth of lines was another measure I read.> So my question is, is there anyway to tell how many lines of code a game might have based on its genre?
No.

Quote:
So if say I knew how to program, 82,000 words total would amount to what kind of game?


If I knew how to write, 82,000 words total would amount to what kind of book?

If I knew math, what kind of formula would 5,000 numbers amount to?

If I knew how to build, what kind of building would 14,000 bricks amount to?


The question is simply wrong.

Share this post


Link to post
Share on other sites
Proverbs 17:27: A man of knowledge uses words with restraint, and a man of understanding is eventempered.

Generally speaking, the more code you have, the harder your project is to maintain. Sometimes a smarter, more efficient approach does take more code - but not always. LOC (lines of code) is a fairly useless metric.


Now, if you want to learn how to program, but don't think it's worth investing multiple years, pick up something like Flash (ActionScript) or a language like Python. Of course, the more time you invest, the more effective you'll become, but it's possible to create (simple) games without being too much of a programmer.

Share this post


Link to post
Share on other sites
Okay my wording was wrong. Maybe I should ask what is the standard measure for programming? I've used a game engine in the past, that's as familiar as I can with games internally. I always wondered what it must be like to be able to program? Do they automatically know the syntax and churn out lines non-stop for several hours? I guess that question is answered by the fact that it was mentioned that programmers have to back track, think, etc. This is similar to writing a story, since I had to backtrack and rewrite chapters, or sometimes I would have to stop and think of how a situation would be resolved, and things like that.

I was wondering if programming would be easier. I have no idea where I got the idea that programmers just sit there typing non-stop until this game engine just formed. It just seems like some kind of mystical, magical thing. Like once they learned the syntax, it was easy. Anyways, programmers basically make the skeleton and internals of a game, and artists and writers are just giving it the skin. So it seems like it would be the foundation of the game, and why I'm so intrigued about it.

Of course, part of the reason I haven't posted help from a programmer is because I would have to find a way to barter for their skills, whether it would be monetary or trade of talents, etc. So I've been subconsciously trying to find out about it.

Share this post


Link to post
Share on other sites
Programming is about organization and problem solving. You think long and hard about what code you will write, and then refine and optimize it. The hours spent programming does not map well to the actual lines of code you produce.

So typing speed doesn't help or hinder you while coding.

You don't just sit there, and type out some long stream of consciousness.

Also note that programs have a flow. They jump all over the place. They don't have beginnings and ends in the same sense as a linear story.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!