[c++]Need help spawning blocks in grid multiplayer

Hello I’m currently having a hard time with a project I’m working on.

It is a video game made using unreal engine 4 and i have to implement the network part on the project. So first of all, we have multiples pawn possessed by players, every player is allowed to spawn blocks(can be different type of blocks). We are currently using a Grid (an actor) that stores all the blocks in the world. We are using a GridManager ( an UObject) to manage the grid.

The GridManager can create AActor : BuildingAction, PushAction, FallingAction, and all others action that can be applied to any blocks in the grid. So i know that for spawning theses action and block i need to call RPCS from either the PlayerController or the pawn. The problem is that because the gridManager manages the grid and Spawn the actions on the world, the actions dont work on multiplayer. I guess spawning them in the player controller would work but it would need a function for every type of block and a function for every types of actions on the player controller, this would make no sense to store these functions on the player controller. If anyone could help me finding a good way to make this work on the network , it would be very helpful.

to spawn anything in multiplayer you need to spawn it on a server side otherwise no other clients will see it. This is the only way of doing it.

You will need to make functions that are marked to be executed on the server (UFUNCTION(Server)). Calling those will get your spawning working/visible blocks for all clients.

Also, I would highly recommend to read this pdf: http://cedric-neukirchen.net/Downloads/Compendium/UE4_Network_Compendium_by_Cedric_eXi_Neukirchen.pdf

The RPCs work if i call them on controller or a possessed actor. My problem is that actor are getting create by The Grid that is an actor and isnt possessed by any player. So the RPcs get dropped by the server and are not executed.

Can you make The Grid a part of Game State/Instance, for example? Or pass information that you need to spawn to the player that will make RPC it to the server?

I kinda succesfully achieve to do it by going through all the classes and gathering the neccesary stuff and then calling the rpc on the player controller to spawn the actors. I dont think it makes sense to spawn my actors from the player controller but a least it works. Thanks for your help!