⛈️Climate System

Our state change mechanism is an innovative and dynamic tool designed to keep the inflation of in-game items under control and add unpredictability to our games.

The first iteration of our mechanism will be in CafeCosmos as a Weather System that oscillates between 3 states.

Problem

As it stands there are a number of assets that are infinite in CafeCosmos.

-- 🍉 Fruit -- 🌽 Crops -- 🐓 Animal Products -- 💦 Water -- ☀️ Sunlight --

Solution - CafeCosmos Weather System

Fluctuating weather systems within CafeCosmos will impact the availability of water and sunlight which is a core component for the production of Fruit, Crops & Animal Products.

Our weather system will impact the humidity of the players Land. It will consist of 3 States:

STATE 1: Normal, tempid → RESULT: everyone is happy, status quo

STATE 2: Sunny & dry → RESULT: water becomes scarce, sunlight is abundant

STATE 3: Cloudy & Rainy → RESULT: sunlight becomes scarce, water is abundant

Lets take a quick dive into the math behind the magic. 🧙‍♂️🧮

Fundamental Equation

Score = alpha * ObjFactor + (1-alpha) * RandFactor

Our mechanism employs a unique combination of deterministic and probabilistic factors to operate. To put it simply, it takes into account the real-world changes in Ethereum and a bit of randomness to decide its course of action.

💡 Key Variables:

  • Score: The final result that decides the state in action. It's a blend of the deterministic factor, called the Objective Factor (ObjFactor), and a random element, referred to as the Random Factor (RandFactor).

  • alpha : A tuning factor that decides the influence of ObjFactor and RandFactor. It varies from 0 to 1. A higher alpha value prioritizes the deterministic aspect, whereas a lower alpha value leans towards randomness.

  • ObjFactor: The deterministic element, derived from the change in Ethereum's Gas price.

  • RandFactor: A random number fetched from a blockchain variable like block hash or timestamp, bringing an element of surprise into play.

Deterministic Equation

ObjFactor = ((CurrentGasPrice - HistoricalGasPrice) / HistoricalGasPrice)*100

💡 Key Variables:

  • ObjFactor: The deterministic element derived from the change in Ethereum's Gas price.

  • CurrentGasPrice: The prevailing Gas price in Ethereum.

  • HistoricalGasPrice: The past Gas price in Ethereum (the one stored from the previous smart contract operation)

Restrictions

  1. If **ObjFactor** > 20, set to 20

  2. If **ObjFactor** < -20, set to -20

State Transitions

The state of the mechanism is based on the Score:

  • If Score lies in the range [-10, 10], the mechanism is in State 1.

  • If Score lies in the range [10, 20], the mechanism is in State 2.

  • If Score lies in the range [-10,-20], the mechanism is in State 3.

Safety measures:

We aim for the score to stay within [-20,20], however, in case of any anomalies, we've added some default rules to keep things running smoothly:

  • If Score is >20, set to State 1.

  • If Score is <-20, set to State 1.

Random Element Equation

Range [-20,20]

The Random Factor, a randomly generated value using a blockchain variable such as block hash or timestamp. It adds an element of unpredictability to the system.

Tunable Parameters

alpha: This value, ranging from [0,1], controls the predictability of the mechanism.

  • A higher value makes the mechanism more predictable as it weighs the deterministic aspect more.

  • A lower value makes the mechanism less predictable by adding more weight to the random element.

  • By tweaking the alpha value, we can control the balance between predictability and randomness in the mechanism.

HistoricalGasPrice: This is the previous Gas price in Ethereum, as recorded in the smart contract. Changing how we store or calculate the previous gas price can impact how the ObjFactoris calculated.

StateChange Frequency: We can control the frequency of state changes (how often this state change mechanism smart contract is called). It could be daily, every two days, weekly, after x amount of blocks, etc.

StateRanges: Adjusting the ranges for triggering the states can significantly influence their likelihood of being activated.

RandFactor: Altering the range of the random element can impact the operation of the mechanism.

Last updated