Scheduling one-time tasks

Hello,

After reading extensively about Nakama, i’m actually impressed by the set of features it offers. I’d also like to point out that it would be a great addition if scheduling one-time tasks makes it to the server-framework. I’m not talking about cron jobs, but i’m referring to the at-command specifically (From a technical point of view). Since i’m building a game that requires time-based actions, scheduling server-side code is a core-feature for my use-case. The at-command can be used to repeat jobs aswell (assuming the code that is to run reschedules itself) and thus it can act as a cron job too. Would love to hear your thoughts on this.

Anyway if there’s a workaround for scheduling one time tasks i’d be glad to hear about it.

@discordgr Scheduled tasks are possible with Nakama, but generally do not recommend them as a pattern. If possible it’s better to do time-based calculations on demand, and if necessary “fast-forward” client state.

Let’s take an energy system as a common example, where you give players some amount of energy that regenerates at a given rate, and actions in the game cost energy (like playing a level etc). You keep track of the last time the player spent energy and how much they had at the time you can easily check at current time what energy they have.

Or for a one-off timed action like unlocking a chest, you know when the unlock began and how long it takes. The client can check back in with the server to confirm the unlock is complete and claim their rewards. It’s also fairly standard to use local notifications for this to prompt the user to come back.

The main advantage here is the server doesn’t need to do work for clients until they come back to check in and sync state. Would this cover what you’re looking to do?