godotengine / godotengine/godot

High level multiplayer documentation doesn't explicitly explain RPC only works on methods of a Node derived class

Open
#89,981 2 comments 0 reactions 0 assignees View on GitHub
discussion documentation topic:multiplayer
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

Currently using v4.2.stable.official [46dc27791]

### System information

Godot v4.2.stable - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1080 Ti (NVIDIA; 31.0.15.5186) - AMD Ryzen 5 5600X 6-Core Processor (12 Threads)

### Issue description

GDScript allows you to place an RPC annotation on any method of any class you create, whether or not it is derived from Node. You can get as far as running the project and hitting the line for the defined RPC call. When the call is attempted, a run-time error informs you that RPC calls can only be made on methods of Node-based classes. This makes sense, but the documentation and script parsing isn't as explicit. The documentation mentions Nodes often in the high-level multiplayer tutorial, but there is no explicit warning that attempting to call RPC on a non-Node method is not supported. Likewise, you could code an entire interface around Resource-based RPC calls only to find out it isn't supported later during testing.

### Steps to reproduce

Create any non-Node class and define a method as ```@rpc```. Use a Node to establish a high-level multiplayer connection, then attempt to ```rpc()``` that method. You will get a run-time error, despite the documentation never explicitly stating that would happen and the script parser allowing it.

### Minimal reproduction project (MRP)

[bad_rpc.zip](https://github.com/godotengine/godot/files/14790171/bad_rpc.zip)
You'll have to run test.tscn and test2.tcsn on separate Godot instances. The only indication that you can't call the rpc is a run-time error.

Contributor guide

Open the contributing guide

Research direction

Start with the high-level multiplayer documentation and reproduce the behavior using the attached bad_rpc.zip project. Update the documentation to explicitly state that RPC methods must belong to Node-derived classes, then verify that the limitation and runtime behavior are clear to readers.

Written by the indexing model from the issue text.

Assessment

Tech stack
godot
Domain
documentation, networking
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.