Battle royale games | GME provides the "Team only" and "Everyone" voice modes unique to battle royale games and mobile survival shooter games. The voice effect varies by selected mode as follows:
1. If the "Team only" mode is selected, the player can hear only the voice of teammates.
2. If the "Everyone" mode is selected, the player can hear the voice of teammates as well as the voice of enemies within a certain range. |
Immersive virtual scenarios | In a virtual scenario like in-game concert, when the singer sings in the virtual room, the range voice feature can be used to enable the audience to talk with other players within a certain range while hearing the singer. Up to 10,000 players can turn on their mics simultaneously in a room. |
Voice Mode | Parameter | Feature |
Everyone | RANGE_AUDIO_MODE_WORLD | In this mode, the player can be heard by other players within a certain range and can talk with them if they are also in this mode. Teammates can hear each other. |
Team only | RANGE_AUDIO_MODE_TEAM | Only teammates can hear each other. |
RANGE_AUDIO_MODE_WORLD
), the range for hearing the voice will be subject to the UpdateAudioRecvRange
API.RANGE_AUDIO_MODE_WORLD
):Player Coordinates | Range for Hearing the Voice | Voice Reachability of the Other Player | Voice Reachability of Teammates |
A (0,0,0) | 10 meters | The player can hear player B, as player B is within 10 meters of the player. | Teammates can talk with each other. |
B (0,8,0) | 5 meters | The player cannot hear player A, as player A is more than 5 meters away. | Teammates can talk with each other. |
SetRangeAudioTeamID
API to set the team ID (TeamID
) and then call the EnterRoom
API to enter the room.TeamID
specified during room entry is not 0
, a user will enter the range voice chat room mode. If a user sets TeamID
to 1
and the voice mode to RANGE_AUDIO_MODE_TEAM
when entering a voice chat room, only members whose TeamID
is 1
can hear the user. If the user sets the voice mode to RANGE_AUDIO_MODE_WORLD
, players within a certain range as well as members whose TeamID
is 1
can hear the user.TeamID Value | Voice Mode | Range | Voice Reachability |
TeamID is not 0 . Suppose TeamID is 1 . | RANGE_AUDIO_MODE_TEAM | 10 meters | The user can talk with only members whose TeamID is 1 . |
| RANGE_AUDIO_MODE_WORLD | 10 meters | The user can talk with members whose TeamID is 1 and members in RANGE_AUDIO_MODE_WORLD voice mode within 10 meters in the same room. |
TeamID
set to 0
, the user will enter the range voice host mode, where all members in the room (regardless of their voice mode) can hear the user.TeamID Value | TeamID Modification Time | Range | Voice Reachability |
TeamID = 0 | TeamID is not 0 before room entry and is changed to 0 after room entry. | 10 meters | All members in the room (regardless of their voice mode) can hear the user. The user can talk with members whose TeamID is 0 .The user can hear members in RANGE_AUDIO_MODE_WORLD voice mode within 10 meters in the same room. |
| TeamID is 0 before and during room entry. | 10 meters | All members in the room (regardless of their voice mode) can hear the user. The user can talk with members whose TeamID is 0 .The user cannot hear other members in the room. |
TeamID
) needs to be set for them. A battle room can contain 100 players, i.e., 25 teams, so all those teams enter the same voice chat room. In a battle, if a player wants to communicate with a stranger within 10 meters, the player can set the range for hearing the voice to 10 meters and the voice mode to RANGE_AUDIO_MODE_WORLD
and enable both the mic and speaker. If the player wants to communicate with only teammates, the player can set the voice mode to RANGE_AUDIO_MODE_TEAM
.TeamID
set to OpenID
, voice mode set to RANGE_AUDIO_MODE_WORLD
, and range for hearing the voice set to an appropriate value so as to talk with players nearby. The singer can set TeamID
to 0
before entering the room to be heard by all members in the room without hearing other members.TeamID
set to a non-0 value and change TeamID
to 0
after room entry, so as to be heard by all members in the room while hearing players within a certain range.UpdateAudioRecvRange
(once at least) and call UpdateSelfPosition
once per frame.TeamID
TeamID
will not be automatically reset to 0
upon room exit. Therefore, once you decide to call this voice mode, do so to set the TeamID
before each call of EnterRoom
.ITMGContext SetRangeAudioTeamID(int teamID)
Parameter | Type | Description |
teamID | int | Team ID, which is used in range voice mode only. When it is set to 0 (default), the team voice mode is used. |
MODE_WORLD
upon room exit. Therefore, once you decide to call this method, do so before each call of EnterRoom
.ITMGRoom int SetRangeAudioMode(RANGE_AUDIO_MODE rangeAudioMode)
Parameter | Type | Description |
rangeAudioMode | int | 0 (MODE_WORLD): everyone; 1 (MODE_TEAM): team only. |
EnterRoom
, you need to call the following two APIs: SetRangeAudioTeamID
and SetRangeAudioMode
.ITMGContext.GetInstance(this).EnterRoom(roomId,ITMG_ROOM_TYPE_FLUENCY, authBuffer);
public void OnEvent(ITMGContext.ITMG_MAIN_EVENT_TYPE type, Intent data) {if (ITMGContext.ITMG_MAIN_EVENT_TYPE.ITMG_MAIN_EVENT_TYPE_ENTER_ROOM == type){// Analyze the returned dataint nErrCode = data.getIntExtra("result" , -1);String strErrMsg = data.getStringExtra("error_info");if (nErrCode == AVError.AV_OK){//If you receive a success response for room entry, you can proceed with your operationScrollView_ShowLog("EnterRoom success");Log.i(TAG,"EnterRoom success!");}else{//If you fail to enter the room, you need to analyze the returned error messageScrollView_ShowLog("EnterRoom fail :" + strErrMsg);Log.i(TAG,"EnterRoom fail!");}}}
UpdateAudioRecvRange
(once at least), and call UpdateSelfPosition
once per frame.UpdateSelfPosition
to update the sound source position.ITMGRoom int UpdateAudioRecvRange(int range)
Parameter | Type | Description |
range | int | Maximum voice reception range in the distance unit used by the game engine. |
ITMGContext.GetInstance().GetRoom().UpdateAudioRecvRange(300);
Update
.axisForward
, axisRight
, and axisUp
parameters as specified in "4. Update the sound source position (for the 3D sound effect)" in Range Voice.public abstract int UpdateSelfPosition(int position[3], float axisForward[3], float axisRight[3], float axisUp[3])
Parameter | Type | Description |
position | int[] | Your own position (forward, right, and up) in the world coordinate system |
axisForward | float[] | This parameter can be ignored in this product. |
axisRight | float[] | This parameter can be ignored in this product. |
axisUp | float[] | This parameter can be ignored in this product. |
public abstract int InitSpatializer(string modelPath)
Parameter | Type | Description |
modelPath | string | Enter null. |
public abstract int EnableSpatializer(bool enable, bool applyToTeam)
Parameter | Type | Description |
enable | bool | You can hear the 3D sound effect after enabling it. |
applyToTeam | bool | This parameter specifies whether 3D sound effect is enabled within the team and takes effect only when enable is true . |
IsEnableSpatializer
API can be used to get the 3D sound effect status.UpdateSelfPosition
to update the sound source position.ITMGRoom int UpdateAudioRecvRange(int range)
Parameter | Type | Description |
range | int | Maximum voice reception range in the distance unit used by the game engine. |
ITMGContext.GetInstance().GetRoom().UpdateAudioRecvRange(300);
Update
.public abstract int UpdateSelfPosition(int position[3], float axisForward[3], float axisRight[3], float axisUp[3])
Parameter | Type | Description |
position | int[] | Local position (forward, right, and up) in the world coordinate system |
axisForward | float[] | Forward vector in the local coordinate system |
axisRight | float[] | Right vector in the local coordinate system |
axisUp | float[] | Up vector in the local coordinate system |
FVector cameraLocation = UGameplayStatics::GetPlayerCameraManager(GetWorld(), 0)->GetCameraLocation();FRotator cameraRotation = UGameplayStatics::GetPlayerCameraManager(GetWorld(), 0)->GetCameraRotation();int position[] = {(int)cameraLocation.X,(int)cameraLocation.Y,(int)cameraLocation.Z };FMatrix matrix = ((FRotationMatrix)cameraRotation);float forward[] = {matrix.GetColumn(0).X,matrix.GetColumn(1).X,matrix.GetColumn(2).X };float right[] = {matrix.GetColumn(0).Y,matrix.GetColumn(1).Y,matrix.GetColumn(2).Y };float up[] = {matrix.GetColumn(0).Z,matrix.GetColumn(1).Z,matrix.GetColumn(2).Z};ITMGContextGetInstance()->GetRoom()->UpdateSelfPosition(position, forward, right, up);
Transform selftrans = currentPlayer.gameObject.transform;Matrix4x4 matrix = Matrix4x4.TRS(Vector3.zero, selftrans.rotation, Vector3.one);int[] position = new int[3] {selftrans.position.z,selftrans.position.x,selftrans.position.y};float[] axisForward = new float[3] {matrix.m22,matrix.m02,matrix.m12 };float[] axisRight = new float[3] {matrix.m20,matrix.m00,matrix.m10 };float[] axisUp = new float[3] {matrix.m21,matrix.m01,matrix.m11 };ITMGContext.GetInstance().GetRoom().UpdateSelfPosition(position, axisForward, axisRight, axisUp);
API Call Sequence of the Host | API Call Sequence of a Listener |
| |
In the Same Team | Within the Range | Voice Mode | Can A and B Hear Each Other |
Same team | Yes | MODE_WORLD | Yes |
| | MODE_TEAM | Yes |
| No | MODE_WORLD | Yes |
| | MODE_TEAM | Yes |
Different team | Yes | MODE_WORLD | Yes |
| | MODE_TEAM | No |
| No | MODE_WORLD | No |
| | MODE_TEAM | No |
In the Same Team | Within the Range | Voice Mode | Can A and B Hear Each Other |
Same team | Yes | MODE_WORLD | Yes |
| | MODE_TEAM | Yes |
| No | MODE_WORLD | Yes |
| | MODE_TEAM | Yes |
Different team | Yes | MODE_WORLD | No |
| | MODE_TEAM | No |
| No | MODE_WORLD | No |
| | MODE_TEAM | No |
Distance (Unit in the Engine) | Attenuation Coefficient |
0 < N < range/10 | 1.0 (no attenuation) |
N ≥ range/10 | Range/10/N |
Was this page helpful?