Jump to content

Proper fix for all the sounds from the clients playing for the host


Recommended Posts

NOTE : ANSWERE TO THE ISSUE AT POST #5 IF SOMEBODY IS INTERESTED

 

Hello,

 

so I searched a bit and found just one post from february with no answere about this issue, so I try my own luck :-)

 

Basically, when playnig a sound (in my case, in a stategraph), the sounds behave properly for clients, but the host is spammed by the sounds emmitted by all the clients, even if they are like at the other border of the map.

 

I "fixed" it so at least the poor host is not spammed anymore by adding this :

 

if TheNet:GetIsDedicated() or
(TheNet:GetIsServer() and ThePlayer ~= nil and ThePlayer:IsNear(inst, 30)) 
then
print("inst is : ", inst, "    /    ThePlayer is : ", ThePlayer)
inst.SoundEmitter:PlaySound("bow_shoot/bow_shoot/bow_draw", nil, nil, true)
end
 
This way, if it's a dedicated, nothing changes and everuthing is fine. If the host is also a player, it will prevent him from recieving the sound from everyone not nearby.
The issue is that of course, then it disable the ability of the clients to hear other players if the host is not here as well.
 
Any "proper" fix?
Edited by ZupaleX
Link to comment
Share on other sites

Hello,

 

I added it at the first place the additional arguments because of this issue. Just a blind try, I know it shouldn't have any influence anyway since the second argument is to give a name to the event and the 3rd is the volume. The 4th one has something to do with the prediction but I have to admit it is not totally clear to me (tried to put it to true and false to test, no changes)

 

I will try the tag thingy, thanks!

Link to comment
Share on other sites

So it doesn't work.

Funny fact : If I put a standard Don't starve sound (like the sound used for spear attack) it doesn't create any issue.

Am I missing something in the way I include my assets or is there something specific to know about FMOD ?

 

My assets :

 

Assets = {
    Asset( "ANIM", "anim/bow_attack.zip" ),
Asset("SOUNDPACKAGE", "sound/bow_shoot.fev"),
    Asset("SOUND", "sound/bow_shoot_bank00.fsb"),
 
Asset("ATLAS", "images/tabimages/archery_tab.xml"),
    Asset("IMAGE", "images/tabimages/archery_tab.tex"),
 
Asset("ATLAS", "images/tabimages/quiver_slot.xml"),
    Asset("IMAGE", "images/tabimages/quiver_slot.tex"),
}
Link to comment
Share on other sites

So I figured it out eventually after realizing that the issue was not occuring with default sounds. It meant that it was not coming from my code.

So in your FMOD project, you will find for each sound on the right pannel an option called "mode" which is by default "2D".

You have to switch this option to "3D" and then set you max distance at which the sound can be heard.

And... voilà

 

There should be a proper tutorial for FMOD, because thispiece of information is not even mentionned while it is CAPITAL.

 

EDIT : After some testing, decent base parameters to start toying with seems to be:

 

Mode : 3D

3D Rolloff : Linear

3D Min Distance : 1

3D Max Distance : 35

 

everything else left to default values

Edited by ZupaleX
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...