• Categories
  • Recent
  • Tags
  • Popular
  • Solved
  • Unsolved
  • Users
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Darkly)
  • No Skin
Collapse
brainCloud Forums

What is the proper way to implement an "Energy" system for a casual mobile game?

Scheduled Pinned Locked Moved Unsolved General
energysystemmobile
4 Posts 2 Posters 573 Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kuabs
    wrote on last edited by
    #1

    Most mobile games have a energy system that limits a user from being able to play constantly, so as to limit progress. This resource can usually be bought as well up to a certain number of times per day, but otherwise replenishes on a time-loop when a user doesn't have max energy.

    I know some ways I could implement this, but I'm curious what braincloud suggests as the optimal way to do this (to minimize usage) since this is a relatively common scenario? Other BaaS recognize this as such a common scenario that they have built-in functionality for this (ie lootlocker) - so assuming this is a popular use-case.

    Any advice? Thanks!

    1 Reply Last reply
    0
  • P Online
    P Online
    Panagiotis Milios
    wrote on last edited by
    #2

    Save a (current millis) timestamp, the recharge rate and the energy available in a user entity. Everytime the player makes an action, create a method that checks if he has the available energy, consume it & re-calculate the energy based on time passed from last timestamp to current. You can get the timestamp on the cloud using new Date().getTime(). Sync this process to the client for the player to see his energy.

    (Total API Consumption = Read + write user entity in a cloud script = 1 API call)

    If you want to have microtransactions upon the energy, create a virtual currency that the player can use it to buy energy. Since the energy is directly related to gameplay, i would want to keep it separately from my virtual currency.

    1 Reply Last reply
    0
  • K Offline
    K Offline
    kuabs
    wrote on last edited by kuabs
    #3

    Ah thanks-- and I assume the cloud Date().getTime() would be based on braincloud's servers and not the user's phone right? To prevent time-abuse. Appreciate the feedback!

    P 1 Reply Last reply
    0
  • P Online
    P Online
    Panagiotis Milios
    replied to kuabs on last edited by Panagiotis Milios
    #4

    @kuabs Exactly. Always use braincloud server time for features that rely on time passed. Also, if you want to modify your recharge rate during gameplay, you might want to consider keeping it in a global entity instead so every user will be affected by it.

    1 Reply Last reply
    0

  • Login

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • Solved
  • Unsolved
  • Users