Persistent Objects
So far we have seen 2 important concepts
State Sharing in Rooms
Sending a Single Message to a Client
Now let's talk about Persistent Objects. These are special objects that are stored on the server and do not 'belong' to any client like entities. They can be created room wise.
Anyone can Create, Edit, Delete these special objects because no one Client 'owns' it.
For example there is a ball on the server. Some client can join, move it around and leave. Then another client can join and move it starting from the same place the previous client left it.
oPersistentObject
This is the general object on gamemaker where you can customise the step event to do whatever you want. Here are the 2 most important properties.
persistentObjectId
- Unique identifier of this persistent object. It is allocated by the server. Please do not edit this variable, only use it as a reference.
persistentObjectProperties
- A stringified struct of the persistent object's properties. You can make sense of it like this. This code is preloaded so only the 2 lines in between are important.
Last updated