Download

Remote Function Call Networking

Hello, I have been working on a networking a game. I have successfully replicated actors as they now both appear in server and client. However I have now started working on remote function calls, to ensure actions carried out on the client are also carried out on the server. I have been using the Shooter Game Example and Unreal Wikis, and believe I followed them correctly, resulting in the code attached. Currently when I step through the code, it passes the client check but does not execute the ServerFireLaser function, from what I can tell as it never reaches the breakpoint or executes any of the code within said function.

Can anybody explain why it is not working and/or where I am going wrong.
Thank you in advance, Bickers.

Sounds just like my situation.
I was informed of the importance of Client having to Own the object triggering the RCP so I tried to add setowner to the identified local default ue4 playercontroller. (I re printed the name after to check)
But still it does not want to trigger my RCP spawn.

Hi Bickers,

Can you tell us with what kind of game instances you tested this? Did you test this using a listen server and a remote client? Or only a listen server?

This may be unrelated but my experience is that if you try to test network code.
And you are running PiE (Listen or Dedicated Server) and with (Run as Single Process = true “Checked”).

Role will always be == Role_Authorety (3) so if you are testing like that uncheck the Run as Single Process.
That way you get the behavior you are looking for.

Hope this helps.
WCode.

Doesn’t seem to be the cause of the problem, ShooterGame has Single Process checked and runs great in PIE. (Unchecking Single Process makes us crash on load).

Well thats not good, so your game crashes as soon as you launche a Standalone Client/Server?
If you crash on load when not running single process i whould start there, thats my 2 cents atleast.

Yeah I agree, something to do with our Game Instance class. Guess we’ll have to come back to this one later, I can’t see another reason why the RPC just wouldn’t call at all.

Okay so we figured it out, the issue we had is that we we’re trying to call functions on an Actor, but the client did not own the actor. Their pawn can talk to and interact with it, but because they don’t literally own it in Unreal terms, they can’t call RPC’s on it.

We’ve got around this by instead doing the RPC in the pawn, and the pawn subsequently automatically performs it’s behaviour with the Actor as intended.