DOKK Library

Opportunities for Approachable Game Development via Program Synthesis

Authors Max Kreminski Michael Mateas

License CC-BY-4.0

Plaintext
     Opportunities for Approachable Game Development via Program Synthesis
                                              Max Kreminski, Michael Mateas
                                                 University of California, Santa Cruz
                                                  {mkremins, mmateas}@ucsc.edu




                           Abstract                                   instead attempt to produce computational systems that can
                                                                      reason over the much wider range of game behaviors im-
     Program synthesis techniques can be used to improve
                                                                      plementable in general-purpose programming languages. At
     the approachability of game development, but much
     work remains to be done in bridging the gap between              the same time, recent work in program synthesis (Gulwani
     program synthesis and game development support. We               et al. 2017) has shown that computers are capable of gen-
     propose three high-level categories of research that             erating programs that meet user needs in a variety of con-
     might be undertaken in pursuit of this goal.                     texts, from data science (Drosos et al. 2020) to graphic de-
                                                                      sign (Hempel and Chugh 2016). Though they may make in-
                                                                      ternal use of narrow domain-specific languages, many pro-
                        Introduction                                  gram synthesizers eventually output code in general-purpose
Digital games are a powerful expressive medium. They                  programming languages like those typically used for game
can be used to communicate ideas through procedural                   development. Consequently, synthesizers can generate pro-
rhetoric (Bogost 2010); to express deeply personal experi-            grams that demonstrate a wide range of possible behaviors.
ences (Anthropy 2012); and to provoke contemplation of                   This raises an intriguing question: can we use program
complex phenomena (Rusch 2017).                                       synthesis techniques to improve the approachability of game
   In each of these cases, the ability of games to deal di-           development in general-purpose programming languages?
rectly with systems is key to their expressive potential. Be-         We believe the answer is yes, but that there is much work
cause games deal in systems, code plays a critical role in im-        to be done to bridge the gap between program synthesis and
plementing their behavior—and games are often developed               game development support. In the remainder of this paper,
in general-purpose programming languages that take signif-            we briefly propose three high-level categories of research
icant time and effort to learn, even in carefully constructed         that might be undertaken in pursuit of this goal.
educational environments. As a result, the difficulty of pro-
gramming represents a significant barrier to entry for many                             Expressive Synthesis
would-be creators of digital games.                                   Many existing program synthesizers aim to generate code
   Some game creation tools, such as Game-O-Matic (Tre-               that is purely utilitarian: for instance, code that accurately
anor et al. 2012), Wevva (Powley et al. 2017), and Germi-             implements a user-intended transformation of spreadsheet
nate (Kreminski et al. 2020), allow users to create certain           data (Gulwani 2011). But from a software engineering per-
kinds of games without having to deal with the minutiae               spective, game code stands out as unusual, because the code
of coding in a general-purpose programming language. In               itself is often expressive in nature. Code that implements
some cases, approachable tools have played a major role in            game mechanics must trigger visual or auditory feedback,
making digital games available as a medium of expression              to help the player understand what is happening in the game
to a more diverse set of creators (Harvey 2014). However,             world when they take certain actions. Code that implements
these tools achieve their approachability by restricting their        non-player character behavior typically aims to give charac-
users to tiny subsets of the space of all possible games. This        ters a distinctive personality, which the player can discover
allows these tools to present a highly simplified interface for       through interaction. And code that interacts with or ties to-
defining game behavior, but massively limits the kinds of             gether a game’s operational logics (Osborn, Wardrip-Fruin,
gameplay that users can define.                                       and Mateas 2017) can be interpreted as making arguments
   Cook has recently argued (Cook 2020) that research in              through procedural rhetoric—for instance, assertions like
automated game design (which is closely connected to the              “NPCs sometimes give you items when interacted with”, the
development of approachable game creation tools) should               details of whose implementation can play a substantial role
move away from narrow predefined game design spaces and               in shaping the player’s attitude toward NPC interactions, the
Copyright © 2021for this paper by its authors. Use permitted under    items they receive, and so on. Consequently, attempts to ap-
Creative Commons License Attribution 4.0 International (CC BY         ply program synthesis to game development must be aware
4.0).                                                                 of the expressive dimension of code.
   The Gemini game generator (Summerville et al. 2018) im-            As a result, game development applications of program
plements a limited form of expressive synthesis by allowing        synthesis may benefit from the use of casual creator design
users to specify their rhetorical intent for a game as an an-      patterns (like the Chorus Line or Approximating Feed-
swer set program, which constrains a generative space of           back) or reflective creator design patterns (like Interpretive
arcade games defined by the Cygnus game description lan-           Refraction or Inferring Intent) to help users more rapidly
guage. Generated Cygnus games are then translated directly         evaluate large numbers of potential intent realizations and
into executable JavaScript code. However, Gemini imple-            iterate on their intent in response (Compton and Mateas
ments a relatively limited set of operational logics; can only     2015; Kreminski and Mateas 2021). Germinate—a graph-
be used to create single-screen arcade games; uses only a          ical game creation tool built on the Gemini architecture—
small set of simple, hardcoded control schemes and entity          implements some of these design patterns; in particular, it
behaviors; and takes relatively little advantage of potential      presents users with a graphical logic programming interface
programmatic channels for player feedback (such as proce-          for specifying a design intent and allows them to rapidly add,
dural visual and audio feedback), resulting in games that are      remove, or negate parts of their explicit design intent based
often hard for players to interpret (Osborn et al. 2019). A        on features that are present in generated games. And Syn-
richer implementation of expressive synthesis could use the        thesifter (Kreminski, Wardrip-Fruin, and Mateas 2020) aids
full capabilities of a general-purpose programming language        users in building up a set of concrete positive and negative
to diverge from the specific, narrow space of games that the       examples as they refine their synthesized program by proac-
Cygnus GDL defines.                                                tively suggesting new examples, which the user can easily
   Also worth mentioning here is the use of program synthe-        either accept or reject.
sis to generate boss enemy behaviors, as described by Butler,         Additionally, it may be helpful for tools to facilitate re-
Siu, and Zook (2017). In this case, the synthesized programs       flection on how expressive intent relates to low-level parts
are expressive in that they yield different player experiences     of synthesized programs by providing affordances for de-
from one boss encounter to the next—but there is no way            sign journaling, perhaps based on the process described by
to indicate different expressive intents to the synthesizer, as    Khaled, Lessard, and Barr (2018). For instance, a tool could
a game designer might often want to do (e.g., to create one        prompt the user to leave plaintext notes for themselves on
boss that feels courageous and another that feels cowardly).       what they liked and disliked about each synthesized pro-
Nevertheless, concepts like the down-only-number in-               gram or game, allowing them to build up a searchable record
troduced as a specialized numeric type in this system may          of design successes and failures over time and preserve past
prove useful in the way that they capture relatively low-          intents even as they refine their design sense. Users might
level aspects of expressive intent: a more sophisticated pro-      then make use of this information in conjunction with an
gram synthesizer that generates boss behavior might use a          interpretable program synthesis interface like that presented
down-only-number for boss health by default but also               by Zhang et al. (2021) to guide the synthesizer’s search, in-
leave open the possibility of creating bosses that can heal        structing it to avoid parts of the search space that have fre-
themselves at certain points, indicating this to the rest of the   quently yielded unwanted programs and focus its search on
system via the constraints placed on the health variable in a      areas that seem especially promising instead.
form of type-directed program synthesis.
                                                                                   Educational Synthesis
                  Reflective Synthesis                             One advantage of program synthesis is that synthesized pro-
                                                                   grams need not remain black boxes to their users, even if the
One recurring issue in program synthesis is the difficulty that    user starts out with little knowledge of the target program-
users face in precisely articulating their intent. A number        ming language (Crichton 2019). In fact, a program synthe-
of strategies for resolving ambiguous user intent have been        sizer could even be designed to model user understanding
proposed in the program synthesis literature (Zhang et al.         of programming constructs (as is typical in tutoring-focused
2020), but the problem of intent ambiguity remains open.           applications of program synthesis, e.g. Head et al. 2017)
   In a game development context, the expressive dimension         and gradually tutorialize the language by periodically intro-
of code exacerbates this difficulty. Because there may be          ducing new constructs and idioms. Under such conditions,
many viable ways to write a program (e.g., an NPC behav-           the user’s reliance on the synthesizer might fade away over
ior script or game mechanic implementation) that nominally         time as they acquire greater confidence in reasoning about
satisfy a set of user-provided constraints, but each of these      the meaning of code. A synthesizer that enabled this experi-
implementations may feel slightly different from a player          ence could be viewed as a complementary cognitive artifact,
experience perspective, users may have to compare many             rather than a competitive one (Krakauer 2016): the new ca-
divergent implementations of their stated intent before they       pabilities it builds in the user remain with the user even when
can adequately determine which parts of the intent are cor-        the artifact itself is removed.
rect, which are incorrect, and which are over- or underspec-          In the context of game development, educational appli-
ified. Further, evaluating each of these complex behaviors         cations of synthesis might prove especially useful in help-
may take a nontrivial amount of time and effort on the part        ing users discover new game engine API features. Addition-
of the user, especially if they have to compare them in the        ally, a programming tutor-like system for game development
context of real gameplay situations to get a thorough sense        could be integrated with game design knowledge to assist
of the similarities and differences between implementations.       users in linking code to design concepts and vice versa.
                       References                               Kreminski, M.; and Mateas, M. 2021. Reflective creators.
Anthropy, A. 2012. Rise of the Videogame Zinesters: How         In International Conference on Computational Creativity.
Freaks, Normals, Amateurs, Artists, Dreamers, Drop-Outs,        Kreminski, M.; Wardrip-Fruin, N.; and Mateas, M. 2020.
Queers, Housewives, and People Like You Are Taking Back         Toward example-driven program synthesis of story sifting
an Art Form. Seven Stories Press.                               patterns. In Joint Proceedings of the AIIDE 2020 Workshops
Bogost, I. 2010. Persuasive Games: The Expressive Power         (AIIDE-WS-2020).
of Videogames. MIT Press.                                       Osborn, J. C.; Dickinson, M.; Anderson, B.; Summerville,
Butler, E.; Siu, K.; and Zook, A. 2017. Program synthesis       A.; Denner, J.; Torres, D.; Wardrip-Fruin, N.; and Mateas,
as a generative method. In Proceedings of the 12th Interna-     M. 2019. Is your game generator working? Evaluating Gem-
tional Conference on the Foundations of Digital Games.          ini, an intentional generator. In Proceedings of the AAAI
Compton, K.; and Mateas, M. 2015. Casual creators. In In-       Conference on Artificial Intelligence and Interactive Digital
ternational Conference on Computational Creativity, 228–        Entertainment, volume 15, 59–65.
235.                                                            Osborn, J. C.; Wardrip-Fruin, N.; and Mateas, M. 2017. Re-
Cook, M. 2020. Software engineering for automated game          fining operational logics. In Proceedings of the 12th Inter-
design. In 2020 IEEE Conference on Games (CoG), 487–            national Conference on the Foundations of Digital Games.
494. IEEE.                                                      Powley, E. J.; Nelson, M. J.; Gaudl, S. E.; Colton, S.; Ferrer,
Crichton, W. 2019. Human-centric program synthesis. In          B. P.; Saunders, R.; Ivey, P.; and Cook, M. 2017. Wevva:
PLATEAU Workshop @ UIST.                                        Democratising game design. In Thirteenth Artificial Intelli-
                                                                gence and Interactive Digital Entertainment Conference.
Drosos, I.; Barik, T.; Guo, P. J.; DeLine, R.; and Gulwani,
S. 2020. Wrex: A unified programming-by-example inter-          Rusch, D. C. 2017. Making Deep Games: Designing Games
action for synthesizing readable code for data scientists. In   with Meaning and Purpose. CRC Press.
Proceedings of the 2020 CHI Conference on Human Factors         Summerville, A.; Martens, C.; Samuel, B.; Osborn, J.;
in Computing Systems.                                           Wardrip-Fruin, N.; and Mateas, M. 2018. Gemini: Bidirec-
Gulwani, S. 2011. Automating string processing in spread-       tional generation and analysis of games via ASP. In Pro-
sheets using input-output examples. ACM Sigplan Notices         ceedings of the AAAI Conference on Artificial Intelligence
46(1): 317–330.                                                 and Interactive Digital Entertainment, volume 14.
Gulwani, S.; Polozov, O.; Singh, R.; et al. 2017. Program       Treanor, M.; Blackford, B.; Mateas, M.; and Bogost, I.
synthesis. Foundations and Trends® in Programming Lan-          2012. Game-O-Matic: Generating videogames that repre-
guages 4(1-2): 1–119.                                           sent ideas. In Proceedings of the Third Workshop on Proce-
Harvey, A. 2014. Twine’s revolution: Democratization, de-       dural Content Generation in Games.
politicization, and the queering of game design. G|A|M|E –      Zhang, T.; Chen, Z.; Zhu, Y.; Vaithilingam, P.; Wang, X.; and
Games as Art, Media, Entertainment 1(3).                        Glassman, E. L. 2021. Interpretable program synthesis. In
Head, A.; Glassman, E.; Soares, G.; Suzuki, R.; Figueredo,      Proceedings of the 2021 CHI Conference on Human Factors
L.; D’Antoni, L.; and Hartmann, B. 2017. Writing reusable       in Computing Systems.
code feedback at scale with mixed-initiative program syn-       Zhang, T.; Lowmanstone, L.; Wang, X.; and Glassman, E. L.
thesis. In Proceedings of the Fourth (2017) ACM Conference      2020. Interactive program synthesis by augmented exam-
on Learning @ Scale, 89–98.                                     ples. In Proceedings of the 33rd Annual ACM Symposium
Hempel, B.; and Chugh, R. 2016. Semi-automated SVG              on User Interface Software and Technology, 627–648.
programming via direct manipulation. In Proceedings of
the 29th Annual Symposium on User Interface Software and
Technology, 379–390.
Khaled, R.; Lessard, J.; and Barr, P. 2018. Documenting
trajectories in design space: a methodology for applied game
design research. In Proceedings of the 13th International
Conference on the Foundations of Digital Games.
Krakauer, D. 2016.            Will A.I. harm us? Better
to ask how we’ll reckon with our hybrid nature.
https://nautil.us/blog/will-ai-harm-us-better-to-ask-how-
well-reckon-with-our-hybrid-nature. Accessed on 2021-
07-01.
Kreminski, M.; Dickinson, M.; Osborn, J.; Summerville,
A.; Mateas, M.; and Wardrip-Fruin, N. 2020. Germinate: a
mixed-initiative casual creator for rhetorical games. In Pro-
ceedings of the AAAI Conference on Artificial Intelligence
and Interactive Digital Entertainment, volume 16, 102–108.