## Spaceship Game: Shop Status Bars

The shop of the spaceship game (no longer a prototype as of now!) has received a small facelift: The status bars that indicate how much of each stat you have are now functional. The background also had some stars added to it, so as to make it prettier. Here is the preview:

Math time! The bars should represent the increase in player move speed, health and firepower. Setting the values for the bars was a bit problematic: equipping small items at the start should be reflected as clearly as well as better ones as the player advances.

Since values don’t increase linearly, the scale was an issue… first let’s say the lowest value of an item is 25 and the highest 400. If the maximum amount of items you can equip is 4, then the maximum possible value is 1600.

Therefor, if we take the simplest of formulae: TOTAL_VALUE / MAX_VALUE, we see that:

25 / 1600 = 0.016

400 / 1600 = 0.25

If the player were to equip an item and see a value increase of a little over a pixel (on a 100px status bar), he’d be highly discouraged from ever equipping it again. And that increase he just had, as little as it may seem, might make a huge difference for the current stage of the game.

Logarithmic scale works well in situations where values don’t increase linearly. So, the formula should now be: LOG(TOTAL_VALUE) / LOG(MAX_VALUE). The result is:

LOG(25) / LOG(1600) = 0.44

LOG(400) / LOG(1600) = 0.81

In this case, it scales WAY too fast. A single low value item represents (visually) almost 50% of the maximum available power. One fourth of it is set as almost 80%. This means that the values in between and after, won’t see much change.

I then came up with the following solution: An average between both. In this case, the formula should be: (TOTAL_VALUE / MAX_VALUE + LOG(TOTAL_VALUE) / LOG(MAX_VALUE)) / 2. This way, the high values of the Log formula would be countered with the low values of the percentage formula and the low increase in difference would be more easily reflected. The result:

f(25) = 0.23

f(400) = 0.53

Of course, since the logarithmic formula is a component, values will scale fast at first and slower as the player reaches the maximum.

Stay tuned for more updates on this free game (coming very soon!). Play the prototype by clicking on the Labs’ Spaceship link on the top menu and subscribe to the mail list to be informed when the game comes out.