Are other things shared? Especially in the code? They all have health, they all can shoot, they all can take damage. Make an object they all inherit from.
Or just make a shared assets folder
Are other things shared? Especially in the code? They all have health, they all can shoot, they all can take damage. Make an object they all inherit from.
Or just make a shared assets folder
I would recommend composition over inheritance https://www.youtube.com/watch?v=74y6zWZfQKk
Then you'd have a component that enables shooting, and you can store related sound effects near that.
In the problem of files organisation, this seems to only push it elsewhere.
Because now, if I make another game with my cowboy for example, I need to remember to take the shooting component with me. And all other components I would have made linked to this cowboy.
This would look like:
/components/shooting/shooting.tscn
/components/shooting/gunshot.ogg
/player/player.tscn
/npc/cowboy/cowboy.tscn
/npc/turret/turret.tscn
I guess this mitigates the issue at least 🤔
If you want to replicate stuff across multiple separate projects, I guess the best method would be to create your own plugins: https://docs.godotengine.org/en/stable/tutorials/plugins/editor/making_plugins.html
For example you could assemble all of your custom components, including assets like sound effects, into a plugin that serves as a library of reusable components. Then you'd only need to add the plugin to whatever project you need them in and Godot would automatically take care of the file management.
It's a mixed bag.
Sometimes I have a really useful thing that's shared by almost all "main" nodes. (Let's say 20-30%
Sometimes I have a small texture with only one purpose. (20-30% also)
Other times, for example I have these .anim files that are used for 2 different enemies.
Should those be in a shared_asset directory or duplicated along their respective scenes. (Most of the time)
Whatever you do, I would never put some kind of other paradigm over DRY. Duplicating stuff is awful, especially when you want to change it down the line.
yup
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 cowboy.
You are more flexible that way and when developing a game that is much more important than saving some kb in storage imo.
Welcome to the game development community! This is a place to talk about and post anything related to the field of game development.