How do I make positioned sound in multiplayer game?

0 favourites
  • 3 posts
From the Asset Store
First HTML5 tank game with real multiplayer. Endless replayability.
  • 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?

  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)