Rpc problem

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 the server (it only calls from server to server) but from the server I can call multicast events. I have done my research and found stuff that says the client needs to own the object in order to call a RPC. I can call server event on player controller but when I want to call the grid function from the server nothing happens unless I am on the server.

My grid events and replication options:

My player controller events and replication options:

The output when called on client and when called on server:

36066-server.png

Here’s the problem.

Replicated objects are managed by the server, not by the client, Grid is not a replicated variable, so it is locally referenced. The server has access to it’s own Grid, but when the client makes the call for the server, it will look at the replicated object and see that Grid is none (because it only exists on the local client).

Billy Bramer made an amazing tutorial for networking in blueprints, it greatly explains how UE4 handles RPC.

Hope it helps :slight_smile:

I’m sorry but the grid is indeed replicated I must have used the player controller replication image when making the final image.

Player controller is not replicated by default, so replicating variables inside of an object that is not itself replicated won’t work either.

What variable should I replicate in my player controller? I tried spawning the grid from the server but it changes nothing .

I greatly suggest keeping variable replication out of Player Controller (which >>is not<< replicated by default) and keep all your replicated variables inside of Player State (which >>is<< replicated by default).

You can leave your RPC calls inside of player controller, those will still work just fine, just keep replicated data out of it and into something like PlayerState which was made specifically to hold those variables for replication.

But it does not help me call the grid.

The problem is, that you can only call RPCs from your PlayerController as you already found out by your self. Calling it form GameState or a possed Pawn should work aswell.

I personally do not like this limitation because it restrains the possibility of modular programming.

Does anyone know if those limitations exist in C++ scripting as well?