RPCs are not being received for this particular Node

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By k4gi

hello i’m having a confusing time with some RPCs. i’ve got other communication working and it’s just this particular node/script where the server is not receiving the RPC calls from the clients

client code:

func _on_ready_button_toggled(button_pressed):
    print("ready_button_toggled")
    ReadyButton.set_disabled(true)
    rpc_id(1, "ready_button_pressed", button_pressed)


@rpc("any_peer", "reliable")
func ready_button_pressed(button_pressed):
    pass #dummy


@rpc("reliable")
func ready_button_received():
    ReadyButton.set_disabled(false)

and server code:

@rpc("any_peer", "reliable")
func ready_button_pressed(button_pressed):
    print("ready button pressed")
    var remote_sender = multiplayer.get_remote_sender_id()
    emit_signal("ready_pressed", button_pressed, remote_sender)
    rpc_id(remote_sender, "ready_button_received")


@rpc("reliable")
func ready_button_received():
    pass #dummy

Everything seems to be in order to me. The nodes on either end have the same paths. The return value of the client’s rpc_id call is 0, so that means it’s sending right? but for some reason it’s not being received, the “ready button pressed” print statement isn’t running on the server.

i’ve checked the error messages and apparently the clients are trying to call “hide_online_ready”, rather than “ready_button_pressed”. this is news to me. And I don’t know what I am to do about an rpc node checksum failure.

E 0:15:59:0536   process_simplify_path: The rpc node checksum failed. Make sure to have the same methods on both nodes. Node path: CheckersMain/MarginContainer/VBoxUI/OnlineReady
  <C++ Source>   modules/multiplayer/scene_cache_interface.cpp:80 @ process_simplify_path()
E 0:15:59:0536   _process_rpc: RPC 'hide_online_ready' is not allowed on node /root/CheckersMain/MarginContainer/VBoxUI/OnlineReady from: 387542580. Mode is 2, authority is 1.
  <C++ Error>    Condition "!can_call" is true.
  <C++ Source>   modules/multiplayer/scene_rpc_interface.cpp:256 @ _process_rpc()

i’ve gone ahead and made my repo public: GitHub - k4gi/boardplayer
i’ve probably broken single computer games and/or local multiplayer games, but the bit i’m having a problem with is online multiplayer

(oh yeah, the node I’m having trouble with is called OnlineReady)

there are two godot projects, one for the client and one for the server. run the server and then run two instances of the client. select “online game” on both clients. on one client challenge the other to a game, and accept the challenge on the other. chat messages should be working on the next screen, but pressing the Ready button on either client is where things stop working

:bust_in_silhouette: Reply From: k4gi

Here I am again, answering my own question because I found the answer!

Godot’s RPCs are very particular. They want each side of an RPC, both sender and receiver, to have all of the same RPC-enabled functions, whether they’re being used or not. Otherwise, weird stuff can happen.

The problem here was, that the client version of OnlineReady did not contain the function hide_online_ready, I haven’t gotten around to writing that one yet, so I forgot to include its definition in the client code.

I imagine that the client was sending a function call that looked to it to be ready_button_pressed, but there was this other function that only the server had called hide_online_ready, for which the server interpreted the call.

I don’t know. Development is complicated, huh?

From now on I will be putting all my RPC-enabled functions above the regular ones in the code, so it will be easier to see if there are any missing. Lesson learned.