Error with MultiplayerSpawner
Asked Answered
E

3

0

Hello everyone!

I have a problem getting a MultiplayerSpawner to spawn a player object on the client. Both client and server use the same main scene. The server loads two world scenes on startup wrapped in SubViewport nodes so that I can each assign a World3D and have separate physics. The world scenes contain the MultiplayerSpawner nodes and have each their own MultiplayerAPI instance.

The client will load one of the levels and only after it's loaded it will establish the connection to the respective scenes MultiplayerPeer. The server correctly creates the player object after the connection and obviously tries to sync it to the client, but on the client I get the MultiplayerSpawner error messages:

E 0:08:42:0829   get_node: Node not found: "MultiplayerSpawner" (relative to "/root").
  <C++ Error>    Method/function failed. Returning: nullptr
  <C++ Source>   scene/main/node.cpp:1626 @ get_node()
E 0:08:42:0829   process_simplify_path: Condition "node == nullptr" is true.
  <C++ Source>   modules/multiplayer/scene_cache_interface.cpp:77 @ process_simplify_path()
E 0:08:42:0829   get_cached_object: ID 1 not found in cache of peer 1.
  <C++ Error>    Condition "!F" is true. Returning: nullptr
  <C++ Source>   modules/multiplayer/scene_cache_interface.cpp:241 @ get_cached_object()
E 0:08:42:0829   on_spawn_receive: Condition "!spawner" is true. Returning: ERR_DOES_NOT_EXIST
  <C++ Source>   modules/multiplayer/scene_replication_interface.cpp:571 @ on_spawn_receive()

I am using Godot 4.1.2.

This is how the server tree looks like before the connection:

This is the server tree after the connection with the spawned player:

And finally the client tree after the connection:

Any hints for workarounds for this issue or problems with my scene setup would be greatly appreciated.

Best regards,
Patrick

Expeditionary answered 17/10, 2023 at 19:32 Comment(0)
B
0

Expeditionary E 0:08:42:0829 get_node: Node not found: "MultiplayerSpawner" (relative to "/root").

Why is it trying to get it relative to /root? What is your code doing to try accessing that?

Bareheaded answered 17/10, 2023 at 20:22 Comment(0)
E
0

Hello Homocyclic!

Thanks for you reply. That is what I'm trying to figure out as well.

I do not have any references in my code to the MultiplayerSpawners except reading their multiplayer property for a log message. Each MultiplayerSpawner has it's spawn path set to the Players node on the same level. The Level 1 and Level 2 nodes each have a unique MultiplayerAPI instance, so that each player can connect to one of the available levels.

Is it possible that this causes the multiplayer code to assume that Level 1 and Level 2 are actually /root?

It my level setup itself is the problem, I would appreciate any tips how to fix this. I just need a way to load several world levels on the server which do not interfere in each others physics calculations.

Thanks in advance for any more input on this issue!

Best regards,
Patrick

Expeditionary answered 18/10, 2023 at 17:39 Comment(0)
B
0

I think your issue relates to how you setup your MultiplayerAPI instance
"The world scenes contain the MultiplayerSpawner nodes and have each their own MultiplayerAPI instance."

If I read this correct you are setting the SceneTree roor multiplayerapi instance to the spawner, which to my knowledge is to low in the tree. it would be better if the "level" node got the multiplayerapi instance assigned to it.

See:
https://docs.godotengine.org/en/stable/classes/class_multiplayerapi.html
and,
https://docs.godotengine.org/en/stable/classes/class_scenetree.html#class-scenetree-method-set-multiplayer

Bodi answered 28/10, 2023 at 3:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.