I want my game to be modular and scalable. So recently I’ve been learning how to make better code and frameworks (Knit) and using external tools like Visual Studio Code
I’m using Knit framework by @sleitnick I’m pinging you so hopefully you will see this and can give an answer please
In Knit there is 1 script and 1 local script for bootstrapper and everything else is modules.
There’s 3 “types” of modules (I think):
- Services/Controllers,
- Modules (I think this is for things like libraries and classes),
- and Components (wrapping Instances)
What I need help is knowing how and when to use these different things.
“Services are high level singletons that provide a service to the game”
How do I know if I should be making a Service? When I think of Service I think of something that handles a lot of things (e.g. DataStoreService handles all datastore stuff.) Let’s say I want to display the players name above their head, is that a Service? If not what is it a Module? It’s for sure not a Script or a Local Script because there are only 2 of those for bootstrapping. Should I be making Services like “DisplayNameAbovePlayersHeadService” ?
I’m also confused where actual game logic goes, as in you make all these fancy classes with methods, but then where do you call those methods? (I think the answer to this is in the KnitStart method of a Service/Controller and any other module which needs to access the public methods)
Does everything in one service go under one class in one file or can you have multiple classes and multiple files?
How do I know if I should be making a regular class or a Service/Controller. If it’s just a regular class how does it get called (it doesn’t get called on runtime by Knit)
I know each developer can structure things at their discretion as long as it’s organized and efficient.
I’m looking for guidance/insight on how to do to make an efficient codebase architecture/usage of frameworks. (in this case Knit)
It really boils down to, what question or set of questions can I can ask myself to figure out what type of script is right for a specific task?