Skip to content

Multiplayer Series UE4 [2] – Deathmatch

Player Controller

Player Controller is needed for mainly interacting with widgets, key inputs and character. It also deals with background features that are happening on the player’s client.

Let’s create a Player Controller blueprint.

Name it as MPDM_PlayerController.

Create Enum called HUDInputMode in Enums folder.

Make it like this:

Open MPDM_PlayerController and enable Replicates from details panel.


Create all these variables, Event Dispatcher and EasyWidget function, don’t create OnRep_ServerJoinQueueNumber and OnRep_PlayerKick.

Make sure you enable Replicated for these two.

Once you switch this to RepNotify you’ll find OnRep_ServerJoinQueueNumber function.

Add an event dispatcher here.

Another RepNotify.

OnRep_PlayerKick, create Gameinstance blueprint and add KickMessage variable into it.

EasyWidget function. This will make our lives really easy.

Click for bigger

EasyWidget inputs.

In the event GetSpawnQueueNumber we get the player’s spawn queue number from Gamemode. This int value is binded to Event Dispatcher so whenever the value changes it will send a notification.


It’s Run On Server and it doesn’t need to be Reliable because it’s real time. Value would jump back and forth if connection was bad, delayed or no number would be better in that case.

Now you can create events for widgets and use EasyWidget.

In GameEnterWithTimerHUD we call GetSpawnQueueNumber and create a Timer which will wait till Spawn Queue Time is due and when it’s time it will switch to GameHUD.

We’ll create these widgets soon so come back here when you have them.


Here we have a Spawn event which will simply just add the player into Spawn Queue and then it switches to Timer HUD.


Spawn is Run on Server and Reliable.

DieOnServer event. This is Run on Server and Reliable.

When we come into Server Settings come back here and connect Auto Respawn boolean into branch.


Die event. This is Run on owning Client and Reliable. There’s a little safety feature so we don’t kill everyone on the server and someone else can’t kill you. Just your client can kill you. You may be like wait a minute… shouldn’t server have the only authority to kill someone, yes it should and as you can see the actual kill happens on server on DieonServer event this is where we destroy player’s pawn and when we get into health bar we will create an automated feature that will monitor player’s health and automatically kills them when they lose all their health. So there’s nothing wrong about this.

In a lot of games player’s can kill themselves, this is basically that kind of feature. If other player’s start killing other player’s with hacks then that is when you have a problem. Also it’s one reason to keep this Run on owning Client. I remember getting some interesting results somewhere in autumn 2020 when i invented this (when there was no IsLocalController) so try it yourself.


KickFeature event. To get the Bind Event drag from Gamemode cast and type Assign. We need to check that the message is delivered to the correct player so we don’t send the same message to everyone and kick all players, that would be funny.


BeginPlay event. In here we get the player id, change from black screen to lobby hud and arm kick feature. We also need to check that the client receives player id. It’s probably best to kick player or swap player controllers if player id is not received in 30 seconds or so. Also the lobby hud should stay on hold before player id is saved on the client.

EnterServer event is Run on Server and Reliable. This is when the player has selected a team.


You can test the death feature just by doing this:

It’s important that we add all Widget functionalities in Player Controller, you may see in youtube that a lot people put all widget stuff in Character blueprint, this is just stupid, when you get rid of character or switch to other pawn you lose all those features. It all belongs in Player Controller because player controller will stay with the player from joining the server and to leaving. It’s easy to use and it has the authority feature, it will know who it belongs to (on server), it’s a really secure place to add buttons and do things that should only happen on the client. Never add widget features in character or pawn class, unless the character has some kind of special feature.

Also your player controller doesn’t exist in other clients, only on server and in your game instance, your pawns and characters will exist on other clients though.

Pages: 1 2 3 4 5
Notify of
1 Comment
Newest Most Voted
Inline Feedbacks
View all comments

[…] Part 2 – Deathmatch Gamemode […]

Level Paradox
Would love your thoughts, please comment.x