How Many Lines?

Discussion in 'Community Chat' started by Kezarus, Jun 15, 2019.

  1. Kezarus

    Kezarus Member

    Joined:
    Jan 14, 2018
    Posts:
    163
    I was wondering how many lines of code my games have and and got this handy dandy script from @Tsa05 this from this thread.

    On your project directory (where the .yyp or .gmx file are located), create a .txt file, put the code below inside, save as .bat and double click it.
    Code:
    @echo off
    
    :CountLines
    setlocal
    set /a totalNumLines = 0
    for /r %1 %%F in (*.gml) do (
        for /f %%N in ('find /v /c "" ^<"%%F"') do set /a totalNumLines+=%%N
        echo|set /p= "."
    )
    
    echo .
    echo Total number of code lines = %totalNumLines%
    echo Making progress!
    pause
    My project lines are:
    OverKill, a top-down scrooling shooter: 1.856 lines
    Endless RPG, a turn-based combat in a living random world: 12.234 lines
    Shooter, proof of concept that I slap some code in 4h: 37 lines

    How much lines are your games? =]
     
    Last edited: Jul 27, 2019
    fireday2 likes this.
  2. JackTurbo

    JackTurbo Member

    Joined:
    Oct 19, 2016
    Posts:
    823
    My main project A Day In Valhalla is sat at about 8398 lines apparently.

    I'm guessing its including comments and unused scripts? I've got a few old systems that are simply commented out and a whole folder of old unused scripts, which I reckon are inflating that number a fair bit.
     
    Kezarus likes this.
  3. EvanSki

    EvanSki King of Raccoons

    Joined:
    Apr 17, 2018
    Posts:
    575
    Kezarus likes this.
  4. Nocturne

    Nocturne Friendly Tyrant Forum Staff Admin

    Joined:
    Apr 13, 2016
    Posts:
    6,840
    Skein - 26536
    Alpha Dog (current Project) - 16133

    For a such a small seeming game, alpha dog is pretty big!

    :)
     
    Kezarus likes this.
  5. nacho_chicken

    nacho_chicken Member

    Joined:
    Jun 21, 2016
    Posts:
    334
    Eysir (WIP) - 8282 (so far)
    Tried to run Simov through this, but it seems the batch file won't catch object code from GMS1 projects. Most likely due to the code being inside .gmx files. Would be really hard to separate the xml tags from the GML code.
     
    Kezarus likes this.
  6. Andy

    Andy Member

    Joined:
    Jun 20, 2016
    Posts:
    185
    I’m actually surprised GMS2 doesn't have a built-in system to count code lines.
     
    Kezarus likes this.
  7. GMWolf

    GMWolf aka fel666

    Joined:
    Jun 21, 2016
    Posts:
    3,390
    Line count is a fun metric, but I think its worth mentioning it is by no way a good indication of quality or work put into a project.
    You could spend weeks working on a complex system that only ends up being a couple thousand well written lines.

    Equally you could spend weeks on something like writing missions/campaign whatever and end up with far more code, that wasn't hard to write, but required many simple lines of code.

    My largest GM project i have on my disk now is 1300 LoC. tiny! I wonder how I have any credibility at all at this point.
    largest personal game project is like, 6000 locs. Also relatively small. Does it do more than the GM project? well it was actually a port of the game, feature parity, but 5x the code. It did solve my performance issues though.
    University team project ended up being around 100k lines of code. Now we are getting somewhere! that really was a large project for me... I ended up writing about 30k lines for that. wow...
    Does that project do more than my personal project from before? of course it does! does it do 17x more? eeeh, no. As teams grow, as projects grow, code grows exponentially.
    The AAA project I work on now? Ha! we are talking about terabytes of data! Uncountable! running a script to find out would take all day! oh but should i? yeah, im curious now...
    But at this point the scale is getting really big... its completely incomparable to the previous projects I worked on. I probably contribute around 500-1000 locs on a good week. Way less than I do on my own projects over the weekends!
    Does that mean I work more over the weekend then I do during the week at work? probably not.
    well that went on a bit of a tangent. Hope it doesn't seem like a weird flex.

    Please don't let that keep you from posting figures! its interesting !

    I'm actually quite impressed by how compact, in terms of lines of code, the games you all are working on end up being! I guess that's the advantage you get from working with GM :)

    p.s. annotating with tiny text is my new favourite thing...
     
    Last edited: Jun 16, 2019
    Filkata, Lonewolff, Kezarus and 4 others like this.
  8. nacho_chicken

    nacho_chicken Member

    Joined:
    Jun 21, 2016
    Posts:
    334
    Definitely agree with all of this. This topic is more "just for fun" for me.
     
    Pfap and Kezarus like this.
  9. EvanSki

    EvanSki King of Raccoons

    Joined:
    Apr 17, 2018
    Posts:
    575
    technically
    its not against the forum rules sooo, just make every text ever this small, *TINY HIGH PITCHED EVIL LAUGHS*
     
    Kezarus and GMWolf like this.
  10. Nocturne

    Nocturne Friendly Tyrant Forum Staff Admin

    Joined:
    Apr 13, 2016
    Posts:
    6,840
    I would suggest that you READ the forum rules then...

     
    Binsk, EvanSki, Kezarus and 2 others like this.
  11. Kezarus

    Kezarus Member

    Joined:
    Jan 14, 2018
    Posts:
    163
    I use GM Studio 1.4. Just copy your .bat into the .gmx folder and voilà. =]

    Yeah! It's fun to see how efficient some games are.

    I don't know that. I use GM Studio 1.4 and it doesn't have this mechanism. I don't think it's that important (by the reasons @GMWolf said) and just go about this 'cause my brother (the other game designer) want to know this info.

    I love to do procedurally generated games and this probably shrink the level desing side.

    Keep on posting. This is very interesting so far. =]
     
    GMWolf likes this.
  12. EvanSki

    EvanSki King of Raccoons

    Joined:
    Apr 17, 2018
    Posts:
    575
    It only says LARGE SIZE of the text
     
    Kezarus likes this.
  13. nacho_chicken

    nacho_chicken Member

    Joined:
    Jun 21, 2016
    Posts:
    334
    Pretty sure "excessive formatting" covers only using small text. ;)

    EDIT:
    The .bat file only goes through .gml files. See the following line:
    Code:
    for /r %1 %%F in (*.gml) do (
    In GMS1, all object code is stored inside .gmx files, which appear to be xml files. The only thing that uses .gml files are scripts. If you just add *.gmx to the .bat, you're going to get a lot of false lines added to the number because of all the tags and also because basically every single resource is a .gmx file. If you move the .bat into the "Objects" folder of a GMS1 project, you'll notice you get 0 lines.
     
    Last edited: Jun 16, 2019
  14. EvanSki

    EvanSki King of Raccoons

    Joined:
    Apr 17, 2018
    Posts:
    575
    Delving into it and how the batch file works it takes the .gml file lets say
    Code:
    if (pinapples == 1)
    {
         game_end();
    }
    it would count that as 4 lines of code. noting this only reads .gml files, so basically you can do this your self with out a batch file by opening each .gml in a text editor......so in short it has its flaws, how ever we can edit this by adding in some filters when deciding whats a line and whats not, along with what type of files to read.
     
    Kezarus likes this.
  15. Lonewolff

    Lonewolff Member

    Joined:
    Jan 8, 2018
    Posts:
    1,150
    :p
     
    Last edited by a moderator: Jun 16, 2019
    EvanSki likes this.
  16. Kezarus

    Kezarus Member

    Joined:
    Jan 14, 2018
    Posts:
    163
    Hmm, how can this script be written better then? With DOS command lines could be a challenge. I can write something in C# if you tell me the rules, but maybe it will be a little bit overkill.
     
  17. EvanSki

    EvanSki King of Raccoons

    Joined:
    Apr 17, 2018
    Posts:
    575
    It depends on how much effort you really want on this as the current one "works"
    But if you wanted to go over kill

    I wouldnt count lines that are just {}
    In .gmx files it needs to cut out all the stuff that isnt code with the same filters of taking out {} lines

    You can do it in batch just it wouldnt be fast nor good
     
  18. Lonewolff

    Lonewolff Member

    Joined:
    Jan 8, 2018
    Posts:
    1,150
    [​IMG]

    6 lines, properly formatted, no drag and drop, longest line is 83 characters.

    Probably blow out to 10 lines when I'm finished.

    I must be doing it wrong :p
     
    nacho_chicken and GMWolf like this.
  19. sitebender

    sitebender Member

    Joined:
    Sep 13, 2016
    Posts:
    804
    According to a different line counter, my first game is around 200,000 lines of code.
    According to this line counter it has 89,000+ lines.

    Then again I tend to code:
    Code:
    if(this)
    {
    this = that;
    }
    My current game has... 138,000+ lines. I thought the line counter was stuck in a loop or something, it just kept going for a full screen of ................

    Then there are these four:
    https://sitebender.itch.io/alienvania has 5,400 and that's surprising.
    https://forum.yoyogames.com/index.php?threads/cloud-cover-a-simple-shmup-play-it-now.54689/ has 5,100
    https://forum.yoyogames.com/index.php?threads/16-bit-ish-penguin-platformer.46149/ has 19,000
    https://forum.yoyogames.com/index.p...evel-editor-modified-larger-explosions.33086/ has 22,000

    The interesting thing of those four is the first two are 1 month projects. One was a 10 day game jam, but the engine took a month then the second was a 3 day game jam that then went on for a month.
    The latter two are long term, 6 month projects and they ballpark around the same amount.
     
    Last edited: Jun 18, 2019
  20. 00.Archer

    00.Archer Member

    Joined:
    Jul 24, 2018
    Posts:
    56
    I'm currently working on a project that has ~7.2k lines of code.
    There's also a much more complex one which has ~23k lines currently.
    Both are being made with GMS1.4.
     
  21. Yal

    Yal GMC Memer GMC Elder

    Joined:
    Jun 20, 2016
    Posts:
    3,551
    OKAY, GOT IT, WILL DO MY BEST TO FOLLOW THE RULES FROM NOW ON



    (sorry, couldn't resist :p)
     
    Kezarus and GMWolf like this.
  22. lorcanarie

    lorcanarie Member

    Joined:
    Jul 7, 2019
    Posts:
    1
    I’m actually surprised GMS2 doesn't have a built-in system to count code lines.
     
  23. RefresherTowel

    RefresherTowel Member

    Joined:
    Jul 13, 2016
    Posts:
    1,210
    I'm sitting at around 7.3k lines for Floramancer right now. I'd guesstimate wildly about another 7k or so left until it's finished. I think I'm nailing down about 250 lines per day at my current rate. If only my quality matched my quantity.
     
    Kezarus likes this.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice