Interpreter

The Interpreter is the runtime core of DSL Forge.

Its primary job is to turn data-defined flows into real in-game behavior.


Running Commands in Order or Branching

The Interpreter reads a Flow's command sequence and executes them step by step.

When it encounters control flow commands (like Condition or Branch), it evaluates conditions and chooses the next path dynamically.

This enables flexible task systems, branching dialogues, and responsive event handling.


Supporting Control Structures (If/Else, Goto/Call)

Interpreter has built-in support for control flow structures:

  • Condition/If / Else for conditional branching

  • Goto for jumping between flows

  • Call for invoking sub-flows with return support

These allow developers to build complex game logic and state machines without hardcoding.


Managing Local and Global Variables

The Interpreter includes a variable system:

  • Local Variables: unique to each Interpreter instance

    • Ideal for storing per-task, per-character, or per-event state

    • Isolated, enabling parallel tasks

  • Global Variables: shared across all interpreters

    • For system-wide communication

    • Enabling game-level persistent state

Commands like Set, Get, SetGlobal, and GetGlobal allow reading and writing these variables.


Asynchronous Execution

The Interpreter is designed for asynchronous execution, perfect for:

  • Dialogue systems: waiting for player choices

  • Quest systems: listening for events, waiting for conditions

  • Event systems: handling cross-frame or cross-scene triggers

Async APIs let flows pause, wait, and resume naturally without blocking the main thread.


Turning Data-Defined Flows into In-Game Behavior

In short, the Interpreter is what brings DSL Forge to life in your game.

Designers author flows in text or visually → these are parsed into Flows → the Interpreter executes them at runtime.

This enables:

  • Removing hardcoded logic

  • Fully data-driven, designer-friendly iteration

  • Hot updates and network-delivered content

  • Modular, moddable systems and user-generated content

Last updated