# Energy

**URL:** https://heroiclabs.com/docs/hiro/concepts/energy/
**Keywords:** energy, hiro
**Categories:** hiro, energy, concepts

---


# Energies

![Time based energies are used in Blocks and Cities by Kyoso Interactive.]({{< fingerprint_image "/images/pages/hiro/concepts/energies.png" >}})

Energy is any resource that can be used to limit the number of times a player can perform an action in a game. For example, a player may have a limited number of lives, and each time they die they lose a life. When they run out of lives, they can no longer play the game until they have been given more lives. This can be done by [watching an ad](../economy/rewarded-video), [donations](../economy/donations/), or by waiting for a period of time.

Hiro enables you to manage energy in your game. You can define multiple energy types, each with their own configuration. Energy amounts are stored per user, and the real-time value of the current energy amount is computed on get or spend. Players can spend one or more energy amounts and return all current energy values.

## Customization parameters

The following JSON represents the customization parameters you can use to configure the default user experience for the Energies system.

```json
{
  "energies": {
    "<energyName1>": {
      "start_count": 5,
      "max_count": 5,
      "max_overfill": 3,
      "refill_count": 1,
      "refill_time_sec": 600,
      "implicit": true,
      "additional_properties": {
        "<propertyName>": "value"
      }
    },
    "<energyName2>": {
      "start_count": 0,
      "max_count": 5,
      "max_overfill": 0,
      "refill_count": 1,
      "refill_time_sec": 3600,
      "implicit": false,
      "reward": {
        "guaranteed": {
          "currencies": {
            "gold": {
              "min": 100
            }
          },
          "items": {
            "hero_card": {
              "min": 1,
              "max": 5
            }
          }
        }
      },
      "additional_properties": {
        "<propertyName>": "value"
      }
    }
  }
}
```

The JSON schema defines an `energies` object which _must contain an individual object for each energy_ you wish to define in the system. You can configure as few or as many energy types as needed for your desired gameplay.

{{< table name="gdk.concepts.energy.energy-system" >}}

Each individual energy is keyed by name and may define the following:

### Energy

{{< table name="gdk.concepts.energy.energy" >}}

## Additional Information

- [Mage Mayhem sample project](../../../sample-projects/games/mage-mayhem)
