Hello, how should I handle music and SFX in a complex game? I think to create audioManager with one AudioPlayer and manipulate in via script to play music but what with sound effects
To manage sound polyphony, I recommend using an autoload like this one.
Then call the autoload's functions to play sounds within your nodes. This lets a single node play multiple sounds at the same time and also ensures sounds play in full if the node itself is freed before the sound is done playing.
For music playback, you can use another autoload so that music playback continues if you change scenes using SceneTree.change_scene()
.
And should I preload all music and sfx in one place and call it via keys like play_sfx("Walk") or in other way?
You don't need to preload music and sound effects in one place, as Godot's preload()
function will handle that for you.