In this video, we look at the file structure of the completed game project. You can watch it first and then continue with the recap below.
It’s hard to know how to split your projects into scenes and where to save files at first when making games.
It’s also difficult to learn because each project requires a unique code structure, and knowing how to split code takes experience.
That’s because we split code into scenes and scripts based on the game’s mechanics.
Also, in practice, we move files into folders as our projects grow. You don’t have to get it right from the start.
Here’s a recap of the video’s key takeaways.
In short, we recommend to:
Your goal with your project’s file structure is to make it easy to browse for anyone who opens the project for the first time.
At a glance, the folders should tell you what the game’s main components and mechanics are.
We don’t recommend using the same generic folder names for every project because they make understanding the game’s code architecture harder.
For a turn-based RPG, your main folders may look like this:
The file structure should represent your game’s code structure.
And this is something you figure out as you create the game, so file and folder names will be subject to change, and you’ll move things around as you go.
For indie games, we recommend keeping all related files grouped in the same folders. For example, we will put the player character’s sprites, sounds, scenes, and scripts in one directory.
Larger teams are more likely to use generic folders. This is because larger projects may have to reuse assets across widely different parts of the game.
If you are over ten persons working on the same game, you may start to use folder names like 3D_models, states, sounds, music, visual_effects, etc.
You rarely want your code and your files to look like a deep tree. We recommend aiming for wide but shallow code structures.
The deeper your folder structure runs, the slower and more tedious it becomes to browse.
Similarly, the longer the chain of inheritance you have in your scripts, the longer the code becomes to read and navigate.
There are often files that you reuse across many game mechanics for efficiency.
While we don’t recommend generic folder names, you’ll often need at least one named assets, shared, or common.
We recommend picking a folder name to reuse across projects in those cases. At GDQuest, we call this folder “common.”
In the next lesson, we’ll look at an essential tool that developers use a lot. It will help you to keep learning more about Godot moving forward.