I need help on making my game modular (Single Script Architecture)

Well, I don’t need help migrating everything, I just need help understanding SSA and modular scripting, since I heard it’s pretty good, and I’ve seen how organized games with modular scripting can be.

It would help tons if someone were to post an SSA template, but I’d appreciate any kind of help on the matter.

1 Like

This is tricky because it relies heavily on what exactly you mean. A lot of modular systems are designed for the specific purpose of that game. You basically just need to find what systems share code and make that specific code usable by systems that want/need it. And then just hide as much code lower down the chain as you can when systems don’t need it. Looking into something like design patterns will help you figure out how you can make some of these systems in clean and reusable ways. And it’s a bit tricky because coming up with good abstractions can be tricky so often I just abstract as I go unless it’s obvious. (The more practice you have the more things become “obvious”)

As for getting it all to run in a single script, you basically split up the different part of your game into self running module scripts you require in your core script. It’s practically no different than running the modules as separate scripts (not modules) except for 2 things. You control load order (which you probably shouldn’t rely on too much anyways) and you can break your whole game if one fails to load and you didn’t pcall it. So it’s basically running them in different scripts, but you have to write a dispatcher for them yourself.

1 Like

This helps with my understanding a lot, actually. Thanks.

2 Likes