Hello, i always mades short scripts around 150-200 lines. But when i see other developpers or open source modules, I see 500-2000 lines of code, with nested modules etc. Does that mean that i just suck at coding?
No. Script length means nothing. Good scripts can be short or long. Bad scripts can be short or long. Length literally doesn’t matter.
Well, unless you have 10 thousand lines to do something that can be done in one thousand. Then that’s bad. But, I think you get my point.
Usually packages are one script, for example jecs is one script with thousands of lines. Because jecs is designed to be extremely fast Entity Component System, so it avoids all the requires and nested modules.
Another example of that is Text+. I recall Alexander saying he didn’t want to split the library into multiple modules for that exact reason.
“Best scripters write terrible code, but know why they’re doing so” - your goal is not to be a coder, but game developer, and players don’t care about the code, they never see the code, they see that they can open gui and fun sound plays
If you ask about code lenght - if it works then nice, but if you can make it shorter then it’s better, long modules are usually lazy solutions or outdated solutions to complex problems that were for general use, not specific use case, so don’t worry about code lenght, but rather about if your game is fun
So you are telling OP to be a bad coder on copium? Almost got me first half, nice try.
i mean as long as its optimized and it works hes right
Code length matters not.
Compiled code’s performance is what does matter.
You can’t really generalize or compare code length to how good code is because by just saying that, you instantly declare inlining and caches as your enemies.
but luau isn’t even a compiled language
I don’t tell him to be bad coder, rather that to be game developer, code isn’t important if you can’t make a game, so instead of creating OOP framework to print hello or move part, he should focus on getting his game done, and if he sees the players like the game, then he can think of rewriting it or making it have cleaner code
I’m talking about bytecode that gets produced, obviously.
Also, Luau is technically JIT and does compile some pieces into binary.
Well, you should not use OOP either way because it is simply not compatible with the Luau paradigm.
whats this mean
doesnt everyone use oop
I used to have the same opinion as you. No, in fact having shorter code is better. It does not mean you’re doing anything simple and that what they’re doing is more complex.
Alot of scripters have this habit of creating functions and modules unnecessarily which makes their code longer. Even on quite simple systems.
Here’s an example:
A few months/years ago, I made a stamina script. Similiar to the one you have in the mimic horror game. I made this with about 40-75 lines I believe? I didn’t create many functions (apart from when I had to use functions to listen to events) or create a module at all.
However, I look at other people’s code for a similiar system. They’re writing like 200+ lines of code? Creating several functions and using modules? To be fair, modules can make your code look cooler I guess. But creating entire modules for a system like this I fail to see the need.
Some of these people’s stamina systems were simpler than mine (eg not manipulating FOV of camera, or tweening stamina bar). Yet their code was somehow alot longer than mine.
Alot of scripters don’t understand where they should/shouldn’t be using modules/functions. So don’t worry.
Who is “everyone”? It could not be everyone because I, for example, am not part of that list.
Your goal as a programmer is to make code run and run in the most optimal way; OOP is not possible without a heavy compiler and full compilation into binary to have any benefits, and hence why Luau, as a JIT language, avoids it entirely.
Refer to using compatible paradigms like functional programming and ECS instead; they are compatible.
I agree with you to an extent, sometimes people are too focused on using modules and functions when you can just simply write the code and it works. As long as you aren’t doing something stupid like using _G to confuse other coders who are working with you then they should be able to understand.
I would argue actually that sometimes using modules and functions can make your code harder to understand and more annoying to debug. Because it just leads to longer code which means you’d need to spend more time to figure out how its operating.
And if you’re the only scripter for a game, you shouldn’t care too much about clean code. Because atleast in my experience, if I create the code I understand how it works.
no, i counted every single person who develops on roblox, they all use it. you can trust me, i double counted
thats a goal, not the goal
ive never even heard of ecs, is there actually a real benefit to it, or is it just another complex way to do the same thing and save an extra ms
Perhaps he meant “OOP” as in using metatables for example. Everyone uses it to an extent obviously.
Because they are stereotypical web devs/Python skids that have somehow gotten into game dev
Shame on them, I guess.
They probably write React Slop outside roblox ![]()