1. Hey! Guest! The 35th GMC Jam will take place between November 28th, 12:00 UTC - December 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

How Many Lines?

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

  1. Kezarus

    Kezarus Member

    Joined:
    Jan 14, 2018
    Posts:
    169
    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
    ParodyKnaveBob and fireday2 like this.
  2. JackTurbo

    JackTurbo Member

    Joined:
    Oct 19, 2016
    Posts:
    824
    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:
    580
    Kezarus likes this.
  4. Nocturne

    Nocturne Friendly Tyrant Forum Staff Admin

    Joined:
    Apr 13, 2016
    Posts:
    6,988
    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:
    406
    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,464
    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
  8. nacho_chicken

    nacho_chicken Member

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

    EvanSki King of Raccoons

    Joined:
    Apr 17, 2018
    Posts:
    580
    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,988
    I would suggest that you READ the forum rules then...

     
  11. Kezarus

    Kezarus Member

    Joined:
    Jan 14, 2018
    Posts:
    169
    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:
    580
    It only says LARGE SIZE of the text
     
    Kezarus likes this.
  13. nacho_chicken

    nacho_chicken Member

    Joined:
    Jun 21, 2016
    Posts:
    406
    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:
    580
    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,207
    :p
     
    Last edited by a moderator: Jun 16, 2019
    ParodyKnaveBob and EvanSki like this.
  16. Kezarus

    Kezarus Member

    Joined:
    Jan 14, 2018
    Posts:
    169
    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:
    580
    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,207
    [​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
     
  19. sitebender

    sitebender Member

    Joined:
    Sep 13, 2016
    Posts:
    835
    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
    ParodyKnaveBob likes this.
  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,881
    OKAY, GOT IT, WILL DO MY BEST TO FOLLOW THE RULES FROM NOW ON



    (sorry, couldn't resist :p)
     
  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,217
    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.
  24. Desert Dog

    Desert Dog Member

    Joined:
    Jul 30, 2019
    Posts:
    40
    Thought you guys might find this as an interesting bit of trivia, and maybe a reference point for your own projects,

    According to the old GM website, back when GM was still a one-man band (GM6), it was about 40,000 lines of code, with another 40,000 for the runner.
    Source

    Although I imagine it's ballooned out a little bit over the years as the YYG's team have been working on it!
     
    ParodyKnaveBob likes this.
  25. Yal

    Yal GMC Memer GMC Elder

    Joined:
    Jun 20, 2016
    Posts:
    3,881
    No, it was over 40,000 lines of code... no qualifiers that narrows down how much. So technically this statement still holds:
    It was over 40k lines of code back then; these days, it's also over 40k lines of code. Probably over 40k with a longer shot, but it's really all we can say with the current information :p
     
    Desert Dog likes this.
  26. Desert Dog

    Desert Dog Member

    Joined:
    Jul 30, 2019
    Posts:
    40
    Nerd. :rolleyes:

    This somehow does remind me of someone I use to work with who had a job interview. The interviewer asked how big his current project was, and he replied that it was about 'one GB' in just code, and went on to talk about how huge the project was. After the interview, he went back to check how close he was. The project was about 100mb. Close enough. (He did get the job).

    I'm actually wondering about this.

    Based on the original source, what Mark referred to as GameMaker seemed to just be the IDE (Runner excluded).

    GUI programming tends to get the most bloated, so you'd think with the new GM GUI it would be a factor larger. But remembering that Mark wasn't really a GUI engineer, and GM's old UI was just something he whacked up in his spare time. I wouldn't be surprised if with a bit of good engineering GM's GUI's kept close enough to 40k.

    The actual runners themselves.. well, we've got multiple to look at. I'd even hazard a guess the javascript runner's even less lines of code, new feature aside. Javascript is a really concise language.. and 'canvas' graphics set up is just a few lines, as opposed to what I would guess would have originally been hundreds of lines to handle Windows, and it's various quirks.

    Android runner, being java-ish, and having to back-ward support a bunch of different OS's, is probably bloated as heck.
    iOS runner might be pretty tight, because so few systems it has to work on.
    Windows... now that is probably 4x bigger than it was originally. ;)
     
  27. Lukan

    Lukan Gay Wizard Freak

    Joined:
    Jun 20, 2016
    Posts:
    396
    Well, the current version of Homestead in GMS2 sits at 19161 currently, as I am actively writing more scripts.
    The old GMS1 code sits at 66165... A lot of that was bloat I cleaned out a year or so ago, hence the smaller number now.
     
  28. Yal

    Yal GMC Memer GMC Elder

    Joined:
    Jun 20, 2016
    Posts:
    3,881
    I'm currently working on a metroidvania engine... I'm doing everything super barebones, but it's still getting pretty huge! I've worked on it since february. Almost 41k lines of code...
    upload_2019-10-8_19-42-44.png
     
  29. Coded Games

    Coded Games Member

    Joined:
    Jun 20, 2016
    Posts:
    420
    Thought I'd give it a try on my last two projects.

    My on going large project Decks of Dexterity: 33269
    My latest Hour of Code game Cloud Constructor: 3288

    That's the difference a week compared to over a year of working on a project.
     
  30. JeffJ

    JeffJ Member

    Joined:
    Jun 20, 2016
    Posts:
    342
    Current side project, which is small in scope and ambition, and about 20% done content wise:
    6889

    Main project, which is my biggest project to date and has been in development on and off since 2011, all the way from GM8 > GMS1 > GMS2:
    66147

    But to be fair, that one has a lot of bloat and is a bit of a mess, with all sorts of delicious legacy stuff and simply just bad coding. I'd wager maybe around 20k lines could theoretically be removed/refactored/optimized away and it'd still work - but that would take way too long at this point, and this is one of those cases where it's better to just finish it (as it's actually in production/content development stage too) and then learn from mistakes in the next from scratch project.

    EDIT:
    Just tried it on the most recent source of Spoiler Alert too, which on top of the base game and all its platform specific code for mobile and Steam, also has more recently added code for Switch and Xbox One:
    48037
     

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