+1 vote

Hi
I want to ask that if i call an rpc() from a client connected to a server then will it call the remote function on all peers (including server) or in all exept the server?


Does rpc() calls the remote function locally?

in Engine by (883 points)

I'm pretty sure it will call it on the clients and the server.

1 Answer

+1 vote
Best answer

RPC will only call the function locally if you've set it to be that way using rset or the corresponding keywords

RPC will only call the function on peers that have been setup to receive such calls so if your code for the server is the same as the client then yes the server will also run the function

#will be called on all peers that has it
remote func rpc_function():
    pass

#will only be called by master peers
puppet func rpc_function():
    pass

#will be called on all peers(even server) and locally
remotesync func rpc_function():
    pass
by (4,308 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.