Script Line Counter


#1

If you are ever wondering how many lines of code your game has, try out this plugin I wrote.

I found out my game is 13000 lines of code, in total O.o

Usage:
Press button, and total lines of code is output to console.


#2

I think this could go in #learning-resources:community-tutorials-resources

Still though, this is a wonderful plugin!


#3

Moved, thanks!


#4

Here’s another plugin that does the same job, courtesy of @Crazyman32.


#5

Was using Crazyman’s but hey, its fun to make your own plugins


#6

Huh, didn’t know about this.

Looks like it has a nicer gui though, so use it instead!


#7

If you’d like to improve upon crazyman32’s plugin, you could consider adding a logical lines of code measurement.


#8

Well I might as well add it! SLOC is a good stat to have.

I want to rebuild the UI anyway using plugin gui.


#9

So now might be a good time to say this:

I took some of my most used old plugins and remade them to use PluginGuis…
Which included @Crazyman32’s LoC plugin.

Rather than be selfish and keep it saved locally, I’ve just now published it.

The code inside clearly credits CrazyMan32, as does the plugin description, so I hope there’s no problem.

Edit for clarification: I didn’t just drop it into a widget, but rather I remade the GUI from scratch, and therefore had to reprogram it to work with mine. I remade the script, but the core functions were copy pasted.


#10

What do people use a script line counter for? I can understand a brick counter, but not a script line counter. I could certainly salvage it to see what kind of code or string patterns you’re using though.


#11

It’s mainly for curiosity’s sake.

Lines of code doesn’t really tell you much overall though


#12

So you can show-off to your peers.


#13

Since I made the plugin, here’s my reasoning:

Seeing “lines of code” (i.e. LOC) is a useful stat in terms of getting a rough understanding of a project’s size. For instance, if a project has only 300 LOC, you can guess that it’s probably a pretty simple application. However, if it has 10,000 LOC, then it’s probably pretty complex.

Another reason is that you can track code size progress. Ideally, a project should increase in code size rapidly, and slowly slow down. You should roughly see a logarithmic dropoff in code growth over a project’s lifetime.

If there isn’t a logarithmic dropoff, it might indicate something such as:

  • The underlying code is not flexible enough to allow additional features
  • Large features are still being implemented later on in a project’s life
  • etc…

One misconception is that lots of code is good. I would argue otherwise: You should try to keep your codebase as small as you can. Reuse as much as possible; don’t duplicate. Use a good framework. Allow communication between your code without major coupling. The more code you have, the harder it is to maintain.

All that being said, it can be a fun bragging point. For instance, the Curiosity Mars Rover has over 2.5 million lines of code, which is pretty cool.


#14

Pretty incredible that they managed 2.5 million lines, especially given their incredibly stringent coding and testing standards.


#15

Can you imagine how horrible debugging 2.5M loc must be :sweat_smile:


#16

that must be fun!