forwardQuick Intro

✅ What is DSL Forge

  • A modular, designer-friendly text scripting system for Unity

  • Turns text or visual flows into executable in-game logic

  • Supports branching dialogues, quest systems, event logic, and modular content


✅ Core Philosophy

  • Modularity: Split logic into reusable script units

  • Designer-Friendly: Non-programmers can author flows

  • Data-Driven: Avoid hardcoding, enable hot updates and version control

  • Extensible: Write your own command modules


✅ Main Architecture Flow

  1. Text → Tokenizer → Tokens

    • Parses commands and parameters, handles nesting

  2. Tokens → Parser → AST

    • Converts to a tree structure, suitable for visual editing

  3. AST → Flow

    • Compiled into a lightweight executable format

  4. Flow → Interpreter

    • Executes commands asynchronously

  5. Command System

    • Calls registered command handlers


✅ Built-in Modules Overview

  • Control Flow: Condition, If, Else, Branch, Goto, Call, Return

  • Math: Add, Subtract, Multiply, Divide

  • Comparison: Eq, Gt, Lt, Ge, Le, ApproEq

  • Collections: Set, List, Dict

  • Events: EventEmit, Trigger, EventOn, EventClear

  • Statistics: Sum, Mean, Variance, StandardDeviation

  • Dialogue (optional): Say, Choice, Option, PopUp, etc.

See the Command Encyclopedia for full details.


✅ Example: Using Condition


✅ How to Use in Your Project

  • Create Scripts: Author in text or visual editor

  • Save: .txt files or ScriptableObject Assets, import/export freely

  • Load: Assets, Resources, external files, or network

  • Execute: Interpreter runs flows asynchronously


✅ Variable System

  • Local Variables: Per-interpreter instance

  • Global Variables: Shared across all interpreters

  • Supports saving/loading as JSON


✅ How to Extend

  • Create custom modules (inherit DSLCommandModule)

  • Implement GetCommands and optional GetCommandDescriptions

  • Register with the Interpreter via RegisterModule

  • Editor auto-generates command encyclopedia entries


✅ Design Philosophy

  • Two-way text and visual editing

  • Modular, maintainable design

  • Version-control-friendly

  • Supports team collaboration and ongoing updates

Last updated