HackerExperience / Helix

GNU Affero General Public License v3.0
53 stars 10 forks source link

Create global balance module #389

Closed renatomassaro closed 6 years ago

renatomassaro commented 6 years ago

This is an evolution of #266.

From the Helix.Factor docs:

  One could split the implementation of game design and balance in two parts:

  1. Gathering of all required variables to calculate the outcome.
  2. Calculate the outcome.

  In short, Factor is responsible for the first part. 

  Notice how splitting the game design implementation into two logical steps can
  benefit us: testing the outcome of a calculation, or experimenting with new
  equations is as simple as passing the raw data, which represents the facts.

  In doing so, we've essentially decoupled the collection of the data from the
  calculations of balance and design.

Helix.Factor is the first part; Helix.Balance is the second one.

Helix.Balance is meant to be as dumb and free of context as possible, receiving whichever data it needs to calculate the output. It must not perform any side-effects. It must always return a number (either integer or float, whatever makes sense`).

Sub-modules include:

It may be helpful to have some syntactic sugar around it (macros), specially for dealing with integer <-> float conflicts, rounding up/down in a consistent way and having a special, unhygienic c variable with global (and local) constants.