Answer Set Programmingfor Procedural Content Generation
Innovation and Professional Development Project Pitch
by Andrea Tucci @andreatux
Outline➔ Procedural Content Generation➔ Answer Set Programming
◆ the HEX programs➔ Goals
Procedural Content Generation➔ Procedural Content Generation (PCG) is an “algorithmical creation of game
content with limited or indirect user input”[1]◆ levels, maps, music, quests, story …
➔ Software that, given some “rules”, is able to create new game elements
➔ Offers new ways of playing the game; new player experiences
[1] J.Togelius, E.Kastbjerg, D.Schedl, G. N. Yannakakis: What is Procedural Content Generation?Mario on the borderline (2011)
Procedural Content Generation ➔ Why?
◆ new content◆ efficency◆ no designers…
● ...really? I like to think of PCG as a “tool” for designers ◆ automated procedure◆ great for small teams◆ experiments◆ player-based content (data mining)
Procedural Content Generation ➔ Examples
Procedural Content Generation ➔ Planet Generator:
http://experilous.com/1/planet-generator/2014-09-28/version-1
Answer Set Programming➔ Declarative problem solving approach
◆ roots in logic programming
➔ Write the description of the problem rather than how to solve it◆ set of rules◆ a rule can that is evaluated to be true, will fire
➔ Solution(s) to the problem, if exists, will be represented as sets of answer
Answer Set ProgrammingClassic example: Sudoku
➔ Encode a cell with the predicate cell(X,Y,N)◆ X,Y are the coordinates of the cell◆ N is the number contained
Answer Set Programming➔ Make a “guess” of what number can be in a cell
◆ cell(X,Y,1) v cell(X,Y,2) v cell (X,Y,3) v … v cell(X,Y,9) :- row(X), column(Y)
➔ Discard unwanted combinations◆ Do not put the same number, given a row
● :- cell(X,Y,N), cell (X,Y1,N), Y1!=Y◆ Do not put the same number, given a column
● :- cell(X,Y,N), cell(X1,Y,N), X!=X1◆ Do not put the same number in a block
● :- cell(X,Y,N), cell(X1,Y1,N), sameBlock(X,Y,X1,Y1)
➔ Answer in this form: {cell(0,0,3), cell(0,1,8) … }
The Hex Programs➔ Support external knowledge
◆ it is possible to make reasoning outside the logic program
➔ Call a c++ function◆ &firstbelow[P,objs](O)
● in AngryHex, ASP-based Angry Birds bot, returns the object O which is directly below P, given the objects objs
➔ ACTHEX extension◆ rules that, when fired, call an external action that is able to change the
environment
Goals and Objectives➔ Research on Procedural Content Generation algorithms and techniques
◆ focusing on map/planet generation
➔ Research on Answer Set Programming application on PCG◆ how can ASP be applied to PCG? ◆ how HEX and ACTHEX extension can be useful for this goal?
➔ Use ASP to procedurally generate game maps◆ decouple logic from actions◆ represent levels in structured files
➔ Map Visualization
➔ Experiments◆ directly create levels when rules fire◆ real-time content generation(?)
Goals - rough idea
Readings and References.. so far● J.Togelius, E.Kastbjerg, D.Schedl, G. N. Yannakakis: What is Procedural Content Generation?
Mario on the borderline (2011)
● Shaker, Noor and Togelius, Julian and Nelson, Mark J. : Procedural Content Generation in Games: A Textbook and an Overview of Current Research
● Procedural Content Generation Wiki: http://pcg.wikidot.com/
● T.Eiter,G.Ianni and T.Krennwallner: Answer Set Programming: A Primer
● F.Calimeri, M. Fink, S. Germano, A. Humenberger, G. Ianni, C. Redl, D. Stepanova, A. Tucci : AngryHEX: an Artificial Player for Angry Birds Based on Declarative Knowledge Bases
Games ReferenceFrom the top left pic, from left to right:
● Elite, Acornsoft 1984● Rescue on Fractalus, Activision 1984● Minecraft, Mojang 2009● Diablo 2, Blizzard 2000● The Binding of Isaac, E.McMillen, F. Himsl 2011● No Men’s Sky, Hello Games 2015 (expected)
I
Questions?