SAGA: A DSL for Story Management
Video game development is currently a very labour-intensive endeavour. Furthermore it involves multi-disciplinary teams of artistic content creators and programmers, whose typical working patterns are not easily meshed. SAGA is our first effort at augmenting the productivity of such teams. Already convinced of the benefits of DSLs, we set out to analyze the domains present in games in order to find out which would be most amenable to the DSL approach. Based on previous work, we thus sought those sub-parts that already had a partially established vocabulary and at the same time could be well modeled using classical computer science structures. We settled on the ‘story’ aspect of video games as the best candidate domain, which can be modeled using state transition systems. As we are working with a specific company as the ultimate customer for this work, an additional requirement was that our DSL should produce code that can be used within a pre-existing framework. We developed a full system (SAGA) comprised of a parser for a human-friendly language for ‘story events’, an internal representation of design patterns for implementing object-oriented state-transitions systems, an instantiator for these patterns for a specific ‘story’, and three renderers (for C++, C# and Java) for the instantiated abstract code.
💡 Research Summary
The paper presents SAGA, a domain‑specific language (DSL) designed to improve productivity in video‑game development by bridging the gap between non‑programmer story designers and programmers. After analysing the typical structure of medium‑to‑large game studios, the authors identify five core requirements for a successful DSL: productivity, comfort (ease of use for non‑programmers), usability (automatic transformation into a form usable by programmers), integrability (seamless incorporation into an existing engine), and low runtime overhead. They argue that the “story” component of a game best satisfies these constraints because it already possesses a partially established vocabulary and can be formally modeled as a state‑transition system.
The paper surveys common narrative structures—linear, branching, fold‑back (parallel paths), threaded, and dynamic hierarchical—and shows how each can be represented as a directed graph of states and transitions. This formal model underpins the internal representation of SAGA. The system consists of four main modules: (1) a parser for a human‑friendly textual syntax (keywords such as event, state, transition, action), (2) an internal meta‑model that encodes object‑oriented design patterns (State, Factory, etc.) in a language‑independent way, (3) an instantiator that binds a particular story specification to the meta‑model, and (4) three code generators that emit concrete C++, C#, and Java source files. The generated code contains only the necessary state‑transition logic, minimizing CPU and memory impact at runtime, and can be dropped into the partner studio’s existing engine without major refactoring.
Implementation details include the use of ANTLR for parsing, a Java‑based meta‑model, and template‑driven renderers for each target language. The DSL’s syntax is deliberately simple, allowing story designers to write specifications like “event OpenDoor { transition Closed -> Opened }” without learning programming concepts. The authors report that the system satisfies all five requirements, notably reducing the communication overhead between designers and programmers and enabling rapid iteration on narrative content.
Related work is discussed, highlighting that most prior DSL efforts in games target low‑level systems (physics, rendering) where the developers are already software engineers. SAGA’s focus on a high‑level, creative domain distinguishes it. Limitations include the current support for only a subset of narrative patterns and the lack of tooling for procedural or dynamically generated stories.
In conclusion, SAGA demonstrates that a well‑scoped DSL can effectively increase team productivity, provide a comfortable authoring environment for non‑technical staff, and integrate cleanly with existing codebases. Future work will expand the language to cover richer story models, add debugging and visualization tools, and explore applicability to other game genres.
Comments & Academic Discussion
Loading comments...
Leave a Comment