🧩How to Custom Modules

In DSL Forge, a module is a unit for registering a set of related commands. Modular design means clean separation, easy extension, pluggability, and maintainability.

Developers can write custom command modules to fit any game need.


✅ Why Create Custom Modules

  • Organize game logic commands into clear functional areas

  • Allow team members to work in parallel

  • Support version control and CI workflows

  • Avoid a giant monolithic command file

  • Enable DLC, mod, and plugin systems


✅ What Is a Module

In code, a module is a class that inherits from DSLCommandModule.

  • Must implement GetCommands:

    • Returns a dictionary of command names and handlers

  • Optionally implements GetCommandDescriptions:

    • Provides human-readable descriptions

    • Shows up automatically in the Command Encyclopedia


✅ Simplest Example

✅ Explanation:

  • HelloWorld is a custom command

  • When called, it logs to the Unity console

  • Its description will appear in the Command Encyclopedia in the editor


✅ How to Register a Module

To make the interpreter aware of a module, register it at initialization:

Once registered:

  • All its commands become available

  • Visual Editor and Command Encyclopedia will pick them up automatically


✅ Command Parameters and Return Values

  • Commands are async Task functions

  • All parameters come in as DSLParameter, use EvaluateParameter() to parse them

  • Returns DSLParameter, supporting strings, lists, dictionaries, etc.

✅ Example:


  • Descriptions help designers and non-programmers understand commands

  • The editor automatically generates a Command Encyclopedia

  • Supports parameter docs, return info, and rich examples

✅ Example:


  • Create one module per functional area

    • e.g., Dialogue Module, Event Module, Math Module

  • Keep modules under version control

  • Register all needed modules at interpreter startup

  • Provide clear, well-documented command descriptions

Last updated