Godot: Keeping project files organized and avoiding duplicates

https://lemmy.world/post/44856237

Godot: Keeping project files organized and avoiding duplicates - Lemmy.World

I’m working on a project that’s scaling up a bit fast in term of files and content. As such I need a way to keep these files organized. The godot documentation recommends keeping resources and assets close to their scenes. I used to do the opposite, separating assets by type and linking them in my scenes. Now, what the docs recommend is good but how to avoid duplications when you need to use the same resource at multiple places? Say you have a gunshot sound, your player can use it, your enemies too. ## Option A (the docs way): /enemies/cowboy/gunshot.ogg /enemies/cowboy/cowboy.tscn /enemies/turret/gunshot.ogg /enemies/turret/turret.tscn /player/gunshot.ogg /player/player.ogg Here I have a redundancy of gunshot.ogg, so if later I want to edit the sound, I have to remember to swap it at 3 different places. But on the other hand, the scenes are better “packed” for reusability on other projects and it “feels right” ## Option B (my way): /gameobjects/player.tscn /gameobjects/cowboy.tscn /gameobjects/turret.tscn /sounds/gunshot.ogg Here my naive way reduces redundancy, if I want to update the gunshot sound, I can just replace the one under /sounds/. The project is smaller which is also a (very) good benefit. However, if I want to make another game, reusing those scenes is a pain because I’m dealing with missing resources and finding who needs what to work. Is there a middle ground method, some Option C I’m not seeing? Thank you for reading ^^

The way Godot suggests makes it so that you can change those sound independent of each other.

In my experience that will happen most of the time. At the start you think about being resourceful but that can bite you in the ass in the end when you feel that the turret needs another sound to be distinct from the gunshot.

You are more flexible that way and when developing a game that is much more important than saving some kb in storage imo.