[solved]Sync entity positions over P2P

That’s the host-client pattern :slight_smile: The “host” client handles most of the game logic, and the clients are being shown the current state of the game held by the host.

To be able to have multiple enemies, you can do something like this: Whenever the host creates a new enemy, you’ll want to generate a new UID (Unique IDentifier) for that entity. You can do it easily with the UUID extension. Ask all the instances to create that object and use an object variable to remember which ID belongs to this instance:

Then, you can use a for each object to read all of the enemy’s data individually on the host, and a for each variable event to apply all the data on the client. Use the variable condition and object picking to target the instance you want:

Finally, you can do the same without loops for deleting a single enemy:

Here are the snippets json file: game.json

I hope it’ll be helpful!

1 Like