Projects => Discussion => Topic started by: Aero88 on March 18, 2017, 03:56:18 pm

Title: Lines of Code
Post by: Aero88 on March 18, 2017, 03:56:18 pm
So I have been working on my game Tank Tactics for a long time.  Out of curiosity I downloaded a

"Line of Code" calculator: https://forum.yoyogames.com/index.php?threads/lines-of-code-counter.3307/ (https://forum.yoyogames.com/index.php?threads/lines-of-code-counter.3307/)

Here are my results

   Lines: 15548
   Empty lines: 2491
   Characters: 270917

   Lines: 90
   Empty lines: 15
   Characters: 2007

   Lines: 71793
   Empty lines: 4802
   Characters: 1897633

   Lines: 7003
   Empty lines: 703
   Characters: 200936

   Lines: 94434
   Empty lines: 8011
   Lines (excluding empty lines): 86423
   Empty lines ratio (empty lines/lines): 0.08
   Characters: 2371493
   Characters per line: 25.11
   Characters per line (excluding empty lines): 27.44

I found this to be quite high.  Some of those lines are comments I believe...  At least I'm not sure if the calculator takes them out or not.  But I have apparently made a game with more characters than many novels.  Keeping in mind this project has spanned about 4-5 years of development.

I was curious how many lines of code you guys typically have in your projects?
Title: Re: Lines of Code
Post by: LorentzChronon on March 18, 2017, 05:55:59 pm
Typically our projects at work range from 50,000 to 200,000 depending on the scope. We've had compiled javascript files (ES6 compiled into browser standard JS) be over 100,000, so if we factor in the backend it probably adds another 20-50k on average.
Then again these are company projects so I feel it's a lot more work for a single individual to get 15k lines like you did. So bravo!

Edit: Just realized I was reading the numbers wrong, that 15k was just for rooms alone! 95k total for an individual project is insanely awesome! Bravo
Title: Re: Lines of Code
Post by: Rayo on March 18, 2017, 06:00:56 pm
These are my results for Echoes of Aurelia/Zelda Online engine. (I imported it from GM8 to Game Maker Studio, so I got a lot of errors, but I think that doesn't matter for the count).
The engine has a lot of scripts, so I got almost 3 times more code in there than your project. Instead, the code written on objects is 5 times less.

   Lines: 2547
   Empty lines: 252
   Characters: 37289

   Lines: 0
   Empty lines: 0
   Characters: 0

   Lines: 14299
   Empty lines: 1336
   Characters: 304893

   Lines: 20807
   Empty lines: 1747
   Characters: 451484

   Lines: 37653
   Empty lines: 3335
   Lines (excluding empty lines): 34318
   Empty lines ratio (empty lines/lines): 0.09
   Characters: 793666
   Characters per line: 21.08
   Characters per line (excluding empty lines): 23.13
Title: Re: Lines of Code
Post by: Martijn dh on March 18, 2017, 06:59:05 pm
Interesting download. Thanks!

Here are the stats for Horn of Balance (8+ years).
To be fair: I use A LOT of comments for in engine descriptions. Also, I spend way too much time going over old code and simplifying it.

   Lines: 24763
   Empty lines: 1878
   Characters: 854459

   Lines: 114
   Empty lines: 15
   Characters: 2581

   Lines: 514
   Empty lines: 12
   Characters: 20644

   Lines: 73149
   Empty lines: 10111
   Characters: 1941392

   Lines: 98540
   Empty lines: 12016
   Lines (excluding empty lines): 86524
   Empty lines ratio (empty lines/lines): 0.12
   Characters: 2819076
   Characters per line: 28.61
   Characters per line (excluding empty lines): 32.58
Title: Re: Lines of Code
Post by: Aero88 on March 18, 2017, 07:21:53 pm
Ah these results are rather interesting!

@ Martin dh:
Ah.  It is cool to see how programming habits differ.  The overall scale of our projects seem to be similar.  However the majority of my coding by far is in the objects whereas the majority of your code is script driven.

I also have a great deal of comments as I find it to be invaluable when tracking down my thoughts later on.  I also am not entirely sure where the lines of coding from the shaders category are coming from as I do not specifically recall using shaders, but I do have some graphical effects that might be related to the shaders.

You also seem to have on average more characters per line of code.  Which makes since because our lines (excluding empty lines) is almost identical.  Very interesting!

@ Rayo
Yeah shouldn't be any different just from an import.  Seems we share rather similar characteristics when it comes to white space usage.  .08 to .09

I have had a tendency to shy away from script usage because I had read at one point that they ran a little slower than code embedded in objects.  That was a long time ago though and may not be the case at all especially with Studio.

@ LorentzChronon
Thanks!  It has been lot of work, but a lot of fun too.  I have learned a ton during the process!  A lot of the room code is somewhat repetitive though as it is basically setting up specific object entity settings and room specific benchmarks for achieving gold, silver or bronze medals when playing.

edit:  It would be interesting if it also produced a count for the resources.  I know I have a lot of sprites and sound files as well.
Title: Re: Lines of Code
Post by: MG-Zero on March 20, 2017, 01:08:12 pm
You can honestly expect there to be a high number of lines of code, especially for a game.  Remember less code doesn't necessarily mean better code ;)
Title: Re: Lines of Code
Post by: Aero88 on March 30, 2017, 04:09:55 am
Remember less code doesn't necessarily mean better code ;)

Ah.  I hope that is not how I came across.  I was certainly not trying to compare quality of code.  Just a difference in style.  Looking at the numbers alone doesn't say anything of ones abilities.  I have a great deal of respect for the effort that goes into the projects here.

Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved