Jump to content
  • Advertisement
Sign in to follow this  
Madolite

Lines of code language comparisons

This topic is 1413 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

Edit:

After realizing that I'm rather horrible at explaining things textually, I'm going to eventually make a video that explains what I'm talking about. I'm also going to do all of the research myself and I'll be presenting my final estimate equation in that future video. Thanks for all replies, though. I appreciate you guys taking your time.

Moderators feel free to close/lock this thread.

So, there's already a fair understanding of how efficient a language is machine-wise, but what about the other way around? Have anyone ever tried to make estimate comparisons between languages in terms of how user-friendly they are and thus, how fast a given programmer will be able to produce a given result, compared to another?

A concrete example:

Java Joe is going to write Braid in Java.
Christopher C will write it in C. (omg "will write"? Get it? LOL)
Both have the exact same writing speed, and the only difference is the language that they're writing in and perhaps the estimated amount of writing errors. Whatever IDE they're using, its strengths and weaknesses is ignored for now (because it depends on what IDEs you're using).

 

Who completes Braid first?

 

Now, I don't expect anyone to answer that, because it's too specific and may not answer the bigger context. But what I really wanna know is if anyone has ever made some estimates across a long list of coding languages and how efficient each of them are on the human level. For now, let's start with the number of characters written to produce a game.

 

One reason behind this question is something I heard from John Blow in one of his videos, that he wrote Braid in roughly 90000 lines of code. But how many characters is there in a "line of code"? and how many lines of code would it be if some other language was used (I believe Braid was written in C or C++). Because if I can write Braid in, say, 60k lines of code in Java, then that means that I could add another 30k lines of additional content if 90k lines was the launch goal I wanted to reach.

Another reason for me asking is because I'm making a game in Java and I'm rather surprised at how few lines of code I'm writing to get certain things done, even though I'm creating an engine from scratch (using only the most basic built-in methods etc and no 3rd party APIs, at least for now).

 

So are anyone here able to point me in the right direction? Thanks.

Edited by Madolite

Share this post


Link to post
Share on other sites
Advertisement

 

One reason behind this question is something I heard from John Blow in one of his videos, that he wrote Braid in roughly 90000 lines of code. But how many characters is there in a "line of code"? and how many lines of code would it be if some other language was used (I believe Braid was written in C or C++). Because if I can write Braid in, say, 60k lines of code in Java, then that means that I could add another 30k lines of additional content if 90k lines was the launch goal I wanted to reach.

 

 

Especially this :

then that means that I could add another 30k lines of additional content if

 

 

Dude you don't have ANY limit on how many lines you can write. Also you are not taking in account how much time you have to spent understanding/writing one line. Those measurements are dumb as hell and totally pointless. + you cant write Braid in java. it wont work on xbox(for example).
 

And one final thing (obviously my OWN opinion) : I really like Braid and i applaud J. Blow for his huge success, but i think that his ideas for that new programming language sucks.

Share this post


Link to post
Share on other sites

In AAA games performance is important, so C++/C will have to be the answer for low level stuff.

Big studios already have people working there who are experts in the language, and they have code from prior projects that has to be maintained, and can be reused.

There would have to be some very significant reason (besides making employees work long hours) for changing language.

 

People who are working from home in spare time have a very good reason to compare time that it takes to write a game based on language they choose.

For example I started with plain google android SDK, and spent a lot of time making a very poor engine for 3 games I did in it.

Then I moved to Corona engine ... it was way better than what I wrote.

Now I'm on Unity (I don't want to compare them, but my preference is with Unity at this point).

 

Game engines save you time, so if you're coding an engine, then you shouldn't really worry if it will take longer in Java or C, because you can just get a better engine now (unless you're expert in engines, then maybe you'll make a better more specialized engine).

 

In general, the more high-level code you have, the less time you'll spend coding. For example it's a lot easier to make a list in C#, than in C, just because there's no standard structure for list in C (yes, there's in C++, but not in C I believe).  Also if you don't have to worry about memory management, it means you will never spend time debugging a bug related to it.

 

I'm using C# in Unity, and very happy with it. Compared to how long things took me in Java in Android SDK, there's a huge difference. I don't think the difference is in C# vs Java, but rather my own engine vs. Unity (most time in Unity is spent looking up which function is appropriate, but they work very well once I find the one I need).

Share this post


Link to post
Share on other sites

Out of curiosity checked the number of lines in the source code of Sol, and um... 35252 lines right now. And it's not going to get much bigger at this point (where it's literally just getting tweaks). That's taking into account many of those lines are blank or comments, and taking into account that this includes the game and the engine (since it's custom) and the level editor (since it's integrated). I guess my code is small. The libraries it uses are a lot larger though =P

 

Then again the easiest algorithms to maintain are simple ones, and those tend to lend themselves to take up less lines of code ;) (and I'm a lazy bastard so of course I go for the lazy approach wherever I can afford it)

Share this post


Link to post
Share on other sites
There have been studies correlating LOC to bug count; TLDR is that fewer lines usually means fewer bugs. This does hit diminishing returns pretty fast, though, as you quickly reach levels of obfuscation (cough, APL) that actually make it harder to code rather than more efficient from a human standpoint.

Personally, I don't think there's anything interesting to know about languages and productivity. I just don't see any correlation. I know programmers who can churn out C++ at lightning speed and with blinding degrees of correctness on the first try; I know other programmers who can plod over C++ for hours and produce a small buggy function. Switch to, say, Python, and those two measurements actually might invert - the C++ expert getting mired in the annoyances of dynamic typing, and the slower C++ coder breezing along precisely because he can take advantage of dynamic typing.

The important factor in productivity is virtually never language. It's almost always down to the people involved. At a team level, certain team dynamics are more effective than others... for some teams. Bottom line is that there is no one size to fit all.


If you're looking to lead a team, know your people first and foremost. That is the only thing you can do that will lead towards success in the long run. It won't avoid minor failures, or even occasional massive failures, but if you don't know your people, you will get nothing but failure.

If you're curious for yourself, well, that's a different matter. Try a lot of languages and learn what works best for you. Don't get complacent, though; try bending your mind to new paradigms or thought patterns when you get a chance, because that's important for staying relevant and sharp. Just remember that the only person you can meaningfully compare yourself with is yourself.

Share this post


Link to post
Share on other sites
 

Dude you don't have ANY limit on how many lines you can write.

 

Game developers usually want to eventually release their games, and not stay in development forever. Writing 100k lines of code takes time.

 

 

you cant write Braid in java.

 

Braid is a game like any other. I can assure you that you can write it in java. But that wasn't the point of my topic.

Edited by Madolite

Share this post


Link to post
Share on other sites

 

you cant write Braid in java.

 

Braid is a game like any other. I can assure you that you can write it in java. But that wasn't the point of my topic.

 

You're taking my word out of topic.

 

You've missed :  

it wont work on xbox
Edited by imoogiBG

Share this post


Link to post
Share on other sites

Anyways, I appreciate the various feedback. For my own plans, I guess this stuff isn't too important after all. But it would've been nice to see some graphs, especially with regards to scripting languages or similar that are more light-weight, compared to the real heavy-weighters. I mean, if I could spend 1 year getting the same result as spending 2 years with another language, that's not negligible.

 

I'm doing ok with Java though, and for the bigger projects down the line I'm looking into C++.

Edited by Madolite

Share this post


Link to post
Share on other sites

You've missed :  

it wont work on xbox

 

Then pick any other two languages that work for XBOX and any other game that is possible to make for both XBOX and PC.

My example was incidental.

Edited by Madolite

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!