Rpc

I have a blueprint that is replicated, a player controller and two pawn(To keep player data) my game is a turn base puzzle RPG.

My problem is that in my main blueprint I can’t manage to call event on server (it only calls from server to server) and I can’t call multicast event. I have done my research and found stuff that says client needs to own object in order to call a RPC on it but I currently have no idea how either I could set so my main blueprint is own by each client, trick engine by calling it on an object owned by client(how can I know that ? i have tried on player controller it does not works) or anything I haven’t though of.

I think using PlayerController is right approach, like you found from your research. Forgive me wall of images, but here’s a visual breakdown of non-owner RPC problem and how you can solve it this way.

Setup: You have a replicated puzzle object that is owned by server, and some number of other clients.
Problem: Server RPCs can only be called from owning actor. Since server owns puzzle object, there is no way for replicated puzzle objects to communicate to server object.

Solution: Clients can route a call to server through their PlayerController, since they own it.

Here are functions you would need for an example solution:

PuzzleObject::OnClicked
PuzzleObject::ProcessMove (authority only)
PlayerController::PuzzleClicked
PlayerController::ServerPuzzleClicked (server RPC)

If click comes from server, you just do this:
PuzzleObject::OnClicked -> PuzzleObject::ProcessMove

If click comes from a remote client, you do this:
PuzzleObject::OnClicked -> PlayerController::PuzzleClicked -> PlayerController->ServerPuzzleClicked -> PuzzleObject::ProcessMove

I am a little bit closer I can call server event on player controller but when I want to call grid function from server nothing happens unless I am on server.

My grid events and replication options:

My player controller events and replication options:

output when called on client and when called on server:

36066-server.png

Replication seems to be a dangerous topic, everything I find is either no answer or a few but never a full answered question. I really don’t know what I am doing wrong.

When calling from player controller on server, it seems impossible to call an event on puzzle object. Is it even possible? do I need two puzzle object one for each client, do I need to call all heavy validation server stuff on player controller or even any other idea?

Even if you have no idea, say hello. :slight_smile: I feel lonely in this forum. :frowning:

Is there really no one at all able to answer my question?

Hi 123rockon,

To alleviate some of your confusion, you might want to read through our new documentation on Networking in UE4:

Included in there is a description of gameplay framework (who can talk to who) and ownership. Benholio’s comment has a useful graph, as well.

Thank you, I will look through all this documentation :).

I tried everything I can think of and read doc but I still can’t figure this out.