godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.13k stars 21.19k forks source link

Inconsitent peer id type in C# #75396

Closed jahu00 closed 1 year ago

jahu00 commented 1 year ago

Godot version

4.0.1 stable mono win64

System information

irrelevant

Issue description

In multiplayer, sometimes int and sometimes long is used for peer id. For example PeerConnected and PeerDisconnected signals from the MultiplayerApi class pass peer id as long. However GetUniqueId from the same class returns int. If peer id can reach values outside of what int can store, then this is a problem. If the values are all within int's range, this is less of an issue and long can probably be replaced by int for peer ids used in signals.

Steps to reproduce

Compare the type used for peer id in PeerConnected of MultiplayerApi class with type returned by GetUniqueId from the same class.

Minimal reproduction project

N/A

Calinou commented 1 year ago

cc @raulsntos

RedworkDE commented 1 year ago

The engine uses 32 bit values for the peer id, so values outside the int range are never valid. The signal parameters are of the wrong type as tracked by the linked issue.

raulsntos commented 1 year ago