The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates.

godotengine.org | Twitter

0 votes

Hi everyone, I am struggling with a problem I am having in Godot attempting to create a multiplayer game.

I have a system where inventory is pretty-much physicalized, where you can freely drop and pick-up items. It works great in single-player, but when attempting to transfer the progress into multiplayer it all falls apart.

Code snippet of how items are initialized.

Above is a snippet of my code for initializing objects for both the "server" player and the client player. In my specific case, I am having issues with "Welder" and "Gun1Proper". (The doors work great because they do not move, so no issues there.)

I started experimenting around with how I could get the welders to transfer over their position, similarly to how the player's do - simply having a timer setup to automatically send the information to its puppets. (Below is welder.gd).

Code describing timer/3d object movement.

Everything works great until I actually want to pick up an object. Within the code, it's supposed to remove the object as a child of the scene and add it as a child of the player picking it up (in the Hand slot). The player reaches into the welder using its collider and calls the functions. (Below is also welder.gd)

Code displaying how the tree is rearranged in welder.gd.

However, as soon as this happens, the RPCs for the client who did not pick up the object go haywire. (Below shows the error log for the client that did not pick up the object: get_node: (Node not found: "TestingLevel/1/Head/Hand/Welder" (relative to "/root").)

Showing the error log for the client that did not pick up the object.

Below is showing the scene tree before the server player picks up the welder, from the other client's perspective.

Scene tree before another client picks up welder.

Below is showing the scene tree after the server player picks up the welder, from the other client's perspective.

Scene tree after another client picks up welder.

From the perspective of the connecting client, the welder completely disappears. I am not sure where exactly I am going wrong, or if I completely misunderstand networking in Godot as a whole. I would ideally like the welder to be simply picked up and shown in its new position in the hand, even if its parents or positions within the scene tree have moved. To be honest, I am not even sure where to even begin solving this problem, I would appreciate any tips or tricks from anyone. I'm completely stumped. Thanks in advance!

Godot version 3.4
in Engine by (12 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.