Is it worth to switch to a modular game architecture?

I’m making a Roblox game and it’s a big project for a big community that I want to be able to easily update etc.

In the current version I have, it’s a normal script architecture based on LocalScripts and ServerScripts, where ModuleScripts are just used as utilities.
The problem with this is I often find myself using the same module in each script about 10 times (no joke) and the amount of modules I have to require in each of these normal scripts is getting out of hand to the point where I can tell that this is just too messy and I KNOW there’s a better way.

Now, I’ve heard of a modular framework, I was just wondering, can anyone vouch for its optimality? If I were to implement this, it would probably be a one LocalScript one ServerScript and then a bunch of controller modules type of thing.

I’m just not used to it at all, is there any guide on how to begin structuring this kind of thing or do you just figure out how your ModuleScripts/Controllers should be structured as you go?

2 Likes

I would recommend switching to it. I’ve been beginning to learn the new type of architecture of modular games and its pretty nice.

There isn’t any “special” benefits or improved performance for switching to modular code, but it can help your game feel more organized, and clean.

I don’t have a strong idea on how to do the structure, most tutorials online confuse me, but there isn’t any right way to make them, and you can organize them as you wish. What I’ve been doing to structure my modular code is I kinda stuff all the modules into one folder in say, serverscriptservice. Then, i have an initializer code that loops through all the modules and requires them and runs an Init function if there is one in the module. Also, make sure to use a task.spawn loop or something similar to make sure they all run seperately, otherwise issues arise.

Thats just how I’ve been doing it, Idk if theres anyone who knows how to do it better but thats just some tips!

5 Likes

at the end of the day its just preference

if you do 1 local and server script with all other scripts been module scripts, and also well organised folders, making module scripts for the simplest unnecessary things so you have full control over modules, using multiple established already made modules also is a huge help cause you dont have todo everything

you’ll probably have a better overall dev experience even if it takes longer its more worth in the long run of a project imo

Thank you for your feedback!! :folded_hands::heart:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.