With most games becoming multiplayer focussed or having a seperate mode for multiplayer, many users expect rich features on launch. Features even in early access stages of development such as voice chat, friends lists, inviting to parties from AAA to indie titles.
With only a small amount of setup you can add fully working voice chat using only blueprints into your game without any C++ knowledge using any version of Unreal Engine 4.
Before we Start
Unreal Engine’s voice chat only works correctly when your multiplayer game uses the session system. To learn about the session system in Unreal Engine 4 click here.
Setting up Voice Chat
To tell the engine that we want to enable the voice chat features there are a few configuration files (.ini) that need to be changed. The files we need to change are DefaultGame.ini and DefaultEngine.ini. No additional software is needed to change these files. Notepad works fine.
To find these files open your project folder and navigate to the config folder.
Here are the two files we need to edit:
To edit them, right click the file and select open with then click notepad:
Once open, scroll down to the end of the DefaultEngine.ini file and copy and paste this section to enable the voice system on the engine. Save and exit this file.
[Voice] bEnabled=true [OnlineSubsystem] bHasVoiceEnabled=true
DefaultGame.ini is last file that needs to be changed. Open this using the same method as DefaultEngine.ini and paste one of the sections below to enable or disable push to talk.
Enabling push to talk gives your players the ability to only send their voice when pressing a button down.
Disabling push to talk sends voice data all the time regardless if the player wants to send their voice or not.
It is recommended that you enable this as most players prefer their voice data only being sent when they are ready to talk.
To enable push to talk, copy and paste this section:
To disable push to talk, copy and paste this section:
Save and close the file.
Open your project from the .uproject file in your project folder and wait for the engine to load.
If you have enabled push to talk in the DefaultGame.ini file in the above step, you will need to setup key press input to start and stop push to talk. If you did not enable push to talk you can skip to the conclusion.
The first step is to open your player controller blueprint. In my project I have created a new player controller named PlayerControllerVoice.
If you do not have a custom player controller, simply create one from the content browser and assign it to your game mode.
Adding the Voice Chat Key
Once your player controller blueprint is open on the event graph right click anywhere on the empty space and type the name of the key you want your players to press in order to talk. In my case I used the V key.
From the pressed and released pins of the input key event create two “Execute Console Command” nodes.
At this stage it should look like this:
In the command input of the pressed “Execute Console Command” node type:
In the command input of the released “Execute Console Command” node type:
Now when your players press the input key (in my case V) they will start sending voice chat information. When they release the key they will stop sending voice chat information.
Download the Project Files
These example projects have fully working voice chat using the Steam online system using Unreal Engine 4.23.
Voice Chat is now fully working. Completing the additional steps gives you the option of enabling and disabling sending your player’s voice through push to talk!
To improve this system you could do the following:
- Add positional voice chat to your system.
- Add the Advanced Sessions Plugin which gives access to blueprint nodes of many C++ only voice and online features (muting other players, friends lists, inviting players) found here: https://forums.unrealengine.com/community/community-content-tools-and-tutorials/41043-advanced-sessions-plugin
- Use Input actions for push to talk allowing players to rebind their keys