How many lines of code is your game?

Discussion in 'Game Development (Technical)' started by Mike Boeh, Oct 22, 2005.

  1. Mike Boeh

    Administrator Original Member

    Joined:
    Jul 26, 2004
    Messages:
    949
    Likes Received:
    0
    I used this line counter to count the lines in some of my projects (just game code- engine code NOT included), here are the results:

    Cosmo Bots / Water Bugs:
    --------------------------------------------------------
    Total number of lines: 15211
    Total number of lines of code: 12393
    Total number of empty lines: 2186
    Total number of comment lines: 604
    Total number of empty comment lines: 28
    --------------------------------------------------------


    Z-Ball:
    --------------------------------------------------------
    Total number of lines: 15943
    Total number of lines of code: 12828
    Total number of empty lines: 1950
    Total number of comment lines: 1060
    Total number of empty comment lines: 105
    --------------------------------------------------------


    Bugatron:
    --------------------------------------------------------
    Total number of lines: 13223
    Total number of lines of code: 10943
    Total number of empty lines: 1462
    Total number of comment lines: 744
    Total number of empty comment lines: 74
    --------------------------------------------------------


    Best Friends / Sponge Bob Obstacle Odyssey:
    --------------------------------------------------------
    Lines of Code: 7615
    Blank of Comment Lines: 1223
    Total Lines: 8388
    --------------------------------------------------------

    Since Best Friends was written in Blitz3D, I used the following code to count the lines:
    PHP:
    Graphics 520,340,16,2

    dir
    .Dir=New Dir
    dir
    \loc$=CurrentDir$()

    Print 
    "Counting lines..."
    While dir<>Null
    lis
    =ReadDir(dir\loc$)
    If 
    Not lis Then RuntimeError "Failed to read the '"+dir\loc$+"' directory"
    filen$=NextFile(lis)
    While 
    filen$<>""
    If KeyHit(1Then End
    Select FileType
    (dir\loc$+filen$)
    Case 
    If Right$(filen$,3)=".bb"
    Size=Size+FileSize(dir\loc$+filen$)
    file=ReadFile(dir\loc$+filen$)
    While 
    Not Eof(file)
    txt$=ReadLine(file)
    If 
    txt$<>"" And Left$(txt$,1)<>";" Then Lines=Lines+Else Blanks=Blanks+1
    Wend
    CloseFile file
    EndIf
    Case 
    If filen$<>"." And filen$<>".."
    ndir.Dir=New Dir
    ndir
    \loc$=dir\loc$+filen$+"\"
    EndIf
    End Select
    filen$=NextFile(lis)
    Wend
    CloseDir lis
    Delete dir
    dir.Dir=First Dir
    Wend

    Cls
    Locate 0,0
    Print "
    Lines of code"+Lines
    Print "
    Blank or comment lines"+Blanks
    Print "
    ---"
    Print "
    Total lines"+(Lines+Blanks)
    Print:Print
    kb#=Float#(Size)/1024
    mb#=Float#(Size)/1048576
    Print "
    Total file size"+Size+" bytes ("+Left$(kb#,Len(kb#)-4)+" kb "+Left$(mb#,Len(mb#)-4)+" mb)"
    Print:Print
    Print "
    Press any key to close."
    FlushKeys
    WaitKey
    End

    Type Dir
    Field loc$
    End Type
     
  2. cliffski

    Moderator Original Member

    Joined:
    Jul 27, 2004
    Messages:
    3,897
    Likes Received:
    0
    cool utility!
    Democracy: (not my gfx or utils lib, just game code)

    --------------------------------------------------------
    Total number of lines: 34886
    Total number of lines of code: 23876
    Total number of empty lines: 8599
    Total number of comment lines: 854
    Total number of empty comment lines: 1557
    --------------------------------------------------------

    321 file(s) processed.
     
  3. Sharkbait

    Original Member

    Joined:
    Apr 12, 2005
    Messages:
    303
    Likes Received:
    0
    Hey this tool is great :)

    Atomixer (main code):
    Code:
     Global Summary (315 KB, actual: 275 KB)
    --------------------------------------------------------
      Total number of lines:			   10580
      Total number of lines of code:	   8875
      Total number of empty lines:		 1222
      Total number of comment lines:	   477
      Total number of empty comment lines: 6
    --------------------------------------------------------
    70 file(s) processed.
    Engine Code:
    Code:
     Global Summary (341 KB, actual: 296 KB)
    --------------------------------------------------------
      Total number of lines:			   12373
      Total number of lines of code:	   10266
      Total number of empty lines:		 1636
      Total number of comment lines:	   466
      Total number of empty comment lines: 5
    --------------------------------------------------------
    107 file(s) processed.
    DRM System:
    Code:
     Global Summary (98.1 KB, actual: 86.4 KB)
    --------------------------------------------------------
      Total number of lines:			   3343
      Total number of lines of code:	   2611
      Total number of empty lines:		 411
      Total number of comment lines:	   290
      Total number of empty comment lines: 31
    --------------------------------------------------------
    32 file(s) processed.
    And this really shows that using out-of-the-box APIs and tools can really save time and effort. In my case, I could have done Atomixer in less than have the time. Trouble is, I'm never happy with ready made high-level APIs and would rather roll my own :)
     
  4. delsydsoftware

    Original Member

    Joined:
    Oct 11, 2005
    Messages:
    82
    Likes Received:
    0
    Neat tool. :)

    Brickout:

    Global Summary (288 KB, actual: 201 KB)
    --------------------------------------------------------
    Total number of lines: 10610
    Total number of lines of code: 7605
    Total number of empty lines: 1898
    Total number of comment lines: 931
    Total number of empty comment lines: 176
    --------------------------------------------------------
     
  5. Fabio

    Original Member

    Joined:
    Sep 30, 2005
    Messages:
    499
    Likes Received:
    0
    This tool is so neat that it sends your sources over the Internet. :p

    (1st of April joke in advance.. or late, dunno)
     
  6. Anthony Flack

    Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    2,176
    Likes Received:
    0
    Cool!

    Here's mine; just the game code, none of the numerous little editors, tools and peripheral data-generating widgets I wrote along the way:

     
  7. ggambett

    Moderator Original Member Indie Author

    Joined:
    Jul 26, 2004
    Messages:
    1,982
    Likes Received:
    6
    I used cat *.cpp *.h |wc -l to count lines and cat *.cpp *.h | grep "^[ \t]*//" |sort |uniq |wc -l to count comment lines (non-repeated). My results :

    Game framework : 32137 total, 263 comments
    Betty's Beer Bar specific : 16496 total, 171 comments
    Wild West Wendy specific : 28497 total, 172 comments
    Current game : 11046 total, 95 comments

    This is C++ code only. It doesn't count build scripts, ad-hoc tools, and especially not animation definitions, which is practically a language (7521 lines in WWW), nor image metadata (8697 lines in WWW, not human-generated fortunately)
     
    #7 ggambett, Oct 22, 2005
    Last edited: Oct 22, 2005
  8. Nexic

    Indie Author

    Joined:
    Nov 5, 2004
    Messages:
    2,437
    Likes Received:
    0
    My current game is 31,456 so far, I'd expect that to go up a few 1000 before finished. I'm using Blitz3D so it would be a lot more if I wasn't using that :D
     
  9. Kestral

    Original Member

    Joined:
    Oct 3, 2005
    Messages:
    74
    Likes Received:
    0
    --------------------------------------------------------
    Total number of lines: 27563
    Total number of lines of code: 17923
    Total number of empty lines: 3755
    Total number of comment lines: 3536
    Total number of empty comment lines: 2349
    --------------------------------------------------------

    I guess I tend to go a little heavy on the comments :)
     
  10. lakibuk

    Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    961
    Likes Received:
    0
    Bound Around (all in all,i ain't got no engine)
    Total number of lines of code: 7854
     
  11. Emmanuel

    Moderator Original Member

    Joined:
    Nov 23, 2004
    Messages:
    859
    Likes Received:
    0
    Atlantis:

    Global Summary (732 KB, actual: 575 KB)
    --------------------------------------------------------
    Total number of lines: 23078
    Total number of lines of code: 14717
    Total number of empty lines: 3347
    Total number of comment lines: 3438
    Total number of empty comment lines: 1576
    --------------------------------------------------------

    52 file(s) processed.


    Best regards,
    Emmanuel
     
  12. Black Hydra

    Original Member

    Joined:
    Oct 20, 2004
    Messages:
    354
    Likes Received:
    0
    It has been awhile since I've checked (and don't have it handy on this comp) but I'm guessing I've got around 30k.
     
  13. svero

    Moderator Original Member Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    3,392
    Likes Received:
    6
    Not all.. but here are a few...

    Beetle Bomp
    --------------------------------------------------------
    Total number of lines: 19259
    Total number of lines of code: 15453
    Total number of empty lines: 2817
    Total number of comment lines: 637
    Total number of empty comment lines: 352
    --------------------------------------------------------

    A Snake's Life
    --------------------------------------------------------
    Total number of lines: 15414
    Total number of lines of code: 11847
    Total number of empty lines: 2219
    Total number of comment lines: 688
    Total number of empty comment lines: 660
    --------------------------------------------------------

    Space Taxi 2
    --------------------------------------------------------
    Total number of lines: 18159
    Total number of lines of code: 12690
    Total number of empty lines: 3769
    Total number of comment lines: 544
    Total number of empty comment lines: 1156
    --------------------------------------------------------

    Halloween Heist
    --------------------------------------------------------
    Total number of lines: 2813
    Total number of lines of code: 2350
    Total number of empty lines: 346
    Total number of comment lines: 70
    Total number of empty comment lines: 47
    --------------------------------------------------------
     
  14. Pallav Nawani

    Indie Author

    Joined:
    Aug 13, 2004
    Messages:
    371
    Likes Received:
    0
    Riotball (Just the game specific code):
    Code:
    Global Summary (682 KB, actual: 576 KB)
    --------------------------------------------------------
      Total number of lines:               30165
      Total number of lines of code:       18553
      Total number of empty lines:         6115
      Total number of comment lines:       3715
      Total number of empty comment lines: 1782
    --------------------------------------------------------
    
    57 file(s) processed.
     
  15. Mark Sheeky

    Indie Author

    Joined:
    Aug 7, 2004
    Messages:
    448
    Likes Received:
    0
    Flatspace II (so far):

    ---------------------------------------------
    Total number of lines: 52512
    Total number of lines of code: 44953
    Total number of empty lines: 1038
    Total number of comment lines: 6356
    Total number of empty comment lines: 165
    ---------------------------------------------

    Mark
     
  16. Gnatinator

    Original Member

    Joined:
    Nov 23, 2004
    Messages:
    357
    Likes Received:
    0
    Outer-Rim Pod Digger (Engine is integrated into the game):

    Code:
    Global Summary (621 KB, actual: 492 KB)
    --------------------------------------------------------
      Total number of lines:               18740
      Total number of lines of code:       13059
      Total number of empty lines:         3723
      Total number of comment lines:       1884
      Total number of empty comment lines: 74
    --------------------------------------------------------
    
    115 file(s) processed.
    Looking at the other stats above, I'm not feeling bad about my code being so bloated anymore. ;) Seriously though, interesting stuff. :)
     
  17. princec

    Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    4,873
    Likes Received:
    0
    Ultratron:
    Code:
    Global Summary (195 KB, actual: 167 KB)
    --------------------------------------------------------
      Total number of lines:               7218
      Total number of lines of code:       4020
      Total number of empty lines:         871
      Total number of comment lines:       1470
      Total number of empty comment lines: 857
    --------------------------------------------------------
    
    31 file(s) processed.
    
    Titan Attacks:
    Code:
    Global Summary (165 KB, actual: 143 KB)
    --------------------------------------------------------
      Total number of lines:               6196
      Total number of lines of code:       2940
      Total number of empty lines:         835
      Total number of comment lines:       1549
      Total number of empty comment lines: 872
    --------------------------------------------------------
    
    32 file(s) processed.
    
    Mines smaller than yours, nyah nyah etc.

    Oh, and here's the library code (hiscores, UI, sprite engine, game init, etc.)
    Code:
    Global Summary (1.03 MB, actual: 919 KB)
    --------------------------------------------------------
      Total number of lines:               36674
      Total number of lines of code:       17699
      Total number of empty lines:         4369
      Total number of comment lines:       9644
      Total number of empty comment lines: 4962
    --------------------------------------------------------
    
    195 file(s) processed.
    
    Cas :)
     
    #17 princec, Oct 23, 2005
    Last edited: Oct 23, 2005
  18. HarmonicFlow

    Original Member

    Joined:
    Jun 5, 2005
    Messages:
    27
    Likes Received:
    0
    Current project (not finished / optimized yet), just gamecode:
    --------------------------------------------------------
    Total number of lines: 23610
    Total number of lines of code: 15896
    Total number of empty lines: 2575
    Total number of comment lines: 3421
    Total number of empty comment lines: 1718
    --------------------------------------------------------
    57 file(s) processed.
     
  19. Ande

    Original Member

    Joined:
    Oct 10, 2005
    Messages:
    6
    Likes Received:
    0
    Turbo Sliders takes the lead :). It has been a hobby project for me for a long time and the game is already much bigger than it looks. Code is written in C, using SDL, no fancy high-level engines or libraries in use. Network support also adds lots of code (maybe roughly 30 % of the code is more or less network game related).

    Total number of lines: ~90k
    Total number of lines of code: ~70k
     
  20. Eric Lengyel

    Original Member Greenlit

    Joined:
    May 19, 2005
    Messages:
    10
    Likes Received:
    1
    Here are the C4 Engine stats as of October 23, 2005:

    Global Summary (4.8 MB, actual: 4.11 MB)
    --------------------------------------------------------
    Total number of lines: 181308
    Total number of lines of code: 127650
    Total number of empty lines: 37847
    Total number of comment lines: 11418
    Total number of empty comment lines: 4393
    --------------------------------------------------------

    289 file(s) processed.

    Engine code makes up about 78% of the total -- game code and tool plugins make up the rest.
     

Share This Page

  • About Indie Gamer

    When the original Dexterity Forums closed in 2004, Indie Gamer was born and a diverse community has grown out of a passion for creating great games. Here you will find over 10 years of in-depth discussion on game design, the business of game development, and marketing/sales. Indie Gamer also provides a friendly place to meet up with other Developers, Artists, Composers and Writers.
  • Buy us a beer!

    Indie Gamer is delicately held together by a single poor bastard who thankfully gets help from various community volunteers. If you frequent this site or have found value in something you've learned here, help keep the site running by donating a few dollars (for beer of course)!

    Sure, I'll Buy You a Beer