0 votes

Hi,

I have started working on a small multiplayer project which has been a fairly painless process up until I have started instancing scenes. What I have been doing is instancing an object, then having the player being able to pick it up (changing parent basically) and then dropping it again. When I let the player drop an object, so that it is no longer a child of a player, the instance name seems to become out of sync. On one client, the name might be "@@Object@5@1" and on the other "@@Object@1@9", and as such RPCs can no longer resolve properly as it cannot find the correct node.

Am I missing something in how I should handle the instances? I am basically just calling an rpc on both host and clients asking them to instance a new object, which again, works fine up until it has changed parent a couple of times.

My workaround right now is to just append OS.get_unix_time() at the end of the instance name to make sure it is unique, but it seems like an unnecessary step that should be handled internally.

Does anyone know if it is me doing something wrong or if you are supposed to make sure names are unique yourself?

Thanks

Godot version 3.2.1
in Engine by (23 points)

Each node object has its own unique id when created and can be accessed with get_instance_id()

Sure, but RPCs are resolved via the node tree path, and I am pretty sure the ids are not synced over the network.

Yea so i was thinking
Server create node with name + get_instance_id()
Server tell clients to instance nodes with name + get_instance_id()
All parties involved are happy with unique shared names

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 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 webmaster@godotengine.org with your username.