Foldering Standard
Overview
A good project structure can communicate where to find certain files and assets to the team, regardless the size or the complexity level of the project.
-
❓ Why should I care about this article?
Even in smaller projects, properly structuring your project file and folders from the beginning can reduce problems and wasted time when you need to access files.
-
🎯 The goal of this article
This article will provide a consistent folder and structure best practices in Agate. The goal is to create sufficient clarity for the developers.
-
🤷🏻 If I have further question about this article, who can I reach out to?
Please contact: Fachri Akbar (fachri@agate.id)
Folder Structure
-
All files within the same scope should be stored inside one root folder
For example:
<aside> 📂 Assets (expand toggle)
- Game
- ... (all game specific code goes here (for example: scenes))
- Scenes
- ... (all scenes code goes here)
- Plugins
- ... (all plugins goes here)
- ... </aside>
- Game
-
Be aware of Default Folders or Special Folders used and reserved by engines
- For example, take a look at Unity Special Folders. In Unity, you must place Editor scripts in a folder called Editor for them to work correctly.
-
❌ DO NOT use space (" ") in folder name
- ❓ Why? → there could be plugins that may not work well with spaces on the folder name. Not using space will help reduce issues encountered as it will always work regardless of the plugins
-
✅ DO organize by modules, just as with namespaces (Learn more about Namespace Standard)
-
❌ WRONG example
<aside> 📂 Game (expand toggle)
- Scripts
-
Controller
GameplayController.cs
LevelObjectiveController.cs
ParticleController.cs
TutorialController.cs
-
View
GameplayView.cs
LevelObjectiveView.cs
ParticleView.cs
TutorialView.cs
-
... </aside>
-
❓ Why is this wrong? → this reduce the modularity of each functionality developed, making them hard to reuse as they're scattered all over the place. You have to find a functionality related file in each component type (Controller, View, etc.)
- Scripts
-
✅ CORRECT example
<aside> 📂 Game (expand toggle)
- Scripts
-
ModuleA
-
Controller
ModuleAController.cs
-
View
ModuleAView.cs
-
-
ModuleB
-
Controller
ModuleBController.cs
-
View
ModuleBView.cs
-
-
... </aside>
-
❓ Why? → now it's easier to, say, reuse the ModuleA for another project. Everything is in one place.
- Scripts
-
-
You can also create folders for submodules, nested in its parent module folder
<aside> 📂 Scripts (expand toggle)
-
ModuleA
-
SubmoduleA1
-
Controller
SubModuleA1Controller.cs
-
View
SubModuleA1View.cs
-
-
SubmoduleA2
-
Controller
SubModuleA2Controller.cs
-
-
-
... </aside>
-
-
Golden rule is, if a folder contains more than 10 items, there might be a way to categorize the items even further
-
Rather than this...
<aside> 📂 Gameplay
-
Controller
GameplayFlowController.cs
GameplayFlowProcessController.cs
GameplayHintController.cs
GameplayHintProcessController.cs
GameplaySetupController.cs
GameplaySetupProcessController.cs
... (10 items more)
-
... </aside>
-
-
Try this (if appropriate)
<aside> 📂 Gameplay
- GameplayFlow
-
Controller
GameplayFlowController.cs
GameplayFlowProcessController.cs
-
...
-
- GameplayHint
-
Controller
GameplayHintController.cs
GameplayHintProcessController.cs
-
...
-
- GameplaySetup
-
Controller
GameplaySetupController.cs
GameplaySetupProcessController.cs
-
...
-
- ... </aside>
- GameplayFlow
-
-
✅ TRY to match module's folder name with its namespace
- ❓ Why? → Folder Structure and Namespace should be able to communicate the structure of the project, to make it more predictable and easier when needed to access the files
No Comments