+1 vote

I am doing server-client high network multiplayer game. And I have to make some rpcs(obviously). Steps of what i do: A player connects to a server. he sends some info to a server. The first time it works as it should, then i leave the waiting room, which deletes this player from server and disconnects him from server. Then I try to rejoin the server, and it connects to it, but the sending of information fails. It doesn't produce any error. it just does not execute. The code below should be enough to see of what is happening. If something more is needed, i can send:


func _connect_to_server():
    get_tree().connect("connected_to_server", self, "_connected_ok")
    network.create_client(selected_IP, selected_port)

func _connected_ok():
    print("Successfully connected to server")
    rpc_id(1, "send_player_info", local_player_id, player_data)

func register_player():
    local_player_id = get_tree().get_network_unique_id()
    player_data = Save.save_data
    players[local_player_id] = player_data


func start_server():
    network.create_server(port, max_players)
    network.connect("peer_connected", self, "_player_connected")
    network.connect("peer_disconnected", self, "_player_disconnected")

    print("Server Started")

func _player_connected(player_id):
    print("Player: " + str(player_id) + " Connected")

func _player_disconnected(player_id):
    print("Player: " + str(player_id) + " Disconnected")
    rset("players", players)

remote func send_player_info(id, player_data):
    players[id] = player_data
    rset("players", players)
in Engine by (13 points)

Please log in or register to answer this question.

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.