I’m trying to make a simple mouse aim top down shooter game. I would like to replicate the rotation of the controlled character to all connected clients but I can’t get it to work.
I tried using an RPC from the controller to then set the controlled pawn’s rotation. The server works fine and is replicated to all clients. But the clients don’t rotate, not client side nor server side.
Not sure if this is the best way to do it, but it works. Tested it with 3 clients.
Explained:
I first set the rotation of the controlled character through the controller. The rotation is replicated. I then do an RPC to update the actual actor rotation to all the clients. And then I do the rotation on the client itself. Hope it helps anyone having the same issue.
Don’t mind the casting I did in the controller. I should store a ref to the character when it’s initially controlled. Still need to fix that.
One more question:
How bad for latency is it to do an RPC every tick? Would it be smarter to lerp the rotation of the character and use a reduced rpc tick rate? Such as every second in stead of every frame? Note though that the game I’m making is designed to be a co-op game for 2 to max 4 players. Not a battlefield type of game with hundreds of players. Still, I guess optimization is never a bad thing.
Also, would it be advised to make the rotation RPC reliable? The actual projectiles players will fire will be calculated seperately. The rotation is kind of purely visual, so from what I’ve learned so far it shouldn’t be reliable.