+2 votes
func onConnected():
    rpc("registerPlayer", get_tree().get_network_unique_id())

remote func registerPlayer(id):
    print(id)

call only server, not slaves. This is a bug? I can give Git repository for repeat this problem.

Godot ver. 3.2
OS Ubuntu 16.04
enter image description here

in Engine by (17 points)

2 Answers

0 votes
Best answer

I assume your onConnected() function is connected to connected_to_server signal.
This signal is called after peer connects to server but before it connects to any other peer.

Try connecting some function to network_peer_connected signal of SceneTree. It will be called once per peer you're connecting with. It's called for server as well.

Another option is to register new player on server and make server inform eveyone that new guy has joined.

by (2,298 points)
selected by

I assume your onConnected() function is connected to
connectedtoserver signal.
Yes it is.

This signal is called after peer connects to server but before it
connects to any other peer.
I did not know this, thx!

+1 vote

Change your function to:

sync func registerPlayer(id):

The issue is that remote is called only from other boxes, while sync will also call it on the current. Its not necessarily a master vs slave issue.

by (235 points)

The issue is that remote is called only from other boxes
My remote func is not called in other boxes, only server. It works like master keyword and i understand why?

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 Frequently asked questions and 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 [email protected] with your username.