Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MultiplayerSynchronizer (and maybe MultiplayerSpawner), cannot find their working nodepaths if created during runtime #87426

Open
NatCracken opened this issue Jan 21, 2024 · 3 comments

Comments

@NatCracken
Copy link

NatCracken commented Jan 21, 2024

Tested versions

reproduced in 4.2.1 stable mono b09f793

System information

Godot v4.2.1.stable.mono - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3060 (NVIDIA; 31.0.15.4629) - Intel(R) Core(TM) i5-10600KF CPU @ 4.10GHz (12 Threads)

Issue description

the MultiplayerSynchronizer node when created during runtime, usually from an instantiated packed scene or spawned from a MultiplayerSpawner, tries to start doing its thing before it or the scene it was created in are initialized in the scene tree. This node is dependant on a fixed root path to sync over the network which does not yet exists, thus it fails whatever initialization it is trying to do and fails to synchronize on subsequent updates. The node tries to start regardless of process mode and before _ready() so there is nothing you can do during the normal update cycle to catch and delay this behaviour, rendering MultiplayerSynchronizer completely unusable if it does not already exist in the launch scene.

I've noticed similar behaviour in MultiplayerSpawner but its much harder to pin down. If it does just end up being an execution order thing, maybe take a look and see if that node is doing its stuff at the same time.

Steps to reproduce

Use the reproduction project below. launch 2 or more instances and attempt to host and connect. The isLoaded property on the root of enviroment_1.tscn should be synced by the child MultiplayerSynchronizer from the host to the clients. Client.cs is checking it every frame and will print to the console on each peer that makes it. The host will succeed since its the one setting it, but the property wont be synced to the clients, because the client Synchronizer should fail because of this bug.

Minimal reproduction project (MRP)

MultiplayerReplicationTest.zip

@lbragile
Copy link

lbragile commented Feb 6, 2024

@NatCracken this appears to be the same issue I ran into in #86909 (comment).

For some reason, this only happens in one really specific scenario.

Did you find a solution/workaround?

@NatCracken
Copy link
Author

@lbragile I never found a solution, but this plugin did alleviate the worst of it

https://github.com/TestSubject06/GodotSceneSafeMultiplayer

Its components still fail in the same cases, but are usually able to recover from that failure

@Magodra
Copy link

Magodra commented Nov 27, 2024

Image
Similar setup. Having a Server that spawn Level1 and Level2 at startup. Client 1 connect, spawn Level 1, and Spawnable_1 is spawned at the server. This seams to work ok. Then Client 2 connect, spawn the Level1 and call the server to spawn Spawnable_2 in Level1. None of the two spawnables are spawned at the Client2 :(

Give the following errors :

E 0:00:04:0887 get_node: Node not found: "Main/Levels/Level1/MultiplayerSpawner" (relative to "/root").
<C++ Error> Method/function failed. Returning: nullptr
<C++ Source> scene/main/node.cpp:1792 @ get_node()
E 0:00:04:0894 process_simplify_path: Parameter "node" is null.
<C++ Source> modules/multiplayer/scene_cache_interface.cpp:118 @ process_simplify_path()
E 0:00:04:0903 get_cached_object: ID 2 not found in cache of peer 1.
<C++ Error> Parameter "recv_node" is null.
<C++ Source> modules/multiplayer/scene_cache_interface.cpp:282 @ get_cached_object()
E 0:00:04:0908 on_spawn_receive: Parameter "spawner" is null.
<C++ Source> modules/multiplayer/scene_replication_interface.cpp:578 @ on_spawn_receive()
E 0:00:05:0873 get_cached_object: ID 2 not found in cache of peer 1.
<C++ Error> Parameter "recv_node" is null.
<C++ Source> modules/multiplayer/scene_cache_interface.cpp:282 @ get_cached_object()
E 0:00:05:0879 on_spawn_receive: Parameter "spawner" is null.
<C++ Source> modules/multiplayer/scene_replication_interface.cpp:578 @ on_spawn_receive()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants