HackerExperience / Helix

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

Create global Balance module #266

Closed renatomassaro closed 6 years ago

renatomassaro commented 6 years ago

Centralizes game balance logic in one place.

PoC for process:

defprotocol Balance.Process do

  @spec objective(data :: term, meta :: term) ::
    %{
      optional(:cpu) => pos_integer,
      optional(:ram) => pos_integer,
      optional(:dlk) => pos_integer,
      optional(:ulk) => pos_integer,
    }
  def objective(data, meta)

  @spec resources(term, term) ::
    %{
      paused: map,
      running: map
    }
  def resources(data, process)
end

Once implemented, remove from process type data:

which are all stored at the process struct already.

Also consider renaming ProcessType to ProcessData and enhance the interface

renatomassaro commented 6 years ago

Being implemented (with a totally different interface) at #307