Jump to content

Introducing Voice Chat in Leadwerks 4.6

Josh

403 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 6


0 Comments


Recommended Comments

There are no comments to display.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...