Regenerating energy and timer

Hello there! I want to make an energy system similar to Candy Crush, with a bit more modification:

  1. Add a “life” after several minutes have passed. Each player has a different amount of max number of “life”. The maximum number of “life” will increase for each level (for ex, at level 1, players can charge up to 5 life, but he can charge up to 7 at level 2)

  2. Show a timer on how many more seconds before a “life” point is added. Timer stops when player has reached the maximum value of “life” he can charge up to.

  3. After doing a certain thing, “life” point will be decreased by a certain number (what command line should I use to decrease player’s inventory?)

I used to use Playfab and there was a feature called “Regenerating currency” there which I was using to make the energy system.

How do I make this system in Nakama? I’d really love to be able to migrate to Nakama, but I’m pretty much blind about the server side coding and such, so this is very confusing indeed. I saw in Gitter and tracking Unix timestamp was mentioned? How do I track record of the timestamp and how do I retrieve the value?

…I’m very much a noob i don’t even know how to begin. I hope for your guidance ^^;

Hey @meyaoigames. Welcome :wave:

Things are a little different in Nakama than other game servers or SaaS services for games. We enable much more direct integration between features and the ability to define your game logic as you like but it comes at a small cost. You must design the functionality yourself in a few cases and this is a good example of one occasion. Nevertheless we’re here to help. :slight_smile:

To achieve what you want the best route depends on a few additional questions I have:

  • Do you want to send a push notification (or in-app notification) to the player when a new life is added?
  • Does the player have to claim their new lives or do they appear based on their next play session?
  1. Yes. If possible, I’d like to send push notification (game will be deployed to Android and iOS) when the stamina is full. (like, ‘come play again!’ sorta stuff)

  2. They should appear automatically on the next session without user needing to claim it.