I am REALLY tried to look at this topic, but couldn’t find actually topic’s to create own framework (or when i finding one, they are too hard to read and don’t answering my question at all).
In next sentences, i will try to talk about what i’ve learned from these tutorials:
For example, i know that frameworks has a lot of services and Module Loader (Both for Client and Server).
But what these services are even doing?! Like, new player joining the game, i am initilizing an Client Services for him, so what’s next? For example, how do i work with GUI’s in Services, or how do i work with Input (i know it’s an basic CAS or UIS, but just how do i interrupt it for client? That what i am worried about and questioning today.)
Also, what’s for server? For example, i should create “NewPlayerController” (or other name) and detect when new player’s joining the expirience, to activate new service’s?
Client services handle things like GUI and Input (UIS/CAS). They run locally, fire RemoteEvents to server. Server detects player join, runs their controller or service to handle data, logic, etc.
Each service handles one system. Framework just loads them cleanly.
As a person who has looked at most frameworks knit, aerogameframework, and nevermore, think as if you are a dev with a large game with a lot of modules and instances.
Would you rather do
local Components = require(script.Parent.Parent.ReplicatedStorage.SomeRandomFolder.SomeOtherRandomFolder2.SomeOtherRandomFolder3.SomeOtherRandomFolder4.SomeOtherRandomFolder5.SomeOtherRandomFolder6.Components)
Or would you do:
local Components = customRequire("Components")
Would you also scroll through 1000x instances in your explorer in order to create a remote event or bindable event, or in your script automate it for you.
With enough helper functions and utility that you have to depend on and use all of the time, it becomes a framework.
That’s pretty much it (In terms of my opinion and knowledge). Avoiding the problem of having many assets in explorer and focus purely on the script.
However the problem is when things go wrong and you don’t understand how customRequire function work which was the problem with knit.
Also another problem is if you don’t know why you need the function customRequire, then it just complicated your work flow and you would be staring at the documentation and the code back and forth for an hour.
customRequire?
you mean, require framework in order to get ALL services?
and honestly, this reply doesn’t explain much to me, only that framework is like custom “require”
Most frameworks are 99% bloat. Unless you’re coding a game that needs every single mechanic known to man, there’s no reason to use them.
Module loaders in my opinion, are dumb. They completely remove autocomplete from your code, and make it hard to find bugs and look at the code again in the future.
In my opinion, just use RemoteEvents, they are more readable than “networking libraries”, and just as performant. If you need to manage lots of packages at one time, try looking into wally and rojo.
This can be fixed by simply having good organization.
Yep you require a function from a module to get what you need.
No problem, to be honest I do not have a software engineering background needed to organize large code bases. I probably explained it in the worst way possible. I just did trial and error and spent a lot of time reworking my script and switching frameworks.
The people that did create these frameworks however were software developers that understood these principles like single responsibility principles which is why the code is structured that way.
I would suggest these books and resources to study further:
local Framework = {}
local ClientServices = {}
local ServerServices = {}
--[ FUNCTIONs ]
function Framework.RunClient()
--[ Initilize ]
local IsClient = RunService:IsClient()
if IsClient then
--[ Request Client Modules ]
local ClientFolder:Folder = script:FindFirstChild("Client")
for _, Module in ClientFolder:GetDescendants() --[[ Get All Modules ]] do
if Module:IsA("ModuleScript") then
local Import = require(Module) --[ Get Module ]
--[ Debug ]
print(typeof(Import.Init))
if Import.Init and typeof(Import.Init) == 'function' then
--[ Start Modules ]
Import.Init()
ClientServices[Module.Name] = Import
end
end
end
end
end
function Framework.RunServer()
--[ Initilize ]
local IsServer = RunService:IsServer()
if IsServer then
--[ Request Client Modules ]
local ServerFolder:Folder = ServerStorage.Modules:FindFirstChild("Server")
for _, Module in ServerFolder:GetDescendants() --[[ Get All Modules ]] do
if Module:IsA("ModuleScript") then
local Import = require(Module) --[ Get Module ]
--[ Debug ]
print(typeof(Import.ServerInit))
if Import.ServerInit and typeof(Import.ServerInit) == 'function' then
--[ Start Modules ]
Import.ServerInit()
ServerServices[Module.Name] = Import
end
end
end
end
end
function Framework:GetService(nameService)
--[ Initilize Service Type ]
local Type = nil
if RunService:IsClient() then
Type = ClientServices
else
Type = ServerServices
end
local totalService = Type[nameService]
return totalService
end
What do you mean by “script my own way”? Frameworks don’t increase performance at all, since most of them just wrap a remote event / function in another function. I’m not sure why you would need a custom Import function. Module loaders are useless, just put the modules into folders, it doesn’t destroy autocomplete, type checking, etc.
Okay, let’s say your right. What i am supposed to learn? I know stuff like OOP, and i am kinda stuck with that. Just don’t know what i should learn to improve myself and make good games.
The main reason why i am interested in that is that i saw a lot (actually, 2-3 peoples from my close range) of talanted people and they all was been talking about frameworks.
You’re getting ahead of yourself. You should be comfortable with scripting before you even attempt to make your own framework.
It’s like you’re trying to build an engine when you only know how to replace a tire. I’d focus on how variables and tables work, control flow, modules, remote events/functions…
I’m guessing you know the basics of luau, if I were you I would expand to more specific / niche areas, such as making vehicles, guns, building systems, robbery systems, etc. just make things, and you’ll naturally learn more things.
May I ask who? Most frameworks are archived, and have been disliked for the last couple of years.