Balancing Games with Simulations

wicked21

Presenter Notes

Accelerating Board Game Design with Simulations

The Wicked 21st Case Study

Pablo Duboue, PhD

FaMAF -- Análisis y Procesamiento de Grandes Redes Sociales y Semánticas

Presenter Notes

Context

Grant ecampus ontario cc-by-sa centenial college huron college Companion board game for ''Futures Thinking'' course

Presenter Notes

Presenter Notes

Game Design and Pablo

  • Been sporadically GM'ing Call-of-Cthuluh RPG for 20+ years
  • Learned game design at Columbia University
    • Took the course Video Games technolog & design, taught by David Sturman and Bernard Yee.
    • I liked it so much that I actually TA'd the next semester.
    • This was one of my assignments if curious: http://duboue.net/blog23.html
      • Formal Abstract Design Tools of a MMORPG
    • Our course project was a board game.
      • See a pattern?
  • Recently published some gamebooks

Presenter Notes

What is futures thinking?

Futures thinking is a creative and exploratory process that uses divergent thinking, seeking many possible answers and acknowledging uncertainty. It's a different mind-set to analytical thinking which uses convergent thinking to seek the right answer and reduce uncertainty.

https://dpmc.govt.nz/our-programmes/policy-project/policy-methods-toolbox/futures-thinking

Presenter Notes

What is systems thinking?

Systems thinking is a holistic approach to analysis that focuses on the way that a system's constituent parts interrelate and how systems work over time and within the context of larger systems.

https://www.techtarget.com/searchcio/definition/systems-thinking

Presenter Notes

Growth and Underinvestment

Example system from The Fifth Discipline, a group problem solving book by Peter Senge (1990).

system

Presenter Notes

The Graph

  • 30 nodes
  • 95 edges

full graph

Presenter Notes

The Graph (zoomed)

segment

Presenter Notes

The Graph (abstract)

abstract

Presenter Notes

The Graph (subsystem)

social

Presenter Notes

Game rules in detail

Three phases:

  1. Engage: Gathering Resources (cards and money tokens)
    • Silent
  2. Activate: Attempting Projects and Funding Technologies
    • Silent
  3. Reflect: Strategize with other Players and end the turn

Presenter Notes

Parallel blind consensus driven cooperative gameplay

  • Avoid "backseat playing" in cooperative games
  • Model real life: good people want to do good things but they sync from time to time and go off to do their own thing
    • Reduplicated efforts and starvation of projects is a real issue
  • You might have consensus but that is not the same of centralized execution

Presenter Notes

Game Designers

  • Robert Ogilvie
  • Donovan Thibodeau
  • Jeff Wheeldon
  • Pablo Duboue

Presenter Notes

Set up

  • 2 decks of standard playing cards (54 cards per deck)
  • 2 standard six-sided dice (2d6)
  • Printed player mats, game boards, markers, and tokens

Presenter Notes

Game subsystems

  • Crisis
  • Projects
  • Tech

Presenter Notes

Crisis subsystem

  • Pick a category (1D6)
  • Pick a node in the category (1D6)
  • Roll a crisis check (main parameter of the game, currently 8)
    • Roll failed? Node is now in crisis
    • Was the node in crisis already? crisis cascades
  • This is done for as many crisis chips all the players accumulated during the turn
    • Starting from a base number per turn (another parameter, currently 4)

Presenter Notes

Crisis cascading

  • Investigated many variants
    • Full cascade (too aggressive)
    • Random single cascade (too time consuming)
  • Current solution requires pre-computed tables:
    • Once a node is doubly hit, all its immediately accessable nodes are set in crisis
    • If all those nodes were already in crisis ("saturated" node), then pre-computed random tables indicate which node to cascade after
    • Idea of "slowly leaking stress to the rest of the network"

Presenter Notes

Projects

Two types of projects (down from an initial of four types): 1. First tier: takes two cards, fixes a node but adds a crisis chips (emergency repairs) 2. Second tier: takes four cards, fixes a node with no drawbacks

The cards required depend on the type of node. It can be initiated by only one player but once initiated all players can contribute.

One project slot per player.

Presenter Notes

Attempting projects

To successfully deploy a project, the skills noted need to be fulfilled.

Fulfilling a skill equals rolling 2D6 against the number in the card set forth to attempt the project.

Jokers are automatic success, face cards (J, K,Q,A) count as 10.

Rolling 12 is an automatic failure and adds to the Crisis Counter.

Money can be added to increase the value of a card (up to 11). Basic tech (discussed next) provides a +1 boost, too.

Presenter Notes

Tech

Two types of tech (down from an initial of 3):

  1. Basic (one per card suit): adds a +1 consultant fee to the suit
  2. Advanced (one per node in the graph): adds Protection to a node - Requires two basic techs for the suits underlining the category already researched

Researching a Tech needs one card of a suit plus one money (both) in a turn. A tech is fully researched in two turns.

Card and money can be contributed by different players.

My design contribution

Presenter Notes

Policies (dropped)

The initial design had the concept of "clout" and pushing for policy changes.

It made the game quadratically more complex but it didn't add to the teaching nor gameplay.

Took months to drop.

Presenter Notes

Design process

  • Weekly meetings
  • Designers playtesting
  • Simulations
  • General playtesting

Presenter Notes

Simulating the game

  • Coded the whole game in a defensive way
    • 97 commits in 5 months.
    • 35 files
    • ~7k lines of Python
  • Continuous evolution as the game design progresses
  • Literate programming
    • Special comments produce a Walkthrough
    • 3,000 words total

Presenter Notes

My initial plan

  1. Random players
  2. Rule-based AI, isolated
  3. Rule-based AI, communicating
  4. Reinforcement learning

Presenter Notes

Random players

  • To work with OpenAI Gym (RL), the code informs the player at all time what are the choices they can make
  • A random player is thus straightforward

In Python

 1 def pick(
 2     self,
 3     decision: int,
 4     decisions: list,
 5     rand: random.Random,
 6     state: object = None, # PlayerState
 7     game: object = None,  # GameState
 8     context: dict = None,
 9 ):
10     """Choose a decision among many"""
11     return rand.choice(decisions)

Presenter Notes

Basic reports

playerscrisis <rising=runswonPercErrors
47 3 1000 982 98.2%1
57 3 1000 986 98.6% 1
673100098598.5%3
374100082782.7%0
474100081381.3%0
574100081581.5%0
674100083983.9%5
375100043043.0%0
475100046146.1%1
575100048648.6%2
675100047547.5%5

Presenter Notes

Advanced reports

simulation report

Presenter Notes

Advanced reports (Zoom)

in crisis

Presenter Notes

Rule-based AI

  • A simple AI:
    1. At creation time, order all the 30 nodes randomly
    2. Top nodes are "priority". Bottom nodes are "don't care"
    3. Each AI player has different ordering
    4. When time to fix things come, get cards to fix high priority nodes in crisis.
  • "Simple" but still 650 lines of spaghetti code...
    • ...with 97 ifs!

Presenter Notes

Problem with rule-based AI

  • It performed worse than the random players.
  • It triggered the construction of the advanced reports.
  • Very, very difficult to debug this kind of thing.
  • Initially, the AI will drop projects for less important nodes if an important node was in crisis
    • The advanced reports showed that was wasting too many resources
  • Fixed that, it still underperfomed.
  • How to find which decision was wrong in the code?

Presenter Notes

MCTS: MonteCarlo Tree Search

  • Explore a tree of alternatives by balancing explorationg vs. exploitation
    • In a given node, search randomly sampling by the payoffs already observed
  • However, the parallel blind aspect makes it difficult to code
  • Instead, I wrote a simplified run where I just turn off the AI for different decisions

Presenter Notes

Simulating decisions

One AI plus two random.

TypeWonRunsPerc
3 RANDOM 6,363 9,99963.64%
Initial role6,311 10,00063.11%
Pile to draw from 6,316 10,00063.16%
Project type to start 6,353 10,00063.53%
New project, fix category 6,362 10,00063.62%
New project, fix problem 6,315 10,00063.15%
Play a card 6,313 10,000 63.13%
Add consultant fees 6,314 10,000 63.14%
Tech to start researching 6,314 10,000 63.14%
Card for research 6,316 10,000 63.16%
Fund research 6,315 10,000 63.15%
FULL 6,476 10,000 64.76%
Three AIs 6,088 10,000 60.88%

Presenter Notes

The code

  • The game code just released on GH: https://github.com/Textualization/Wicked21st/
    • This code can help teaching AI in games
    • The game state is separated from the game engine itself
    • All actions are listed and known
    • The players receive a list of actions to choose from at every step
    • Easy to backtrack or try different approaches
    • OpenAI Gym might come soon (patches welcomed!)

Presenter Notes

Playing the game

spanish-qr

Presenter Notes

Creative writing

winking skull

Presenter Notes

Presenter Notes