Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Question Stamina/Energy Refill system

Discussion in 'Economy' started by BalazsJozsef, May 23, 2023.

  1. BalazsJozsef

    BalazsJozsef

    Joined:
    Jun 8, 2016
    Posts:
    9
    Hello!

    I would like to implement a server side Energy/Stamina system for my game.

    I guess it's should be in the Economy - Currency tab, since the "tokens / points" doesn't have any uniqueness from one another.
    Starts with amount of X max cap is W - this part is okay,
    then there should be a refill rate? Or similar to that...

    How do you implement energy systems in your games? Server side of course.
    I'm reading the docs and the sample projects and I couldn't find a single entry about how to implement a server authoritative energy/stamina regen system.

    I have done this before using Playfab. It was quite easy there...
     
    amitfid999 likes this.
  2. Arnaud_Gorain

    Arnaud_Gorain

    Unity Technologies

    Joined:
    Jun 28, 2022
    Posts:
    184
  3. BalazsJozsef

    BalazsJozsef

    Joined:
    Jun 8, 2016
    Posts:
    9
    @Arnaud_Gorain

    I did have read the docs, and make my question even simpler:

    How to regenerate currencies automatically?

    This is from Playfab. They allow the users to make a currency, initial and max deposit.
    And there is a rechage rate per 24h field. <=== I'm asking about this, just to be clear.


    upload_2023-5-26_9-32-30.png
     
    amitfid999 likes this.
  4. Arnaud_Gorain

    Arnaud_Gorain

    Unity Technologies

    Joined:
    Jun 28, 2022
    Posts:
    184
    Hi @BalazsJozsef,
    We do not have a direct field for recharge rates as you are pointing out. But, you can add custom data, which can handle this use case and any specific needs your game might require:
    Screenshot from 2023-05-29 13-03-42.png
     
  5. BalazsJozsef

    BalazsJozsef

    Joined:
    Jun 8, 2016
    Posts:
    9
    Hello @Arnaud_Gorain

    How is a custom data going to help me to implement this on the server side (as the question in the original post I have asked)?

    How am I suppose to use this in an actual code ON the server?
     
    amitfid999 likes this.