godot icon indicating copy to clipboard operation
godot copied to clipboard

MultiplayerPeerExtension requires more overrides than docs specify

Open rcorre opened this issue 2 years ago • 1 comments

Godot version

4.0-stable

System information

Linux

Issue description

https://docs.godotengine.org/en/stable/classes/class_multiplayerpeerextension.html#class-multiplayerpeerextension says:

All the methods below must be implemented to have a working custom multiplayer implementation

I've implemented all methods listed in the docs, but I get:

ERROR: Required virtual method MultiplayerPeerExtension::_get_packet_channel must be overridden before calling.
   at: _gdvirtual__get_packet_channel_call (scene/main/multiplayer_peer.h:142)
ERROR: Required virtual method MultiplayerPeerExtension::_get_packet_mode must be overridden before calling.

These aren't mentioned in the docs. I'm not sure if this is just a doc issue or an implementation issue.

Steps to reproduce

  1. Extend MultiplayerPeerExtension in GDScript
  2. Implement all methods listed in the docs
  3. Try to use it as a multiplayer peer.

Minimal reproduction project

example.zip

rcorre avatar Mar 09 '23 00:03 rcorre

Just adding this here since I'm not sure it merits it's own issue:

The docs for NetworkedMultiplayerCustom::initialize in Godot3.5 used to say:

Initialize the peer with the given peer_id (must be between 1 and 2147483647).

I don't see that mentioned in the 4.0 docs for MultiplayerPeer or MultiplayerPeerExtension. Is that still a limitation? The source for generate_unique_id suggests it might be:

https://github.com/godotengine/godot/blob/92bee43adba8d2401ef40e2480e53087bcb1eaf1/scene/main/multiplayer_peer.cpp#L51

rcorre avatar Mar 10 '23 12:03 rcorre

Thanks for the report!

I think what happened is that MultiplayerPeerExtension was added, and then later _get_packet_channel() and _get_packet_mode() were added, but they didn't get fully integrated into MultiplayerPeerExtension.

I think PR #75116 should fix it!

dsnopek avatar Mar 19 '23 20:03 dsnopek

Thanks! While you're editing those docs, would you happen to know if the unique ID still needs to fit into a uint31? https://github.com/godotengine/godot/issues/74628#issuecomment-1463717863

rcorre avatar Mar 19 '23 21:03 rcorre

Ah, yes, I think that's still true. I added a note about it to the docs for MultiplayerPeerExtension._get_unique_id() in my latest push on PR #75116

dsnopek avatar Mar 20 '23 02:03 dsnopek