TinyRuleKit

Rule JSON

Rule JSON starts as a list of enabled rules. Each rule has one trigger, at least one condition, and at least one action.

Raw Array

JSON
[
  {
    "id": "vip_join_reward",
    "trigger": "PLAYER_JOINED",
    "conditions": [
      {
        "type": "LEVEL_AT_LEAST",
        "params": {
          "level": 5
        }
      }
    ],
    "actions": [
      {
        "type": "GIVE_COINS",
        "params": {
          "amount": 25
        }
      }
    ]
  }
]

Wrapped Document

Use a wrapped document when the file needs metadata such as required builder capabilities:

JSON
{
  "requires": [
    "ACTION_RESOLVER_CONFIGURED"
  ],
  "rules": [
    {
      "trigger": "PLAYER_JOINED",
      "conditions": [
        {
          "type": "LEVEL_AT_LEAST",
          "params": {
            "level": 5
          }
        }
      ],
      "actions": [
        {
          "type": "GIVE_COINS",
          "params": {
            "amount": 25
          }
        }
      ]
    }
  ]
}

Next Step

Every enabled rule must define at least one condition and one action. Keep this basic shape simple while learning: static condition types, static action types, and parameters that factories validate during engine construction.

Continue with RuleParams to validate action and condition parameters during compilation. Use JSON Operators later, after expressions and runtime requirements are clear.