Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Shibboleth Scripting – Domain Specific Languages in Games

34 views

Published on

A tour-de-force through examples of domain-specific languages for games. Includes a low-key intro on how to make your own compilers.

Published in: Software
  • Be the first to comment

  • Be the first to like this

Shibboleth Scripting – Domain Specific Languages in Games

  1. 1. Shibboleth Scripting DOMAIN-SPECIFIC LANGUAGES FOR GAMES
 MARTIN PICHLMAIR IT UNIVERSITY COPENHAGEN / BROKEN RULES / COPENHAGEN GAME COLLECTIVE

  2. 2. SHIBBOLETH?
  3. 3. PLEASE RAISE YOUR HAND IF 
 YOU CAN PROGRAM!
  4. 4. PLEASE RAISE YOUR HAND IF 
 YOU CAN WRITE!
  5. 5. WHO HERE HAS EVER WRITTEN A GRAMMAR?
  6. 6. AND WHO HAS 
 INVENTED A LANGUAGE?
  7. 7. DOMAIN SPECIFIC LANGUAGES Markup Languages Modelling Languages Programming Languages
  8. 8. DOMAIN SPECIFIC LANGUAGES Human-readable Computer-readable Made for a specific domain, not general purpose
  9. 9. 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.
  10. 10. LET’S LOOK AT AN EXAMPLE
  11. 11. TRACERY
  12. 12. Tracery Code Text SVG HTML Tracery Browser
  13. 13. DSL Code Lexer Parser Result Grammar Code
  14. 14. EPHEMERALD
  15. 15. Ephemerald download (free): https://martinpi.itch.io/ephemerald
  16. 16. 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
  17. 17. MY BOT ARMY
  18. 18. Cooking Recipe Ingredients Dish
  19. 19. HOUSEHOLD CONSTELLATIONS
  20. 20. LIVE DEMO TIME
  21. 21. NARRATIVE TOOLS
  22. 22. ink code Dynamic Dialogs ink Game
  23. 23. 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 …
  24. 24. THE DIKUMUD FAMILY TREE
  25. 25. GAME CREATION TOOLS
  26. 26. Ludii (Maastricht University, 2019) https://www.ludii.games
  27. 27. Fighter Maker OUTBACK/Kuusou Kagaku 1998 RPG Maker ASCII/Enterbrain 1992 Ren’Py Tom "PyTom" Rothamel 2004
  28. 28. 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
  29. 29. INFORM 6
  30. 30. SCUMM
  31. 31. LUA DOESN’T COUNT :P
  32. 32. PUZZLESCRIPT
  33. 33. Graphics Map Symbols Collisions Gameplay Levels
  34. 34. [ > Player | Crate ] -> [ > Player | > Crate ] [ < Player | Crate ] -> [ < Player | < Crate ]
  35. 35. PuzzleScript code Levels Graphics & Sound Rules
  36. 36. PuzzleScript code Levels Graphics & Sound Rules Game Engine
  37. 37. DESCRIBING VIDEO GAMES
  38. 38. VGDL
  39. 39. BasicGame SpriteSet moving > physicstype=GravityPhysics avatar > PlatformerAvatar img=newset/man1 jump_strength=5 wall > Immutable img=oryx/wall1 goal > Immovable img=newset/flag1 ladder > Ladder img=newset/ladder2 TerminationSet SpriteCounter stype=goal win=True scoreChange=100 SpriteCounter stype=avatar win=False scoreChange=-100 InteractionSet avatar EOS > killSprite goal avatar > killSprite moving wall > wallStop avatar ladder > onLadder LevelMapping G > goal ★ > goal w > wall A > avatar H > ladder
  40. 40. 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.
  41. 41. VGDL code Levels (Graphics) Rules
  42. 42. VGDL
  43. 43. Mads Johansen @pyjamads
  44. 44. Unity VGDL code Levels (Graphics) Rules
  45. 45. BRAIN TRAINING
  46. 46. ML-AGENTS
  47. 47. VGDL code Levels (Graphics) Rules Agents
  48. 48. Unity VGDL code Levels Scene Graph Gameplay Sprites
  49. 49. GAMES BY ANGELINA
  50. 50. DECKART
  51. 51. Deckart code Rules Card Texts
  52. 52. Deckart Code Coco/R Deckart Runtime Card Game Deckart Language Swift Code
  53. 53. Schnapsen (Anonymous genius, <1715) Ascension (Stone Blade Entertainment, 2011)
  54. 54. THE FINAL FORM
  55. 55. Deckart code Coco/R Deckart Runtime Card Game Deckart Language Swift C# Deckart Runtime Card Game
  56. 56. Deckart code Rules Tracery Code Card Texts Ephemerald Deckart Card Layouts
  57. 57. The Design Space of All Kinds of Potential Card Games Generate Generate Generate Generate
  58. 58. SO YOU WANT TO WRITE YOUR OWN DSL?
  59. 59. DSL Code Lexer Parser Generator Grammar Code ResultParser
  60. 60. Lexer Parser Parser Combinators C#* Garden Points Lexer Hime Grammatica GPPG Sprache Superpower Parseq Swift OysterKIT Coco/R FootlessParser SwiftParsec C/C++ lex yacc/bison pcomb Java ANTLR jparsec *Here is a good article: https://tomassetti.me/parsing-in-csharp
  61. 61. Grammar Outline (word processor) Grammar in EBNF (text editor) Lexing & Parsing (command line)
  62. 62. Grammar Outline (word processor) Grammar in EBNF (text editor) Lexing & Parsing (command line) Experimental Code in DSL (text editor)
  63. 63. 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)
  64. 64. 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.
  65. 65. QUESTIONS? Martin Pichlmair @martinpi
 mpic@itu.dk Get Ephemerald here (free): https://martinpi.itch.io/ephemerald

×