Jump to content

Introducing Voice Chat in Leadwerks 4.6

Josh

91 views

The next update will include a new networking system with built-in voice chat for multiplayer games.

Voice communication is built into your game and can be enabled simply by turning it on when a specific key is pressed:

void Voice::SetRecording(window->KeyDown(Key::T))

You can selectively filter out users so your voice only gets sent to your own team or to a specific player:

void Voice::SetFilter(const uint64 steamid, const bool state)

When another player sends their voice data to you, the engine will automatically receive and play the sound. You can also retrieve a sound source for a specific player and make adjustments to it. This can be used to enable 3D spatialization and position the sound source where the player is, for VR voice chat.

Source* Voice::GetPlayerSource(const uint64_t steamid)

When I first implemented this the sound was sometimes choppy. I added some automatic adjustment of the pitch to slow down the sound a bit if new data is not received yet, and to speed it up if it falls too far behind. This seems to work really well and I'm sure it must be a common technique in applications like Twitch and Skype.

A new multiplayer game template will be provided that shows how to set up the framework for a multiplayer game. Here's a video preview of the voice communication in action.

 

  • Like 5


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Create Your Account

Sign in

Already have an account? Sign in here.

Sign In Now
×