Fast firing weapon problems

Ok, having an issue here.
I have a fast firing weapon, but it is not that fast.

I have it set up currently so it is playing a loop of fast firing sounds. Then on “not playing” i go to a tail sound. Works perfectly.
If i single tap, the weapon only fires one projectile (i’m talking graphics here - I can see 1 projectile on screen). The problem is that I can hear 2 shots being fired. Or I can hear one shot and then an abrubt tail of the next sound in the loop, before it goes over to the tail of the sound.

If I pitch down the loop, so it is so slow that merely tapping the mouse button will only trigger the first shot of the loop, then when I hold down the mouse button, the audio does not match the visual projectiles at all. The visual projectiles are much faster than the audio loop.

How would you go about solving that problem?

In the past, I had the weapon firing a single event for each projectile, but that resulted way to many instances being spawned, and I have several of these weapons close to each other. (the weapon is scalable and can go very fast).

What would a good solution be?
One solution I could see, is to have the coder to make it so that every first projectile is played as a one shot event, and the next one will be played as a looped event.

Seems like this might be a solution… going back to one shot sounds?
“As long as you are correctly releasing your event instances (call EventInstance::release() after starting the one-shot gun fire event) then there shouldn’t be too much to worry about. Whilst you are correct that one event instance looping 10 times for 1 second would “perform” better than creating and releasing 10 separate event instances, the actual performance difference is so minute that you would not be able to tell. The benefit of having the sound sync up to your animations far outweighs the “increased” performance from using a looping event.”

What’s your problem, exactly? If I understand correctly, it’s that you’re not able to accurately quit the loop at the right moment, which is especially noticeable for one shots. How is set your loop exactly, can you share a screenshot?
(Though the single shot implementation may be correct, I personally like to solves problems directly within FMOD Studio - but that’s just me)

Here is the the timeline loop, that in turn plays a loop under “RateOfFire” parameter.
When stopping the loop, it goes to the tail marker.

And here is the actual loop that is being played.

And yes, I am not able to quit the loop at the right moment. If i quickly tap the mouse, and I have a high fire rate, I can hear multiple shot sounds (because the loop is being played fast). But I can only see one projectile on screen.
Also if I press down and have the loop playing, and let go just when a new shot sound has been heard, I can hear it abruptly stopping, because it is going to the tail.


Ah, but you’re using a baked-in loop. That may not be the right choice, to be able to quit the loop discretely after a single shot (and not in the middle of if). I would rather tend to chop each shot sound and put all of them in a multi instrument (or a scatterer, for variable rate of fire), which would be more manageable, for what you’re trying to achieve.

1 Like

Currently it is set up as a loop. But your solution is to fire an event for each projectile? Then I will have to talk to the programmer again to set it up like that.

No, a single event with a looping on each shot, instead of a series of shots like it seems to be the case in your project.

But then the shots will have to be cut off very fast and have no tail (when exporting them from DAW), becuase otherwise they will take forever to loop (because they have to go to the end of the wavefile). Right? Thanks a lot:)

No, with a scatterer, the new shot can be spawned even if the previous isn’t finished. Here’s a video capture of one of my events (a variable speed footsteps loop) that works pretty similarly. I use a sustain point rather than a loop because I found that extremely reliable and responsive, and works really well to have the last sound played entirely before exiting. At the end, I show how you could add a tail sound that would trigger when exiting the loop.

Great, thanks, will have a look. Have had lots of problems with the scatterer cutting up audio in the past, but will try again:)

Yeah, there is still the same problem. Because of the fast fire rate, I have to have voices set to 12 to not get weird souding audio because of instances playing on top of each other (if i got to a lower poly). If I set it to 1 (which I would like), then audio gets cut up.
So it seems like I will be using 12 voices for one weapon which is not good. Will post a screen recording

Maybe a bug? @joseph

If you’re using the event only at fast rates, chop your shot tighter and put the tail after exiting the loop.
Is it really problematic in terms of performance to stack 12 voices? I don’t know… I don’t really hear a problem in your exemple, except at poly=1, which is weird.

Thanks. There is a problem at 4 voices as well, and the 1 voice problem is really weird.

That being said, I’ve already made a suggestion to have a steal delay (for smooth cuts). Though I understand the argument for not adding this in the event macros (because it’s more of a resource management question), it should be present in the scatterer. Don’t you think so, @joseph?
Though not sure it’s the exact problem here.

Yeah it isnt working for me. I get a lot of choppy audio when using the scatterer. Too bad. So I still have the same problem as in the beginning.

You still should try with shorter sounds, higher poly, and a separate tail.

Same problem. With a 120ms short sample and spawn rate set to 100%, poly set to 6, everything is fine. I go to 110% and everything gets choppy and stuttery. Doesnt matter how high I set the poly actually

Turns out the scatter problem is an fmod problem. It is solved in 2.01.09

Instead of scatterer you can just use a timeline loop (or a transition to marker with a condition) with an Async Multi-Sound to retrigger the shot in a loop. The Multi-Sound can also be given a poly limit with Steal Oldest. Even with limit of 2-3 voices it should have enough overlap to not sound choppy.

Another way to set a precise transition from loop to tail is to match the BPM of the timeline with the loop sound (in timeline sync) and set the transition to tail to occur on beat. That should let you avoid hearing ‘half a shot’ on stop.

However… overall, getting shots synced and matched with game on fast firing weapons is a bit of a nightmare in any game. For example in Destiny they had to dictate that the frame rate of the game is fixed, and that the auto weapons only fire at multiples of frame rate (every 2 or 3 or 4 frames). Only that way they could achieve perfect sync. Many game designers are not willing to submit to such measures just for the sake of sound.

It seems he wants a variable rate of fire (he has a parameter), that’s why the scatterer seemed a good solution. A simple loop won’t be able to achieve that.

Interesting points, concerning image synchronization with fast firing weapons.