DSL Forge’s Command System is designed from the ground up to be modular and plugin-friendly, allowing teams to build their own command libraries as needed.
In the Interpreter’s architecture, all commands are registered via modules, with no hardcoded binding.
Registering Commands via Modules
Each command module can independently define and implement a set of commands
The Interpreter uses the RegisterModule method to load modules
Modules "expose" their supported command names and handlers to the Interpreter
This design means commands can be added, maintained, or removed without touching core systems, giving projects maximum flexibility.
// Load and parse DSL flows from Resourcesflows=DSLFlowGenerator.GenerateFlowsFromAsset(dslAsset);dialogueModuleDialogue=newDialogueModule();interpreterDialogue=newDSLInterpreter(flows,$"{gameObject.name}'s Dialogue");interpreterDialogue.RegisterModule(dialogueModuleDialogue);
Teams Can Write Custom Command Modules
Teams can create their own C# classes inheriting DSLCommandModule
Define any new commands specific to their project
Examples include custom game rules, special events, AI behavior, or level logic
These custom modules coexist seamlessly with built-in ones, fully integrated into DSL Forge’s runtime.
Rich Built-in Modules
DSL Forge ships with out-of-the-box modules covering common game scripting needs:
Control Flow Module
If, Else, Branch, Goto, Call
For branching dialogue, task conditions, state machines
Collections Module
Set, List, Dict
Manage complex data structures, condition tables, dialogue options
Math Module
Add, Subtract, Multiply, Divide
Handle formulas, attribute calculations
Comparison Module
Eq, Gt, Lt, Ge, Le, ApproEq
Enable conditional branching and numerical checks
Event Module
EventEmit, Trigger, EventOn, EventClear
Manage global or local event systems
Statistics Module
Mean, Variance, Std, etc.
Support design tuning, AI behavior modeling
These modules work out-of-the-box but also serve as reference templates for building custom modules.
Editor Integrations: Command Encyclopedia and Parameter Documentation
DSL Forge’s Editor includes an integrated Command Encyclopedia:
Automatically scans all registered commands and their descriptions
Provides a searchable, browsable command list
Lets designers see definitions and usage examples in the visual editor
For custom modules:
Teams can include their own command descriptions
Ensures designers see consistent, standardized documentation
This editor integration reduces learning curves and makes non-programmer usage practical.
Why Plugin Architecture?
Command modules can be maintained and versioned independently
Different projects can selectively load needed command sets
Supports developing DLC, mods, or community expansion packs with their own commands
Ensures DSL Forge isn’t locked to today’s needs, but is infinitely extensible
Summary
Plugin Command Architecture is a core design philosophy of DSL Forge—making the command system both powerful and flexible so teams can build exactly what they need.
public class MathModule : DSLCommandModule
{
public override Dictionary<string, Func<DSLParameter, Task<DSLParameter>>> GetCommands(
DSLInterpreter interpreter)
{
return new Dictionary<string, Func<DSLParameter, Task<DSLParameter>>>
{
// Random seed
["RandomSeed"] = async cmd =>
{
if (cmd.parameters?.Count < 1) return null;
var p = await interpreter.EvaluateParameter(cmd.parameters[0]);
if (int.TryParse(p.value, out int seed))
_random = new Random(seed);
return null;
},
// more commands...
}
}
}
public class MathModule : DSLCommandModule
{
public override Dictionary<string, string> GetCommandDescriptions()
{
return new Dictionary<string, string>
{
["RandomSeed"] = @"⭐ Purpose:
Set the seed for the random number generator to produce repeatable sequences.
📝 Parameters (1 arg):
- seed (int): Seed value for the random generator.
✅ Returns:
- None
🎯 Example:
RandomSeed(42)
",
// more commands...
}
}
}