This document discusses domain-specific languages (DSLs) for games. It begins by defining DSLs and distinguishing them from scripting languages. An example DSL called Tracery is presented for generating text. Another DSL called Ephemerald is shown, which is similar to Tracery but integrated into a browser. Additional examples of game DSLs are provided, like the Game Maker Language (GML) and PuzzleScript for puzzle games. Historical examples of game DSLs are also outlined. The talk concludes by discussing considerations for creating your own DSL.
10. DOMAIN SPECIFIC LANGUAGES
Difference to “scripting language”:
a) Actually a DSL can be a scripting language. A scripting language
can be domain-specific after all, think GameMaker Language.
b) Whether a DSL is more suited for you than a generic scripting
language depends on many factors.
20. Tracery
Code
Text
SVG
HTML
Ephemerald
Browser
GML
+ A nice interface with syntax highlighting and autocomplete
+ Deterministic random (seeds)
+ Probabilities
+ Shuffle bag instead of pure random for rule selection
+ Math functions
+ Regular Expressions
30. WHAT I WON’T TALK ABOUT
I will not talk about them, though one could argue that they are DSLs:
– Scratch, Logo and the likes
– Erlang, Prolog and friends
– TinyMUD, LPMud, DikuMUD, and other MUD code bases
– Code Red, TIS-100 and other in-game languages
Why? I only have 45 minutes …
35. HISTORICAL EXAMPLES
Game Adaptation Language and Sierra Creative Interpreter
ZIL, Inform and Inform 6 all compile to “Z-Machine code”, Infocom
SCUMM, Lucasfilm Games
Adventure Game Studio has a domain-specific scripting language
50. VGDL FEATURES
• Spawning, cloning and elimination of
objects, as well as transformation from one
type into another.
• Self-propelled movements of objects, taking
consistent or random actions, or erratically
changing direction.
• Non-deterministic chasing and fleeing
behaviors.
• Projectile objects, spawned at the location of
arbitrary objects, on fixed or random
schedules, based on user actions, or
triggered by collision effects.
• Stickiness, i.e., one object pulling another
one.
• Bouncing and wrap-around behavior, from
other objects or the edge of the screen.
• Teleportation of objects, to fixed or random
end- locations.
• Continuous physics effects like inertia,
friction and gravity.
• Stochastic effects like slipping in the current
direction, or wind gusts.
77. Grammar Outline
(word processor)
Grammar in EBNF
(text editor)
Lexing & Parsing
(command line)
Experimental Code in your DSL
(text editor)
Native Code
(IDE of choice)
78. THANKS TO
Everyone who was involved in any of the projects I’ve talked about
today. Especially @pyjamads for UnityVGDL implementation.
Special thanks to @zarawesome, @alphachar, @aeonofdiscord,
@pyjamads, @mtrc, @EigenLenk, @PetriPurho, and others for
feedback on Twitter.