kp2pml30's personal blog HOME ROFS ABOUT LNK


Godot Project Structure

It is my opinion, and is by no means "objective"

Godot conventions

Godot by default uses following conventions:
  • if directory contains file .gdignore godot won't look into it and won't import files from there
  • directory /addons contains "addons"

Proposed file structure

├── _export/ # <- here you will export your game when time comes
│   └── .gdignore
├── addons/
├── assets-src/ # <- assets that don't get imported by default, useful for original textures and .blend
│   └── .gdignore
├── core/ # <- no-assets "core" functionality without which your game can't function
│   └── PROJECT.gd # <- autoload, see below
├── demo/ # <- everything that will be included in demo on par with `/core` and `/addons`
├── full/
├── scripts/ # <- contains different automation scripts, such as exporters
│   └── .gdignore
└── test/ # <- directory for temporary stuff and experimenting
This separation is proposed to allow splitting exported project into different packs. Godot has some complications with moving files, so you probably want it from the start.
core is separated so that you can open source it in case you want to help modders/whatever
For demo/ directory I would propose layout akin to
├── assets/
│   ├── meshes/
│   ├── music/
│   ├── sounds/
│   └── textures/
└── scenes/
    ├── levels/
    └── ...
Such a layout can make it easier to find what you need

PROJECT.gd

I suggest introducing this autoload (singleton) to keep project global data, such as layer names (they must be synced with project settings, so that both godot UI and gdscript use the same)
extends Node

enum LayerPhys3D {
	ENVIRON = 1,
	HAS_HP = 2,
}

enum Nav3D {
	WALK = 1,
	SMART = 2, # <- can open doors/etc
}