Download

Voice Chat/Shooter Game Question

So I have been hacking away at this for probably more hours than a programmer of even below average skill. I am using a blend of blueprints and c++, not sure if that changes anything. I have followed the networking tutorials and can build a developmental project where I use the command line with “open <mapname>?listen” then on a separate computer do “open IP address” and join that session. So victory there. I can also setup behaviors in blueprints and have my keybindings working on both the server and the host.

How do I get voice to work over that? I started with a blank coding template and I have tried to use shooter game and what I can find online. I’m doing this on Mac’s by the way. So in my DefaultEngine.ini file I put:


[OnlineSubsystem]
DefaultPlatformService=Null
bHasVoiceEnabled=true
PollingIntervalInMs=20

[/Script/OnlineSubsystemUtils.IpNetDriver]
InitialConnectTimeout=120.0

[Voice]
bEnabled=true

The shooter game code had a DefaultGame.ini, which wasn’t a part of the blank project so I added one that says:


[/Script/EngineSettings.GeneralProjectSettings]
 bRequiresPushToTalk=false

My project is called PleaseTalk, so here is my PleaseTalk.h file, also borrowed from shooter game:


#pragma once

#include "Engine.h"
#include "Net/UnrealNetwork.h"

#define MAX_PLAYER_NAME_LENGTH 2


/** Set to 1 to pretend we're building for console even on a PC, for testing purposes */
#define PLEASETALK_SIMULATE_CONSOLE_UI	0

#if PLATFORM_PS4 || PLATFORM_XBOXONE || ******_SIMULATE_CONSOLE_UI
#define PLEASETALK_CONSOLE_UI 1
#else
#define PLEASETALK_CONSOLE_UI 0
#endif

In my player controller I added this just to see if I needed to call the talking function:


void APleaseTalkPlayerController::SetupInputComponent()
{
    Super::SetupInputComponent();
    // voice chat
    InputComponent->BindAction("LiveTalk", IE_Pressed, this, &APlayerController::StartTalking);
    InputComponent->BindAction("LiveTalk", IE_Released, this, &APlayerController::StopTalking);
}

Everyone says look at the shooter game example, but what files need to be brought into other projects? I’ve had people suggest look at ShooterGameSession.h/.cpp, but when I try to copy that script in I end up needing stuff from other scripts. Do I need to code a player state, online game settings, a game state, a game instance, an HUD main menu? The more I bring over, the more compiling errors demand I bring over more scripts from the shooter game example.