Skip to content

1 Problem Statement and Motivation

Cedric Decoster edited this page Jun 19, 2025 · 5 revisions

Problem Statement & Motivation

1.1 What is SAGE?

SAGE (Substrate Asset Game Engine) is an on-chain, generic asset-state and transition framework implemented as a Substrate pallet. It gives blockchain developers a declarative, schema-driven way to:

  • Define Asset Types (“what data does an asset carry?”)
  • Compose State Transitions (“what moves are allowed?”)
  • Attach Rule-Sets that gate transitions in a compact DSL

In essence, SAGE turns custom game logic into a reusable, auditable state machine that lives directly on-chain, inheriting all of Substrate’s upgrade-and-governance capabilities.


1.2 Why SAGE?

Traditional blockchain game development faces a familiar dilemma:

Challenge Consequence
Boiler-plate low-level code to manage storage items, indexes, and events Reinventing the wheel; duplicated bugs across projects
Hard-coded logic tightly coupled to the pallet High friction to iterate or extend mechanics
Scattered security checks sprinkled throughout Inconsistent validation → subtle, exploitable bugs
Poor composability across projects Assets siloed; no cross-game interoperability
Slow iteration cycles (new runtime release for every rule tweak) Kills rapid prototyping and modding

SAGE Solves These With:

  • Declarative Asset Model
    Define fields, types, and indices in a schema—no boiler-plate storage code.
  • Transition Primitives
    CRUD-style operations (create, update, delete, mint, burn, split, merge) that you can chain into high-level “moves.”
  • Deterministic Rule Engine
    Pre- and post-conditions in a concise DSL, evaluated on-chain for full auditability.
  • Composable I/O Graph
    Transitions consume input assets and emit outputs, enabling “Lego-like” gameplay logic.
  • Hot-swappable Specs
    Minor rule adjustments signaled and upgraded via governance—no full runtime bump required.
  • Substrate-native
    Inherits fork-less upgrades, weight accounting, multi-sig governance, and on-chain event emission out of the box.

1.3 Problems SAGE Solves for Blockchain Developers

  1. Time-to-Market
    Write specs instead of code; ship gameplay prototypes in hours, not weeks.
  2. Strong Security Guarantees
    Centralized rule evaluation and exhaustive asset accounting eliminate entire classes of logic bugs (double-spend, missing ownership checks, inconsistent state).
  3. Upgrade Friendliness
    Evolving game mechanics becomes a governance proposal, not a hard fork.
  4. Cross-Game Interoperability
    Uniform asset schemas and event semantics make it trivial for wallets, explorers, and other games to understand and reuse assets.
  5. Community Modding
    Players can propose new transitions or fine-tune parameters through DAO governance—no privileged developer required.
  6. Analytics-Ready
    Every transition emits structured events, enabling rich on-chain analytics and replayable simulations.

1.4 Reference Use Case — “Penguin Eats Fish”

To ground these abstractions, SAGE provides a canonical tutorial:

Scenario: A Penguin player asset consumes a Fish consumable asset to restore health.

Input-1: Penguin (type = PLAYER, health = 95)
Input-2: Fish    (type = CONSUMABLE, health =  5)
Transition: EAT
    • Update  Penguin.health += Fish.health
    • Delete  Fish
Output-1: Penguin (health = 100)

Penguin Eats Fish Visual

Without SAGE, developers must hand-roll storage structs, ownership indexes, dispatchables, and event emission. With SAGE, a ~15-line transition spec encodes the entire flow—runtime, client, and analytics all speak the same language.

Clone this wiki locally