I have had various piers who succeeded with networking, attempt to help me, but nothing has worked. No matter which way I set-up my blueprints, nothing seems to make my game function correctly. To which I have concluded that it must be an engine bug.
- My game is using a Listen server with
- It involves game pieces which are
using a ‘Pawn’ parent class.
- Each piece type has two blueprints:
An inactive piece, and an active
piece. Clicking on the inactive piece spawns an active piece actor, then destroy’s the inactive piece actor, in that order.
Below can be seen one of my many attempts for the inactive piece blueprint (pawn parent class).
Setup with click events triggering a
reliable custom event that’ll fire
the game-play essential code to run
on the server. The server player is
able to activate these events with
no noticeable issues. The client
player’s click does not fire the
custom event to run on server.
Nothing happens on neither client or
server windows after the client clicks.
I’ve tried setting the custom event to multicast, though it yields very strange results. I’ve tried using authority nodes but I have a similar problem where the client isn’t able to give input.
I’m running Unreal Engine 4.7.2 currently
Here are my replication and input class defaults.
It should also be noted that everything is fully functional in single player.
“Run on server” events will only actually run if the target actor is owned by the local client’s PlayerController. The pawn sending the event will have to either be possessed by the client’s PlayerController, or the event can be sent directly from the PlayerController itself or the PlayerState (you can pass the actual pawn reference as a parameter to the event if you go this route).
Sorry to be a pest but I’ve just tried everything you said and continue to get strange results.
Here I’ve set-up my blueprints to possess the pawn sending the event after the click. (Not the most practical solution because the camera is moved by the possession, meaning I had to attach a camera to the pawn).
The client clicks, possesses the pawn. The event doesn’t fire.
The server clicks, both the client and server possess the pawn. The event fires. The client’s camera is in the wrong place, and then presumably teleports into black space after about two seconds.
Then I tried running the event through the PlayerController as you suggested. This still didn’t yield any of the results I hoped for.
The client clicks, nothing happens.
The server clicks, the event fires, and the client possesses the pawn despite this code being removed. It’s camera is inside the pawn for two seconds then it’s camera teleports into black space.
I’m not entirely sure how I would go about sending the event through the PlayerState. Can you please elaborate on that.
Not sure if it’s relevant to the problem but I’m actually experiencing another annoying bug with my Unreal Engine project:
The Pawn and HUD keep being reset to the default Pawn & HUD in my game-mode settings. No matter how many times I save.
First of all, we recently updated and expanded our networking documentation, with lots of useful information, I think it will be very helpful - especially the section on Blueprints.
Since your game appears to have multiple pieces controlled by each player, possession is probably not the best option for this case - it’s mainly meant for when a player is controlling a single character. I’d recommend using the player controller here.
In the screenshot of your player controller blueprint setup, the “White Pawn I” property is not being sent to the server. Properties are only replicated from the server to the client, to send data from a client to the server, it has to be a parameter of a Run on Server event. Also, it looks like the WhitePawn_I_Clicked event is set to multicast, but multicast events don’t fire from the client.