How to sync an object that not related to a player? [Construct 2/3]

For example, I have a regular coin on the level (a new coin is created every 10 seconds).

And I need to synchronize all these coins with the players so that the players see them in the correct position.

How exactly can this be done in Construct 2 or 3? Any piece of code or example would be greatly appreciated.🙂

Answers

  • vadim
    vadim mod
    edited February 2023

    Try room properties. They are updated automatically on all clients. You can use a property per coin or single property for the list of all coins. The latter is less efficient, so use it only the number of coins is small. Due to Construct limitations, you probably need to encode properties values to json strings.

    Use "Set property of my room" action to set or update the property and Photon.PropertyOfMyRoom() expression to read it. "On my room property change" event is fired when any client updates the property.