Limit transmission range on a map

iagomd
iagomd
edited February 2019 in Photon Voice
Hello, I am a beginner here and in Unity.
I started adapting DemoVoiceUI to work as an external plugin for a game in C++.
It gets the 2d position of the player on the map and sends it to the others as a custom attribute, so the volume is adjusted according to distance.
Can I avoid sending audio between distant players on the map? There are around 200 players per map/channel.
Thanks for the help.

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @iagomd,

    Thank you for choosing Photon!

    I started adapting DemoVoiceUI to work as an external plugin for a game in C++.
    What do you mean? How?
    It gets the 2d position of the player on the map and sends it to the others as a custom attribute, so the volume is adjusted according to distance.
    We rely on Unity for 2D/3D or audio positioning based on AudioSource and AudioListener components config.
    Can I avoid sending audio between distant players on the map? There are around 200 players per map/channel.
    Yes, of course, you can make use of audio groups, which are Interest Groups. I see that the doc for those did not make it to v2 but it's the same thing if you don't mind the renaming and namespacing.
  • iagomd
    iagomd
    edited February 2019
    It is an external tool only for voice chat, there is nothing of the game, information of the players (name, positions ...) are obtained by tcp. It is not necessary to instantiate the chararcters. It's very similar to DemoVoiceUI, so I'm using it as a reference. (https://prnt.sc/mgqicd)

    However DemoVoiceUI uses "ConnectAndJoin" instead of "PhotonVoiceNetwork". I did not succeed in replacing to use groups, I will try again.

    I thought of using a room for each match (~600 rooms), and split the map into 100 groups (https://prnt.sc/mgqo0i), is that right?

    Thanks for helping.
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited February 2019
    DemoVoiceUI uses "ConnectAndJoin" instead of "PhotonVoiceNetwork"
    Yes DemoVoiceUI does not use PUN2 integration. VoiceConnection is the script you need. ConnectAndJoin is a simple example script of how VoiceConnection could be used.
    I did not succeed in replacing to use groups, I will try again.
    VoiceConnection.Client.ChangeAudioGroups(byte[] groupsToRemove, byte[] groupsToAdd); and Recorder.AudioGroup are the two things you need. ChangeAudioGroups allows you to set the groups the client belongs to/is subscribed to and Recorder.AudioGroup sets the audio group to transmit to.
    is that right?
    Yes should work. PUN1 has a demo for Network Culling. I think the scripts are also available in PUN2's UtilityScripts also.