> For the complete documentation index, see [llms.txt](https://roogame.gitbook.io/roogame/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://roogame.gitbook.io/roogame/roo-gameplay-framework/stats-system/formulas-and-progression-tables.md).

# Formulas and Progression Tables

A Stat Formula Data Asset evaluates a text expression. It can read Self and Target Roo Stats Components and can optionally use one Progression Table.

## Create the assets

In the Content Browser, right-click inside the destination folder and select:

* `RooGame > Stat > Stat Formula` to create a Formula Data Asset.
* `RooGame > Stat > Progression Table` to create a growth table.

## Arithmetic

Supported operators:

```
+  -  *  /  ( )
```

Unary plus and minus are supported.

Example:

```
5 + 3 * self.stat[Level]
```

## Component values

Supported references:

```
self.stat[StatNameOrFullTag]
self.base[StatNameOrFullTag]
self.attr[AttributeNameOrFullTag]

target.stat[StatNameOrFullTag]
target.base[StatNameOrFullTag]
target.attr[AttributeNameOrFullTag]
```

You can use a unique short name such as `Level`, or a complete tag such as `MyGame.Stats.Stat.Level`. Full tags are the safest option when multiple runtime entries could share the same leaf name.

Dot notation is also accepted, but bracket notation is recommended for complete Gameplay Tags.

Self is the component evaluating the Formula. Target is the second component passed to Calculate. Many internal single-component calculations pass the same component as both Self and Target.

Formula lookup follows the Stats Component's runtime entries rather than a fixed `RooGame` root, so formulas work with custom Designer namespaces.

If a component, tag, or table cannot be resolved, that reference evaluates to 0.

## Functions

Supported numeric helpers:

```
min(a, b)
max(a, b)
clamp(value, min, max)
abs(value)
floor(value)
ceil(value)
round(value)
sqrt(value)
pow(value, exponent)
```

Random helpers:

```
random(min, max)
chance(percent)
dice(numberOfDice, sides)
```

chance uses a percentage from 0 to 100 and returns 1 on success or 0 on failure.

## Progression Tables

A Progression Table supports Manual, Constant, Linear, and Geometric growth modes.

Formula table functions:

```
table.stage(value)
table.value(stage)
table.increment(stage)
table.current(value)
table.next(value)
table.ratio(value)
```

curve can be used as an alias for table.

Example level formula:

```
table.stage(self.stat[Experience])
```

## Editor preview

Double-click a Progression Table to open Details and Growth Preview. The preview displays stage growth and cumulative values.

<figure><img src="https://2218703886-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4YPyrdOyfjDGtlxlvjSd%2Fuploads%2FdCNjZSJhqIFlQAiaUquN%2Fimage.png?alt=media&#x26;token=658ac7aa-1b27-43d5-b391-001cfa274fc6" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2218703886-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4YPyrdOyfjDGtlxlvjSd%2Fuploads%2FCgG11HHZ365YO1sBWLlV%2Fimage.png?alt=media&#x26;token=ed418741-b0c6-4ecc-ae31-ef8b388e627e" alt=""><figcaption></figcaption></figure>

## Error handling

The parser is intentionally lightweight. Invalid references and unsupported expressions generally resolve to 0 rather than producing a detailed editor error. Test formulas through the Demo, Blueprint output, or the component debug-string nodes.
