Do MatchMessages persist a tick?


I would like to achieve a mechanism to defer processing incoming MatchMessages while a player is making a decision.

For a bit more context, the game is a Trading Card game. At various stages during the match, multiple card abilities might get triggered by some event. Some of these abilities require the player to make a choice, so the server will need to wait a set amount of ticks before processing the rest of the triggers.

Is there a way to add incoming MatchMessages to a “queue” to be processed at a later date?

The documentation says:

messages nkruntime.MatchMessage[]: A list of data messages received from users between the previous and current tick.

But it’s not clear what happens with MatchMessages which were received during the previous tick and not processed yet or in time.

Thank you in advance for your advice.

Hello @Antviss,

Received messages are buffered until next tick (but if the maximum buffer size is reached messages will be dropped), and are then all delivered to the match loop function when the tick fires. Once the messages are delivered to the loop they’re cleared from the buffer so it’s up to the game logic to either do something with them or not. Any messages received after will be delivered to the match loop on next tick.

You should process the player choice message you receive during the allowed amount of ticks by updating your match state according to your game logic.