When it comes to file structure, I follow a similar approach to what @spiney199 suggests. For small projects, I organize files into folders based on type, such as scripts, sprites, and so on. As projects grow, I transition the folder structure to focus on features rather than file types. File structure should be like your code, refactor as needed.
What you’re asking, however, seems to be more about code architecture. This is an incredibly broad topi, so much so that countless books have been written on the subject, numerous principles have been established, and yet, there’s no definitive “right way” to do it. It’s a discussion that could span thousands of pages and years of debate without arriving at a single conclusion.
The reason for this is that code architecture is highly contextual. It depends on the project’s requirements, purpose, and target audience. It’s also highly subjective, shaped by each programmer’s knowledge, experience, and preferences.
That said, there are certain practices that are should be universally accepted. However, these are often overlooked due to lack of experience or because their benefits only become apparent as a project grows in complexity and size.
As @CodeSmile advises, for large projects, it’s best to avoid approaches like “global singletons” or overly broad “GameManagers.” Instead, focus on adhering to principles like the Single Responsibility Principle. I would say that is not so much of a class doing only one thing, reserve that for methods, but more of a class having only one reason to change. Defining what constitutes “a reason to change” can be challenging, but I find Bob Martin’s definition and the SOLID principles to be particularly helpful. And that’s where the proverbial rabbit hole begins.
If anything, when tackling the architectural aspect of your question, it’s essential to understand that architecture is far more challenging than coding or learning a new language. It’s a skill you never fully master, instead, you continuously improve throughout your life.
Personally, I’ve found the SOLID principles invaluable. They help me break down complex architectural decisions into five manageable principles, allowing me to build a solid foundation and work upward from there.
If you’re interested in learning about SOLID principles, I recommend avoiding YouTube videos or blogs (including mine) as your primary sources. There’s a lot of misinformation out there, and summaries often lack the necessary context to fully understand the concepts. Instead, start by reading the book Clean Architecture. Once you’ve built a solid foundation, you can supplement your knowledge with reliable information from the internet.