Delete this delete this delete this

Delete this delete this delete this

I do too, like organizing code in modules, but I think spitting it by “systems” might be easier to manage when you have a handful of code to handle

Delete this delete this delete this

It’s really what you personally benefit from; if you would benefit from a system that was split into many separate parts then have that system in many parts.

I personally would have it all in one script but that is just my preference.

Delete this delete this delete this

I may be wrong, but i think that falls into the micro-optimizations which you shouldn’t worry about

Delete this delete this delete this

It’s really up to you in the end, if you feel like having the functions split into modules like you currently do is working and you’re happy with it keep doing it, don’t worry about people telling you its a bad practice everybody codes in their own ways.

What I meant was that handling lots modules in a module might be hard to manage over time

Delete this delete this delete this

I wouldn’t split too much because it’s easier for me to scroll than switch between scripts. I think that these are functions of one category and should be in one module.

Delete this delete this delete this

Maybe in the future you will need to use a global variable and these functions will not have access to it or you will be requiring a certain module in all of these scripts and when you decide to change the name of the module or replace it with a different one, whatever, you will have to edit every of these small modules.

So keep that it mind, because you don’t have to give up the idea of splitting the code like that but try to prevent these situations from happening.

Delete this delete this delete this

Looks like you’re over-engineering. In my experience, unnecessary abstractions and over-modulation leads to less robust code, which is harder to modify for new features. This is because your existing system will not necessarily meet the future demands of what you have in mind for your game, forcing you to work around the way you’ve set it up already rather than implementing changes which would be trivial for a less complicated/‘abstract’ system.

I can’t see your actual code, but I would never put EndBlock and StartBlock into different modules–to me, that would be hard to manage and unnecessary. I would presume both use similar logic, so there’s no reason to modularise them.

I like to modularise my code according to “systems,” and only modularise further when absolutely necessary. Here’s some examples:

image

  • There are several different “modes” of pathfinding, but they’re all bundled into one module because they follow the same general logic. This greatly reduces development time when I want to make changes.
  • NB CharacterData handles positional and other data for the zombie’s target

Or here’s my client-side modules:
image

If a module sounds like it’s just one function, like StartBlock, it shouldn’t really be a module. There are exceptions to this–like in my Effects module, both Shoot and Sound simply return functions. This is because Shoot (handling both local and replicated bullet effects) and Sound (handling all sound effects) are called from many different places, so it wouldn’t make sense to bundle them together.

The roblox Chat scripts are a very bad example of this, because they’re over-engineered to hell. As a result, it’s practically impossible to modify the default chat scripts to your preference beyond a few provided settings (and the code is hard to understand). The amount of modules in the Explorer window literally doesn’t fit my screen, and it just wastes everybody’s time.

1 module = 1 system is what I do


having to open several modules just to make changes to one system seems more like a hassle to me

in your case I would personally have one module per combat type (Melee, Magic, Ranged, etc)

as for this you can Collapse All Folds in the script actions menu which will make all inner functions/tables collapse (you can also click the arrow next to functions to collapse them completely which is what I usually do for functions I’m not currently editing)


to

and these are small functions, it’s even more useful when the functions are larger

Delete this delete this delete this

Holy, I had no idea about that folds thing. Makes code way easier to navigate.