This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+1 vote

I have a game world that is made up of cells. I create him by mask, looks like:

0 - is floor
1 - is wall
2 - is enemy

1111
1021
1111

Floor and wall just is image in TileMap, but enemy is Node

First, I create an instance of all the enemies on the server, and when (at a random moment) the client connects, I send him a map and again create an instance of all the enemies, but now on client side.

Next if I call enemy.rpc("kill") thenkill() will be called by the respective enemies, those who are in the same position(same cell).

But I can't understand, how RPC understands that this node is correct?

I want to know it, because sometimes I get error Failed to get path from RPC and I think it’s somehow connected

in Engine by (54 points)
edited by

1 Answer

+1 vote
Best answer

Your question error has nothing to do with being a master or puppet and i believe that for the rpc call as you are doing it does not even matter. What rpc does is execute a method on everyone, local and remote, server and remote in your case, and it does that by using the NodePath. So if the NodePath is different, does not exist or different id, in one of the clients the call fails.

For more details check the docs or this old question that gives a pretty good overview.

by (572 points)
selected by

I just missed the point that I can change the name of the path somehow like that node.set_name(str(id)) :)

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.