How to set up Player Controllers for MP game

I think I’m losing my hair over this one, I’ve tried all I can but I have to admit defeat.

I am trying to make a MP game via the Steam OnlineSubsystem.

I have built my session browser and it is working correctly so everyone is able to join.
However, I am having an issue with getting each players PlayerController and following events from there.

I’ll show my blueprints for what I’m doing and I’ll explain what I want it to do, from there you can tell me just how wrong I’m going:

Firing Event from Testing Pawn:

Projectile Test Blueprint:

Hit Event from Testing Pawn:

The last screen there I know doesn’t work as I haven’t assigned an owner to it. The idea is that on the event that damage is taken, the player that fired the projectile will get a quick message flash on screen saying that they hit the player. Looking at the overall setup, I know it’s wrong but I don’t know any better.

I deal situation is:

Player 1 fires and HITS Player 2
When the 500 damage has been applied, Player 1 gets a message saying they hit Player 2

Ideally I would like to get the players username from their PlayerState.

Any thoughts or input would be greatly appreciated.

Also, any devs know if there is any documentation as to setting up games for Online MP?


Hi ,

For your hit message, it sounds like you want to pass the “instigated by” parameter of the “Any Damage” event in as the target of your “Hit Message” event. This should run the hit message for the player who fired the projectile, assuming the instigator passed in to “Apply Damage” is correct.

Based on the screenshots, it looks like you should be able to just call the “Get Controller” function in your pawn blueprint and pass the result in as the instigator when you spawn the projectile actor.

To display the hit player’s name to the hitter, you can get the player state from the pawn (or its controller via “Get Controller”) in the “Any Damage” event, and pass the player name as a string parameter to your “Hit Message” event.

Hope that helps!

Hi ,

I tried doing this but didn’t have any luck for some reason.

I have however since tried running all the scripts through the PlayerController BP and referencing self for the events. This now works :slight_smile:

Thanks for the input though, it’s always appreciated.

Hello again, seems it’s time for me to eat my words.

It doesn’t appear to be working properly and I was a chump for thinking it was.

Here’s the current setup I have for the Hit messages and what’s happening in game.

Server Shoots and Hits:

Client Shoots and Hits:

Pawn BP for “X Hit you” message:

PlayerController BP for “You hit X” message:

Any more input would be appreciated, sorry to dismiss it so quickly last time.
Also, for the target in the event, I can only reference self.


Hi ,

Nothing stands out to me about the hit and damaged message events, it looks like they should work - but they do rely on the instigator being set correctly. I’m not sure how you’re spawning your pawns, but in most common circumstances tracking the instigator with the possessed event manually should be unnecessary.

I’m also not sure how you are calling the Fired and ServerFired events, but it looks like it’s possible for both the client and the server to hit the node that spawns the projectile actor. Replicated actors will only actually replicate if they’re spawned on the server, so the client should probably not be spawning projectiles. Also, since the server does have a PlayerController for each client, in this case the server should be able to get the pawn’s controller directly and pass it in as the instigator for the projectile.

Cheers for the quick reply.

I’m not actively spawning the pawns, when you load in to the level / connect to the server you automatically possess them. Could you give me an idea as to if I’m setting the insitgator wrong? It’s on the Event Possessed node.

Here is the Fire and Server fired events. This set up is the only way I got it to work where the player is also the server as per the case of Listen servers.

Again, any and all input is appreciated.

I take it atleast I am explaining what I want to achieve here properly?


Hi ,

First of all, I apologize - I now realize that the spawn actor node’s instigator parameter is a pawn, not a controller, so some of my previous comments may have been confusing.

To achieve what you want, I don’t think you have to handle the possessed event at all, and you can probably remove your custom instigator variable altogether.

A setup like this in the pawn blueprint should work for spawning actors on the server, including listen servers. If it doesn’t, please report it as bug!

Yup, that fire set up does work. Didn’t in the past so looks like that bug has been swatted on the way.

However I am still left with my message issue where it is only working on the server. Is there any way of me sending you my files to have a look at?

Happy to help, . I take it your messages are working correctly now?

I’ve been looking in all the wrong places, I was looking at the event and not the UMG… Pfft… Learning UE4 MP first is a pain but rewarding. I’d love if there was some more documentation regarding MP but that’s just a personal gripe. I’m actually learning UE4 for a Games Development course this year. Want to get ahead of everyone before I even start.

Thanks for your help, .

They are indeed - Inside the UMG is was calling for Player Controller rather than Pawn Controller. Got to stop thinking SP :slight_smile:

Now just to solve the issue of why my sessions are showing up on LAN but not over the internet, even when LAN is disabled on the create / find session node.

I’m using the APP ID 480, so I don’t know if that would cause a problem.

Glad to hear it. If you need help with the session issue, please open a new question, thanks!