Hello! I’m back to my loop/struggle of finding out a proper way or good way of organizing code… I can’t really find any good open source projects, they all seem to have pretty messy unclear code, and most of the time I see people suggest modular coding, whilst all the open source projects usually dont do this. I was curious if you guys have any tips or information on organizing code/scripts, structuring it, etc.
I’ve seen and understood plenty of simple examples but I need something more in depth/advanced, because I run into issues once my code is bigger
everyone has different needs for organization. all depends on what type of games youre making (e.g a round based game will have a much different structure than one on one competitive matchmaking), what types of libraries/frameworks you have, and what type of tools you have to your disposal (e.g file searching and keyword searching throughout your project)
if youre like me and youre lazy and really dont want to concern yourself with file organization you can use a predetermined framework or like the person above me said look at the codebases of solid programmers and replicate their styles
if you dont want my quick and lazy answer tho if i had no predetermined frameworks and were to make like a round based obby racing game i would approximately structure it like this:
in this particular case, since I have a pretty simple game, I also have a pretty simple file structure and don’t really need to stress all too much about folder hierarchy and stuff
since I also don’t have like weapons and character types and other stuff like that, the organization that comes with classes doesn’t apply either
it all depends on what ya maken
theres not exactly a “proper” or “improper” way to organize, and with the nature of programming everyones going to be at least a little bit unsatisfied with other’s codebases, so don’t reach for perfection but rather make it more complex as you grow instead of being paranoid and making it complex from the beginning
I wrote several articles on the subject. I have 10 years of industry experience and am in the process of writing a book on system design and architecture.
You can find the articles under my profile or here:
I read through this before, and I really enjoyed it a lot, but I still had some issues with more advancvd things and wasnt sure how to proceed. I had also asked some things in comments but they werent replied to loll… I’m not sure how to go about getting past the issues i had
It just started feeling kinda messy and unclear, im sure this is user error but im not sure of how to improve from it… I could send you a place file if you want to review it or something. But as my systems/scripts grew it felt more messy and disorganized, and harder to add things to
I suggest learning how to correctly use luau static typing. It really helps with large scale applications. Another thing is, learn the SOLID principles, they work wonders.
Writing good software is hard, I read several books on the subject and you may not be ready to grasp some of the advance concepts of system architecture. I say this because at a high level, programming becomes extremely abstract and fragmented. If you did not develop a good foundation you will struggle with the complexities of writing good code.
Would you be able to do a code review? It’s not too much, but if you have the time it would be amazing. Just to tell me what I’ve done wrong as a push in the right direction, and thank you either way!
Please do NOT use any architecture that remotely resembles this, for future reference.
Use one script for the server and one script for the client, avoid hardcoding.
unless im mistaken this should be approx. the one server script and one client script file structure just in the format of rojo… if you sync it it should just be one server script and one local script with all the other files in the folder being modulescripts that are children of the respective scripts
i kno not everyone uses rojo so this mighta seemed odd, my b
I understand it a fair bit, and I understand some of SOLID. I was trying to find some more stuff on it but I have the issue of executing the information I got into the actual scripts, like reading your tutorial, it all made sense, and it all seemed good, but I was stumped when trying to actually put that into play for gameplay. It’s easy for certain objects i.e. npcs, objects, etc, but im stumped at more base things like UI, basic gameplay stuff like combat, sprinting, etc