Multiplayer - MultiplayerSynchroniser Issues

Godot Version

4.7.1

Question

I am having an issue with setting up multiplayer for my game using GodotSteam.

I am using the GodotSteam plugin to connect my friend and I to test.

Current issue:

  • When the host creates a lobby, they are loaded into the main scene and have a Player spawned for them
  • However, when any other client joins the host’s lobby, the following problems happen/have happened:
    • Host:
      • The host gains control of the other client’s player
      • The host views through the camera of the latest client that joined
    • Clients:
      • The client that joined, is unable to control their player, but can see through the camera of the host
      • The client that joined, is able to control their player, but is viewing from the host’s perspective
      • The client’s player falls through the map, locally.

This is truly a cluster-f*** of issues that I don’t understand, and would like some help with.

Currently I am handling the networking stuff (GodotSteam, Host-button UI code) in GDScript. The Player class was made using godot-cpp, so authority of the Player node is set inside this class’ _enter_tree() function, like so:

void Player::_enter_tree()
{
	this->set_multiplayer_authority(get_name().to_int());
}

This is the current Player class scene hierarchy:

ClientSync properties that are synced:

Latest testing session errors:
Host:

ERROR: Condition "uint32_t(consumed) != size" is true. Returning: ERR_INVALID_DATA
   at: on_delta_receive (modules/multiplayer/scene_replication_interface.cpp:790)

Client:

ERROR: Invalid packet received. Size too small.
   at: decode_and_decompress_variants (scene/main/multiplayer_api.cpp:264)
ERROR: Condition "err" is true. Returning: err
   at: on_replication_start (modules/multiplayer/scene_replication_interface.cpp:257)
1828434934

If anything I’m doing blatantly wrong, please let me know, as I’m relatively new to this and just want to understand what to do, to get multiplayer down before I actually continue with development of my game.

If you need extra info, let me know.

Many thanks!

GDExtensions usually run in-editor too, ensure your set_multiplayer authority only happens at run-time with the engine is_editor_hint().

Setting authority on it’s own doesn’t do that much at a high level, it’s more book keeping for the back end and allows the synchronizer to work at all. Do you do anything with authority to enable/disable player cameras so the right one is current on the right client? Do you enable/disable input functions, or properly gate them with if is_multiplayer_authority():?

Make sure your Camera3D is not set to current in the editor, as it loads into the scene with current on this will disable all other cameras, which is bad for the host as they may have already had the correct camera set.

Your multiplayer synchronizer seems to have bad paths for Player position and rotation, double check those node paths.

Hey @gertkeno, thanks for responding with useful info.

I managed to fix the camera issue, like you said, CurrentCamera was selected in-editor, so I have disabled it and now it works perfectly. Many thanks for that!

The only problem I have now is that every client that joins falls through the map except the host.

As for the MPSynch property paths, I have no idea how to fix that. For context, Player is a C++ class itself, that extends Character3D.

I tried looking for how to fix the property path issue, but with no luck..

Also, I have the appropriate guards you have mentioned before (is_editor_hint() and if is_multiplayer_authority():) within _ready() and physics_process().

Many thanks,

Okay I’m going to make the reply above as the solution for the camera issue, and will make a separate post about this issue with the MultiplayerSynchronizer paths.