Token based Voice Chat with EOS
If you want just basic voice chat in your game with matches, we suggest you to use the Lobby based Voice Chat instead of this. This is for advanced users who want to control the voice chat in their game as they want and hence also requires a bit of setup
Setting up the Voice Chat in Epic Developer Portal
To use token-based voice chat, you need to create a separate client and voice policy. Token-based chat functions as a distinct EOS feature that can operate independently from other EOS features. You don't need to log in to EOS to use it; you can log in to EOS Voice Chat directly, independent of the account service or game service.
But to use EIK Positional Voice Chat you will need to use account service to login to EOS and use client PUID as Player Name
input.
Adding Client Policy in Epic Developer Portal
Add a new client policy and name it as you wish. Use a custom client policy type to set only the options that we need for Token Voice Chat.
Adding Client Policy and Voice Client in Epic Developer Portal
We only need those three policies.
Now create new Voice Client and use our create policy for it.
For the last step, we need to add a separate artifact in our EOS Integration Kit plugin project settings. Use the same name for the Artifact Name
, and fill in the required inputs as you did for the EIK setup. However, this time for Client ID
and Client Secret
, use ours Voice Client.
Setting up the Voice Chat in Blueprints
Voice Room Name
- The name of the voice room that you want to join. For instance, if you have a game similar to Pubg or Fortnite, where there are 100 players with teams of 4, then you can have 25 voice rooms with 4 players each. This will allow you to have a voice room for each team.
Player Name
- The name of the player that you want to join the voice room with. This is the name that will be displayed in the voice room.
Client IP
- The IP of the client. You can use 10.0.0.1 as the default value if you don't want to pass the IP. If you pass the IP, EOS will connect you to nearest available voice server.
Cannot view the code? Click here (opens in a new tab)
Voice Functions
EIK provides you with a set of functions that you can use utilize to have better Voice Chat in your game. These functions are:
Get Player Volume
This function is used to get the volume of the player. This function takes in the following parameters:
Player Name
- The name of the player that you used to join the voice room.
Set Player Volume
This function is used to set the volume of the player. This function takes in the following parameters:
!!!danger
EOS has a bug where the volume can be set only at 0, 100 and 200. We have workaround for this bug which will be shown later.
!!!
Player Name
- The name of the player that you used to join the voice room.
New Volume
- The new volume of the player. This value should be between 0 and 200.
Get Player Muted
This function is used to get whether the player is muted or not. This function takes in the following parameters:
Player Name
- The name of the player that you used to join the voice room.
Set Player Muted
This function is used to set whether the player is muted or not. This function takes in the following parameters:
Player Name
- The name of the player that you used to join the voice room.
Mute Player
- Whether the player should be muted or not. This value should be either True
(Player should be muted) or False
(Player should not be muted)
Get Joined Room Names
!!!info 📢 Some good info This means that you can join multiple rooms at the same time. This is useful if you want to have a team voice chat and a global voice chat at the same time. !!! This function is used to get the names of the rooms that the player has joined. This function takes no input parameters.
Get Joined Room Players
This function is used to get the names of the players that have joined the room. This function takes in the following parameters:
Room Name
- The name of the room that you want to get the players of.
This will return an array of players that have joined the room with their names you used to login them into the voice chat.
Get Available Input Methods
This function is used to get the available input methods that the player can use. This function takes no input parameters.
You can break the returned array to get the available input methods with their ID
and Display Name
.
Get Available Output Methods
This function is used to get the available output methods that the player can use. This function takes no input parameters.
You can break the returned array to get the available output methods with their ID
and Display Name
.
Set Input Method
This function is used to set the input method of the player. This function takes in the following parameters:
Method ID
- The ID of the method that you want to set as the input method which can be taken from the Get Available Input Methods
function.
Set Output Method
This function is used to set the output method of the player. This function takes in the following parameters:
Method ID
- The ID of the method that you want to set as the output method which can be taken from the Get Available Output Methods
function.
That is all you need to know to setup the voice chat in your game!