Max instance - is it networked?


#1

Lets say I have a fast weapon shooting.
I want to enable “stealing”, so whenever it shoots a new bullet, it stops the tail of the old sound, and uses that voice to play the start of the new sound instead.

By doing that I get less cpu hit and also i get less muffled sound, because I dont play a tail of the sound, while im triggering a new sound.

In Fmod, i have the “Max instances”. But is it networked?
By that, I mean, if we are 2 players and we both use the same weapon and shoot, will we be stealing sounds from each others weapons, or is the limit only local? (that’s what i would prefer).

If the “max instances” is networked, how would i go about accomplishing the “stop playing tail of sound when new sound is triggered”.

Thanks


#2

FMOD will only operate within the current system created in game.

So if you have a multiplayer game that has one player per client application, each of the clients will act independently of each other. Although if you are using local multiplayer, then all the players (and sounds) will be running through the one FMOD system.


#3

Ok. Just to make sure i understand:

Under the master output of my audio event, in the right lower corner, i have a black square labeled “Master”, that contains pitch/doppler/max instances/cooldown etc.

I set my weapon to max instance of 1. thereby forcing the system to cut off the tail as i fire the next time. (setting stealing to oldest).

I i play a multiplayer game, 1 game on each computer, no split screen etc:

What I would like:

I fire my weapon very fast (and thereby I cut off the tail of my weapon, until i stop firing).

So does a co player standing next to me.

Will my co players, shots be cut off (in my ears) because i am firing my weapon fast?

I would like to somehow limit the stealing mechanic to the owner ONLY.

Or is there another way I could go about this?

I basically want a clean weapon sound, not being muddied by tails everywhere, except when i end the firing.

I guess this is not stealing, but more like gating/volume automation?

How could this be solved logically with code? I dont need the exact code, only the general logic behind it.

I am thinking something like this:

I get a parameter from the game that checks if i’m firing. (IsFiring).
If that parameter is set to 0=is not firing. 1=is firing.
Then i could use this parameter to automate the volume of the tail.

BUT! this will still be playing the core sound, and not stopping it, once i fire a new weapon.

meeehhh i’m rambling here.

Any insights would be welcome:)


#4

Given that your goal is to eliminate tails when multiple shots are fired by the same gun, rather than to actually limit the maximum number of instances of the event that can be playing at the same time, instance limits aren’t the appropriate tool to use in this case.

Instead, I recommend making the weapon event persistent, and keeping track of just one instance of that event per weapon of that type in your game world. Then, whenever one of those weapons is fired, set the timeline position of its corresponding event instance to 0. This will ensure that a new gunshot sound plays from the beginning by reusing the specific instance associated with that particular weapon, rather than from other identical weapons in the game world.


#5

Makes sense. Can you point me to a place where i can read more about this? I googled “fmod persistent event”, and didnt really find anything useful.

Thanks a lot:)


#6

You can read about persistent events here: https://www.fmod.com/resources/documentation-studio?page=/event-macro-controls-reference.html#persistent

In short, they’re events whose instances never end naturally, but which can be manually stopped. If you’re planning to recycle an event instance by changing its timeline parameter value, they’re not a bad option.


#7

Thanks! Sorry for all the questions, but what about restarting the weapon each time it is fired? Any links? Again, i have googled around, but not found anything really useful.

Thaaaaaaanks!


#8

You can move an event instance’s timeline playback position with Studio::EventInstance::setTimelinePosition, as explained in https://www.fmod.com/resources/documentation-api?page=content/generated/FMOD_Studio_EventInstance_SetTimelinePosition.html#/ . In any event that uses only synchronous instruments, setting the timeline’s playback position to 0 effectively re-starts the instrument.


#9

thanks