Targeting and Interest Groups
Overview
By default, a local voice reaches all other players in the room. Target players and interest groups narrow that down, and both can be set at creation and changed later.
Target Players
LocalVoiceOptions::TargetPlayers and LocalVoice::SetTargetPlayers() limit the stream to the listed player numbers. An empty list means all other players:
C++
localVoice->SetTargetPlayers({2, 5}); // only players 2 and 5
localVoice->SetTargetPlayers({}); // everyone else again
Typical uses are private conversations and team chat with fixed members.
Interest Groups
Interest groups are a feature of Realtime rooms: a sender addresses a group, and receivers subscribe to the groups they want. Group 0 is the default and reaches everyone.
Only the audio frames are filtered by group. Stream announcements reach all players. A remote voice can therefore be listed on a client that never receives audio from it.
Sending to a Group
LocalVoiceOptions::InterestGroup and LocalVoice::SetInterestGroup() send the frames only to subscribers of that group:
C++
constexpr uint8_t TeamRedRadio = 3;
localVoice->SetInterestGroup(TeamRedRadio);
Listening to Groups
RealtimeClient::ChangeGroups() subscribes the client to groups, taking the groups to leave and the groups to join:
C++
client.ChangeGroups({}, {TeamRedRadio});
The subscription applies to game events published to groups as well. See Interest Groups.
Typical uses are team radio and proximity chat by map area.
Debug Echo
With LocalVoiceOptions::DebugEcho = true, the server also sends the stream back to its sender, which allows testing with a single client. The echo shows up as a remote voice with the local player number.
Debug echo is meant for testing only, with headphones on.
Additional Resources
Last updated on
Back to top