Open ZhangWei-bi opened 1 year ago
Discussion about the same / similar issue: https://github.com/godotengine/godot/issues/57869
This would only benefit using Node.rpc
/rpc_id
. I prefer using the versions on Callable because it gives you compile-time checks, for example if you mistype the method name.
Also, I'm not too knowledgeable of the networking system and may be misunderstanding so don't quote me, but I believe the reason having the methods on both client and server was made a requirement is because the info about how to handle the RPC (ordered, reliable, or unreliable and channel) are defined in the @rpc
annotation in 4.x, not when calling the RPC method like it was in 3.x.
So that means if you call a method from the client that exists only on the server or vice versa, the caller has no idea how to send the RPC because it doesn't have the @rpc
annotation telling it how to do so.
This has also completely broken my client/server project. It would require me to refactor my entire MP netcode by adding hundreds of RPCs that just pass
nothing, if anything rpc sync should be optional.
Another solution would be implementing a 'tag' that you could optionally apply to an RPC to mark it as an exception for the checksum; still more boilerplate, so probably still not ideal.
Describe the project you are working on
A Multiplayer game.
Describe the problem or limitation you are having in your project
Godot 4 requires you to have the receiving rpc methods locally even tho you don’t need them locally. I have spent hours debugging issues and the errors are quite vague. This should not be enforced. It's also adding extra bloat to the code. It should just be like in Godot 3 where it's optional to have it locally.
Here is an example that would work with Godot 3:
On server side:
On client side
And then if you do this on the client
You will get this error:
The reason for the error is because you did not implement TestMethod2 locally when you might not even need it. It's impossible to call other rpc methods if you where to add them. Something extra I also think it should not break other rpc calls if you forgot to add an rpc method on the remote side.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Remove the requirement of needing rpc methods on both sides.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
I haven’t looked into it yet.
If this enhancement will not be used often, can it be worked around with a few lines of script?
This will be used all the time when a user wants to create a multiplayer game. It will cause confusion.
Is there a reason why this should be core and not an add-on in the asset library?
It’s a core feature.