Concept
Last updated
Last updated
Messages utilize the concept of singularity, as they are primarily designed for manager classes and systems within your game. Unlike RPCs, which are meant to synchronize large amounts of data between the client and server (such as movement, health, or power-ups), the messaging system focuses on important functionalities, like a ready-up system, a vote kick system, or sending out a server's complex configuration class.
The singularity concept ensures that only one instance of a particular type can execute a message at a time, except for static messages, which do not require an instance. This means that if you have a player message for each player controller, only one of those controllers will be able to run the message.
Conversely, if you have a single PlayerManager class for each player, the message will be executed on that single PlayerManager instance.
Reminder: Static messages do not need an instance to register!
Here is an example on how to register an instance.