Abstract
Procedural Content Generation (PCG) via graph grammars provides robust structural control for game levels but often lacks intuitive "steering" mechanisms for designers. This paper introduces a method to control graph grammars by training probabilistic parameters on specific examples. By assigning probabilities to rule selection and outcomes, the system learns to replicate the qualities of a designer-curated training set. We demonstrate that this approach allows for significant shifts in the expressive range of generated dungeon missions, effectively targeting specific metrics such as linearity, leniency, and redundancy without requiring manual rule rewriting.
Introduction
In game development, Procedural Content Generation (PCG) is a powerful tool for creating varied content, yet it remains a double-edged sword. Graph grammars are frequently employed to generate "mission graphs"—the logical flow of a dungeon, such as obtaining a key to unlock a specific door. While these grammars offer structural guarantees, they are notoriously difficult to steer toward specific design goals.
Currently, adjusting a grammar to favor certain traits, like increased linearity or reduced redundancy, requires deep expertise in grammar theory. Designers must often rewrite rules or craft complex sequences of rule applications, a process that is both time-consuming and error-prone. This "control gap" often results in grammars that, while technically functional, produce "pointless areas" or trivial paths. This research addresses this gap by shifting the designer's focus from internal rule logic to the desired output characteristics.
Methodology
The proposed framework builds upon the context-sensitive graph grammar framework established by Dormans and Bakkes (2011), introducing a novel probabilistic extension.
Probabilistic Rule Selection
The system introduces "knobs" at two critical decision points:
- Match Selection: When multiple subgraphs match a rule's left-hand side, the system uses learned probabilities to decide which instance to transform.
- Outcome Selection: For rules with multiple possible right-hand sides (outcomes), the system selects an outcome based on assigned probabilities.
Learning from Examples
To guide the generation, the system tracks a "generation chain"—a comprehensive history of every rule applied and the alternatives available at each step. When a designer provides a set of "good" examples, the system analyzes these chains using Maximum Likelihood Estimation. By counting the frequency of specific rule applications relative to their alternatives in the successful examples, the system updates its internal probability distributions to favor those outcomes in future generations.
Experimental Setup
The system was evaluated using a synthetic bootstrap approach based on the dungeon mission grammar from Dormans and Bakkes (2011). A base set of 1,000 graphs was generated using the unaltered grammar. These graphs were then filtered using four key metrics to create specialized training sets:
- Mission Linearity: The degree to which the mission follows a single path.
- Map Linearity: The physical layout's linearity.
- Leniency: A measure of safety or ease for the player.
- Path Redundancy: The presence of unnecessary or circular paths.
Key Results
The researchers demonstrated that the system could successfully shift the statistical distribution of its outputs to match desired thresholds.
Key performance shifts included:
- Leniency: When targeting "easy" graphs (Leniency > 0.5), the yield of such graphs increased from 12.3% to 68.4%.
- Linearity: For high Mission Linearity (> 0.55), the output yield rose from 12.2% to 71.9%.
- Redundancy: When trained to minimize "useless rooms" (Path Redundancy < 0.04), the system improved from 32.5% to 70.0% "clean" graphs.
While the system does not guarantee that every output meets the threshold, it significantly biases the generator toward the designer's intent.
Discussion and Future Work
Despite its success, the current approach has limitations. Training examples must currently be generated by the grammar itself; the system cannot yet learn from arbitrary, hand-drawn graphs that fall outside the grammar's existing capabilities. Furthermore, the system tunes probabilities but does not invent new rules. If a design goal requires a structure the current rules cannot represent, the system remains limited by the base grammar.
Future work will explore "human-in-the-loop" studies to compare how designers interact with this example-based interface versus traditional rule-editing methods. Additionally, expanding the system to learn from external examples remains a key area for development.
Summary updated