In an RPG (or any other type of game), there need to be some calculations done using the status of the player or other combatants – in ORK Framework you create your calculations using formulas.

Formulas can be used across ORK Framework for different things, like:

  • damage of an ability
  • hit chance, critical chance, counter chance, block chance, …
  • movement speed
  • animation speed
  • battle order (turn based, active time)
  • crafting success
  • many more …

You see, there are a lot of things that can use formulas – and since you can create your own status system however you like it, you can also create the formulas that use your status system.

Formula Types

To keep things organized, formulas can be separated into different formula types. This is only used to allow you filtering the list of formulas – which will get pretty long, since you’ll create an RPG with many different abilities, items and other things.

Formula types are created in the ORK Framework editor in the Game section, Formula Type sub-section.


Formulas are created using a node editor (you can learn more about the node editor in this how-to). You’ll find the (formula) node editor in the ORK Framework editor: Game > Formulas


A formula, simply put, calculates a value (the result of the formula) using two combatants – the user and the target. E.g. when using an ability, the user of the ability is also the user of the formula, and the target of the ability is also the target of the formula. The result is calculated step by step – this means that every step (node) is calculated on it’s own changes the current value of the formula using it’s operator.

The operator decides how a step is calculated to the current result of the formula:

  • Add
    Adds the step’s result to the current result of the formula.
  • Sub
    Subtracts the step’s result from the current result of the formula.
  • Multiply
    Multiplies the current result of the formula with this step’s result.
  • Divide
    Divides the current result of the formula by the step’s result.
  • Modulo
    Uses the modulo operator, current result of the formula % the step’s result.
  • Power Of
    The current formula result to the power of the step’s result.
  • Log
    The current formula result is used in a logarithmic calculation with the step’s result as base.
  • Set
    Sets the current formula result to the step’s result.

Due to this step by step calculation, you can’t convert mathematical formulas directly into ORK formulas – there are no parantheses available to calculate a part before using the result of this part in the formula. To achieve this, you can break down your calculation into multiple formulas – because a formula can simply use another formula as a step.

Using formulas in formulas is also helpful when you create your system – since you’ll most likely have some base calculations that are used in many formulas. Like a base physical damage calculation – simply create a formula that calculates your physical damage (e.g. user ATK ^2 / target DEF) and use this basis in all different formulas that are used for physical attacks (e.g. the base attack, critical attack, a special skill, etc.).

The formula steps are divided into different categories, not every step will calculate or change the result of the formula – some are used to decide what to do next.

Base Steps

The base steps offer some basic mathematical operations, like rounding, limiting the current formula result or using the absolute value (-5 will become 5).

There’s also a step to randomly execute a next step (out of a list of steps that are connected to this node).

Check Steps

The check steps don’t change the result of the formula – they check for certain conditions and decide which step will be executed next.

You can check the current result of the formula, a combatant’s status or a distance, angle or orientation.

Combatant Steps

The combatant steps use values of different statuses of the combatant.

You can use status values, attack/defence attributes, level (or class level) and other information of the combatant.

Position Steps

The position steps use the positions of user and target.

You can use the distance or angle between them.

Selected Data Steps

The selected data steps can set abilities (also base/counter attack), equipment and items of a combatant as selected data. You can learn more about selected data in this how-to.

Selected data can be used by other formula steps to e.g. use an equipment’s or ability’s variable.

Value Steps

The value steps can change the formula result with different values (a defind value, a random value between two values, the minimum/maximum of two values).

The value itself can either be defined, the value of a game variable or PlayerPrefs variable, or the result of another formula.

Variable Steps

Change or check game variables.

Testing a formula

You can simply test your formula in the ORK Framework editor.

Select a combatant for the user and a combatant for the target and click on Calculate in the Test Formula foldout.

Please note that position steps will use the value 0 as their result, since no game objects exist for the combatants.