godotengine / godot

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

MultiplayerSynchronizer throws error when synchronizing Node changes on first peer connection #98052

Open dweipert-3138720606 opened 4 hours ago

dweipert-3138720606 commented 4 hours ago

Tested versions

Reproducible in v4.3.stable.arch_linux

System information

Godot v4.3.stable unknown - Arch Linux #1 SMP PREEMPT_DYNAMIC Sat, 05 Oct 2024 17:53:31 +0000 - Wayland - GLES3 (Compatibility) - AMD Radeon RX 7600 (radeonsi, navi33, LLVM 18.1.8, DRM 3.54, 6.6.54-1-lts) - 13th Gen Intel(R) Core(TM) i9-13900T (32 Threads)

Issue description

The MultiplayerSynchronizer throws an error on the third peer that it can't find the second peer's Player Node and the same for any subsequent peers except the host.

The synchronization doesn't work for those nodes then. I don't understand why it throws that error. My expectation is that it shouldn't and synchronize properly.

E 0:00:02:0346   get_node: Node not found: "Network/Players/1994578314/MultiplayerSynchronizer" (relative to "/root").
  <C++ Error>    Method/function failed. Returning: nullptr
  <C++ Source>   scene/main/node.cpp:1792 @ get_node()
E 0:00:02:0346   process_simplify_path: Parameter "node" is null.
  <C++ Source>   modules/multiplayer/scene_cache_interface.cpp:118 @ process_simplify_path()

20241010_11h50m10s_grim

Steps to reproduce

Run the project. Click Host in one window and Join in the others. Observe the error and check the score value for each Player in the Remote SceneTree tab. In all Sessions every Player Node should have their score set to 1, but it isn't.

Minimal reproduction project (MRP)

bug-multiplayersynchronizer-playerstate.zip

dweipert-3138720606 commented 3 hours ago

I just tested adding a MultiplayerSpawner to the Network Node and let that handle the creation of the Player Nodes. That seems to work as I'd expect without errors. But I don't know why the approach in the MRP without a Spawner Node would result in an error.