Writing software typically means telling the computer exactly what steps to take - and then when we change our minds (as we often do in game development), rewriting those steps, over and over again. But what if we didn't have to? What if we could tell the computer what end result we want, and have it figure out the rest?
Declarative programming is a family of classic AI techniques for doing just that. Declarative programs specify what a solution to the problem would look like, rather than how to find one, and this description is then fed to a very general algorithm (a “solver”) that can solve a wide range of problems given their descriptions. Constraint programming, logic programming, and automated planning are all examples of declarative programming.
Declarative programming is not widely known, but it has been used in a large number of shipped games:
Procedural content generation: City of Gangsters (SomaSim 2021), Mask of the Rose (Failbetter 2023), Townscaper (Stålberg 2021), Bad North (Raw Fury, 2018) and Caves of Qud (Freehold Games 2015) all use it in-engine for PCG.
Build pipelines: The Last of Us (Naughty Dog, 2013) and Project Highrise (SomaSim 2016) use it in their build pipelines.
NPC behavior: since the release of F.E.A.R. (Monolith Productions 2005), AAA action games including Tomb Raider (Crystal Dynamics 2013) and Middle-Earth: Shadow of Mordor (Monolith Productions 2014) often use automated planning for NPC control.
Interactive fiction: Inform 7 (Nelson 2006), the dominant programming language for IF, is heavily declarative.
This summer, the Chicago Game Lab will host a series of short talks by Ian Horswill on how declarative programming works, and the practical aspects of using it in your game.
The talks will start with introductions to the various techniques, and cover off-the-shelf tools for Unity (no programming background required). Later on, we can go into the technical details on how to implement your own systems. The first few sessions will be as proposed below, and then further ones will be developed based on interests of participants.
Ian Horswill is an AI researcher and Charles Deering McCormick Professor of Teaching Excellence at Northwestern University. He develops game AI tools and techniques for developers and researchers alike. His recent work includes TED, a logic programming language for large scale simulation, and Step, a highly expressive text generation language.
Talks will be held at the Chicago Game Lab as well as streamed live.
Each talk is 30 minutes + Q&A
Introduction to constraint solvers, a classic tool for PCG.
We will discuss how various games use constraint solvers (for example: wave function collapse) and their characteristics. Demo: Imaginarium.
Wednesday July 10th, 2024, 6pm CDT
Register here ➡️ https://www.eventcreate.com/e/summer-talk-series
Introduction to grammar systems, another classic tool for PCG.
We will discuss how grammars produce structured content, and how to enhance them with constraints. Demo: Step system.
Wednesday July 24th, 2024, 6pm CDT
(Registration coming soon)
Future talk ideas (based on participants feedback):
Logic programming and social simulation
Deep dive into text generation
Build your own constraint satisfaction system
Build your own search system
Want to be the among the first to hear about Lab Open Work Days?
Interested in knowing about other events at the Chicago Game Lab?
Want to be the first to find out when a desk spot becomes available?