Godot 3.1 dd5398ce9dc49d1562faab5504f3923883d461a0
I get this error when I use rset in multiplayer:
ERROR: _process_rset: Condition ' !_can_call_mode(p_node, rset_mode, p_from) ' is true.
At: core/io/multiplayer_api.cpp:314.
Code:
slave var slave_pos = Vector2()
slave var slave_rot = 0
func _process(delta):
if is_network_master():
rset("slave_pos", position)
rset("slave_rot", rotation)
else:
position = slave_pos
rotation = slave_rot
What is causing this?
CC @Faless @mhilbrunner
@marsmoon are you properly setting network_master on both peers? I.e. if you set_network_master(client_id) for that node in the client, you also need to set_network_master(that_same_client_id) in the server.
That error is thrown when an RPC/RSET is received from a peer that is not allowed to call it.
I wasn't. I thought I only needed to set it once as in this example from the docs https://godot.readthedocs.io/en/latest/tutorials/networking/high_level_multiplayer.html. Thanks!
I guess documentation should be updated by adding:
player.set_network_master(p)
in the network master code listing (after player.set_name(str(p)))
@Faless I plan to rework the multiplayer docs for 3.1 once we finalized all the networking changes. All the awesome new stuff (like custom_multiplayer, new keywords) needs to be explained.
Maybe we should make a point to add clear error messages and logs to the networking though.
Maybe we should make a point to add clear error messages and logs to the networking though.
Yeah, we could replace the various ERR_FAIL_COND with:
if (cond) {
ERR_EXPLAIN("Clear error message");
ERR_FAIL(); // or ERR_FAIL_V (when needed)
}
Yeah, we could replace the various
ERR_FAIL_CONDwith:
if (cond) {
ERR_EXPLAIN("Clear error message");
ERR_FAIL(); // or ERR_FAIL_V (when needed)
}
I've found out recently that ERR_FAIL and ERR_FAIL_V do not use the message from ERR_EXPLAIN. Not sure if a bug or intended.
Usually it's done as:
if (cond) {
ERR_EXPLAIN("Clear error message");
ERR_FAIL_COND(cond); // or ERR_FAIL_COND_V (when needed)
}
I guess the rationale is that if you're failing all the times (no _COND), there's no need for more explanations... Don't know, maybe that could use some improvement :)
@akien-mga @neikeq
No need to re-evaluate the condition since you already tested in the if. ERR_FAIL(); or ERR_FAIL_V(ret_val); should be enough, if it no longer shows the message it's a bug, it used to, and it's widely used in the core. See for example https://github.com/godotengine/godot/blob/612ab4bbc6f2396f4dcd68c3f142f7dfa2f5f0a5/core/color.cpp#L279 https://github.com/godotengine/godot/blob/612ab4bbc6f2396f4dcd68c3f142f7dfa2f5f0a5/core/io/ip_address.cpp#L82
EDIT: Never mind... I can't reproduce this anymore. No idea what I was doing wrong yesterday, but I remember checking this well and replacing the following code...
ERR_EXPLAIN("...");
ERR_FAIL_V(NULL);
// with
ERR_EXPLAIN("...");
ERR_FAIL_COND_V(true, NULL);
...made it display the message. Weird. Sorry for the false warning...
Errors are now (well actually, for a while now) more explicit (comes with EXPLAIN).
Once the docs PR is merged this can be closed I guess.
I got the same error message (3.1 and 3.1.1 stable), and it took some time until I understood that the instanced nodes (spawned in a multiplayer game) must have their name set to their network ID node.name=str(get_tree().get_network_unique_id()), and setting it to any other name does not work (at least from the simple tests I carried out). This is subtly mentioned in the documention (High level multiplayer), but it needs more emphasis imo.
Most helpful comment
I got the same error message (3.1 and 3.1.1 stable), and it took some time until I understood that the instanced nodes (spawned in a multiplayer game) must have their name set to their network ID
node.name=str(get_tree().get_network_unique_id()), and setting it to any other name does not work (at least from the simple tests I carried out). This is subtly mentioned in the documention (High level multiplayer), but it needs more emphasis imo.