How do I make positioned sound in multiplayer game?

Get help using Construct 2

Post » Fri Oct 03, 2014 8:57 pm

I have a lot of players on big map. When player shoot other must hear if close to him. "Set listener" isnt helps correctly. Looks like listener always host screen. Any ideas?
Creator of MiniDayZ
B
22
S
2
G
2
Posts: 76
Reputation: 1,860

Post » Sat Oct 04, 2014 6:00 pm

Decide on a range for the sound to be heard. Create a circle graphic the size of the range of the sound and set it properties to invisible. Give it Fade behavior and set to active on start and destroy after fade out. Don't forget to set or check it's collision properties into the shape of a circle.
Next set sound to play for players when they are on overlap with the circle.
Then set the circle to be spawned from the point of the weapon or explosion or whatever makes the sound.

If another player is close enough, the circle will overlap, the sound will play, the circle will be destroyed. The circle is always invisible.

This the basic mechanic I use to trigger an action to based on range (short range anyway) without calculations. It's easier and more efficient than calculating ranges.

Hope this helps
Image
B
75
S
23
G
3
Posts: 673
Reputation: 9,293

Post » Sat Oct 04, 2014 6:45 pm

Farsight wrote:I have a lot of players on big map. When player shoot other must hear if close to him. "Set listener" isnt helps correctly. Looks like listener always host screen. Any ideas?

This is interesting to think...
I never tried this but I think you can calculate this on peer side, because this is not an authoritative case. Let the host sync the coordinate of all peer to everybody, so in peer event, calculate the distance based on sync coordinates, adjust the volume based on the distance. This is if you want to adjust the sound relational to position. If else, what TheDom said is totally a good way to do it.
B
28
S
8
G
4
Posts: 553
Reputation: 4,924


Return to How do I....?

Who is online

Users browsing this forum: zenox98 and 29 guests

cron