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.
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).
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)
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").)
Below is showing the scene tree before the server player picks up the welder, from the other client's perspective.
Below is showing the scene tree after the server player picks up the welder, from the other client's perspective.
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!