Jambax
(Jambax)
January 12, 2015, 5:58pm
6
One key difference between how blueprints and C++ handle the “rep notify” concept is that in blueprints any time a RepNotify variable is set, the OnRep function is automatically called on the server (and on the client when the update happens). In C++, the server does NOT automatically get the ReplicatedUsing function called, only the client does when it gets its update. If you want the server to call that function, you have to do so manually. I’ve had a decent number of requests to show porting the last 2 parts of the blueprint networking tutorial to C++, so I’m hoping I can do that some day soon when I find some time.
Also, whenever you are changing health, you’ll want to make sure you’re only doing so on the server. If you aren’t already, the C++ equivalent of the blueprint macro node for checking authority is:
if (Role == ROLE_Authority)
Hi Billy, could you provide a quick example of how to do the call for the RPC on the server as well? I’m following the tutorial along right now and trying to program in the C++ equivalent.