Networking RPC and owners
I'm setting up a multiplayer board game and i'm having some networking issues i'm trying to fully understand. I have a game board blueprint static mesh AActor object in the level that I want to use to trigger custom events to create the players.(the game has no default pawn setup: defaultpawnclass = null) Right now I just have a custom event that prints to the screen but when I PIE with a client only the server triggers the event. I understand that you need an actor that is owned by the client in order to run the RPC.
How do I trigger RPC (run on server) if I don't have a default pawn? Is there a way to assign the game board to be owned by the client and the server so it triggers the RPC in that blueprint?
I got it working correctly if i assign a default pawn and put the custom event in the custom pawn class but i want to avoid having a default pawn getting created on game startup.
One solution is to make a derived blueprint off the CustomPlayerController since that will have a connected owner, is that a valid solution to add making game pawns in the player controller (it would call game mode functions)?
Originally i wanted the player creation logic in the game mode but since the game mode is only on the server the RPC didn't trigger through the clients
There are many different AActors that can be owned by the client, not just a APawn. In your case, if the client is truly connected and past login, then he has an APlayerController that you can put a "server reliable" RPC on.
Any actor that is spawned where the APlayerController is part of the owner chain (pawn, hud, etc), can have an RPC on it.
The client can call this function to have work done on the server. Alternatively, based on what you are trying to do, also after login, the server can call a "client reliable" RPC on the same object owned by the client, but on the server, to do work on the client.
Follow this question
Once you sign in you will be able to subscribe for any updates here