godot
godot copied to clipboard
MultiplayerSpawner doesn't work with UIDs
Tested versions
Reproducible in: 4.3dev5, 4.2.2, latest master [4a0160241fd0c1e874e297f6b08676cf0761e5e8]
System information
Godot v4.2.2.stable - Ubuntu 23.10 23.10 - X11 - GLES3 (Compatibility) - Mesa Intel(R) Graphics (ADL GT2) () - 12th Gen Intel(R) Core(TM) i5-1235U (12 Threads)
Issue description
MultiplayerSpawner doesn't work if auto spawn path is UID. It prints some errors in console:
E 0:00:08:0516 get_node: Node not found: "World/Players/1/MultiplayerSynchronizer" (relative to "/root").
<Ошибка C++> Method/function failed. Returning: nullptr
<Исходный код C++>scene/main/node.cpp:1651 @ get_node()
E 0:00:08:0516 process_simplify_path: Parameter "node" is null.
<Исходный код C++>modules/multiplayer/scene_cache_interface.cpp:110 @ process_simplify_path()
E 0:00:08:0516 get_node: Node not found: "World/Players/1/Inputs/InputsSync" (relative to "/root").
<Ошибка C++> Method/function failed. Returning: nullptr
<Исходный код C++>scene/main/node.cpp:1651 @ get_node()
E 0:00:08:0516 process_simplify_path: Parameter "node" is null.
<Исходный код C++>modules/multiplayer/scene_cache_interface.cpp:110 @ process_simplify_path()
E 0:00:08:0516 get_node: Node not found: "World/Players/168206040/MultiplayerSynchronizer" (relative to "/root").
<Ошибка C++> Method/function failed. Returning: nullptr
<Исходный код C++>scene/main/node.cpp:1651 @ get_node()
E 0:00:08:0516 process_simplify_path: Parameter "node" is null.
<Исходный код C++>modules/multiplayer/scene_cache_interface.cpp:110 @ process_simplify_path()
Also, after each engine restart UID is erased from Auto Spawn List with error in console:
modules/multiplayer/multiplayer_spawner.cpp:103 - Condition "!FileAccess::exists(p_path)" is true.
Can be worked around with ResourceUID.get_id_path(ResourceUID.text_to_id(
Steps to reproduce
- Take multiplayer project with MultiplayerSpawner which uses Auto Spawn List (Multiplayer Bomber in MRP)
- Change paths of Auto Spawn List scenes to UIDs
- Run game as usual
- Request spawn Notice no scenes spawned on client, instead errors printed.
Minimal reproduction project (MRP)
- Open world.tscn
- in PlayerSpawner add UID of player.tscn
- Run the game, create server and connect from client
- Start game
- Observe result
File access can't open UIDs like this, that's limited to the resource management system, so this is a limitation in that side of things, unsure how to proceed though
Note that UIDs are not guaranteed to be valid in the other client, as you might be communicating with a different version of the game, including having a separate server build
This should be documented then?
Depending on what path we take yes, the team for multiplayer should evaluate if this is a feature we should add, or document that it's not supported
It seems to be an error in this case, the loading itself uses ResourceLoader
so the check should be replaced by ResourceLoader::exists
instead, as it works otherwise
First time contributor, here's my pull request #91084
I think it will make sense if Auto Spawn List will be changed to Array of Strings with PROPERTY_HINT_RESOURCE_UID (introduced in #91815): It will work with UIDs and automatically updated when scene has been moved
UIDs are not always available or desirable, forcing people to use them for networking isn't a good idea IMO
Also that's for the future assuming that PR is merged, irrelevant to this (which has to do with UIDs not being processed correctly for spawners)