Download

Networking help: replicated event confusion

Hello there,
I can’t seem to wrap my head around how the Networking on the server works.

I made a very simple blueprint of a replicated Event, which outputs whether a PlayerController has Authority or not.

A) I call the replicated event from the Client
Client output:

  • False
    Server output:
  • False
  1. Isn’t the server supposed to output True?
  2. Or is the Player Controller also replicated?
  3. Or is there a client IN the server which responds with False??

B) I call the replicated event on the Server
Client output:

  • False
  • True
    Server output:
  • False
  • True
  1. How come the client output 2 strings, does that mean that the Print String along with the string is replicated?
  2. Why are there 2 outputs to begin with, is there both a ROLE_REMOTE and ROLE_AUTHORITY on the server??

Does anyone have any input on that? Thank you.

Edit:
Ok, I think I got it, it seems that the Print String is replicated and not the actual “Event call” (unless it is the server calling), very confusing indeed.

After setting the event to “Run on server” I can’t get the client to trigger that event on the server, any idea?

if you check this diagram graph at bottom of this page, https://docs.unrealengine.com/latest/INT/Programming/Gameplay/Framework/QuickReference/index.html
You know that PlayerController is “joining” the server, and if you inherit one, the default setting is not replicated(since it contains other things shouldn’t be on server, like HUD).

And for input events, check this link, https://docs.unrealengine.com/latest/INT/Programming/Gameplay/Framework/Input/index.html
you can see that input events goes to most recent input enabled actor(doc explained it), player controller, level bp, and then pawn, before it goes to game logic(your corresponding BP graph).
If any of the actors in the input event processing decides to block input, it will not pass on the the next one, or if one component takes it(has that event in it’s event graph), it will also not pass to following stack.

To trigger from an input event, your player controller need to possess some valid actor. Reference here "Run On Server" RPCs... doesn't work? - UE4 AnswerHub
I have no problem doing server RPC once the initial setup is done, but I have problem trying to repossess a pawn I spawned on server to a player controller which its original pawn died.

Thank Penguin, I’ll check out those docs,
The problem arose when I had a Pawn on the level which nobody possessed, from the Client I sent a query to the Server to ask for Possession,
everything working fine until the Server decided not to replicate the possessed actor and didn’t tell the client who possessed it.
However, the server character had no problem taking possession of the Pawn.

I almost gave up networking with blueprints, but I’ll be sure to read those documents you linked!

Edit: Can’t believe I missed that important bit lol, I was trying to replicate an RPC from the Client Level Blueprint which of course I don’t possess nor own,
after running the code from the possessed actor it worked just fine! Thanks