Table of Contents
Fetching ...

You-Only-Randomize-Once: Shaping Statistical Properties in Constraint-based PCG

Jediah Katz, Bahar Bateni, Adam M. Smith

TL;DR

YORO pre-rolling is introduced, a method for crafting a decision variable ordering for a constraint solver that encodes desired statistics in a constraint-based generator that effectively controls the statistics of tile-grid outputs generated by several off-the-shelf SAT solvers, while still enforcing global constraints on the outputs.

Abstract

In procedural content generation, modeling the generation task as a constraint satisfaction problem lets us define local and global constraints on the generated output. However, a generator's perceived quality often involves statistics rather than just hard constraints. For example, we may desire that generated outputs use design elements with a similar distribution to that of reference designs. However, such statistical properties cannot be expressed directly as a hard constraint on the generation of any one output. In contrast, methods which do not use a general-purpose constraint solver, such as Gumin's implementation of the WaveFunctionCollapse (WFC) algorithm, can control output statistics but have limited constraint propagation ability and cannot express non-local constraints. In this paper, we introduce You-Only-Randomize-Once (YORO) pre-rolling, a method for crafting a decision variable ordering for a constraint solver that encodes desired statistics in a constraint-based generator. Using a solver-based WFC as an example, we show that this technique effectively controls the statistics of tile-grid outputs generated by several off-the-shelf SAT solvers, while still enforcing global constraints on the outputs.1 Our approach is immediately applicable to WFC-like generation problems and it offers a conceptual starting point for controlling the design element statistics in other constraint-based generators.

You-Only-Randomize-Once: Shaping Statistical Properties in Constraint-based PCG

TL;DR

YORO pre-rolling is introduced, a method for crafting a decision variable ordering for a constraint solver that encodes desired statistics in a constraint-based generator that effectively controls the statistics of tile-grid outputs generated by several off-the-shelf SAT solvers, while still enforcing global constraints on the outputs.

Abstract

In procedural content generation, modeling the generation task as a constraint satisfaction problem lets us define local and global constraints on the generated output. However, a generator's perceived quality often involves statistics rather than just hard constraints. For example, we may desire that generated outputs use design elements with a similar distribution to that of reference designs. However, such statistical properties cannot be expressed directly as a hard constraint on the generation of any one output. In contrast, methods which do not use a general-purpose constraint solver, such as Gumin's implementation of the WaveFunctionCollapse (WFC) algorithm, can control output statistics but have limited constraint propagation ability and cannot express non-local constraints. In this paper, we introduce You-Only-Randomize-Once (YORO) pre-rolling, a method for crafting a decision variable ordering for a constraint solver that encodes desired statistics in a constraint-based generator. Using a solver-based WFC as an example, we show that this technique effectively controls the statistics of tile-grid outputs generated by several off-the-shelf SAT solvers, while still enforcing global constraints on the outputs.1 Our approach is immediately applicable to WFC-like generation problems and it offers a conceptual starting point for controlling the design element statistics in other constraint-based generators.
Paper Structure (15 sections, 4 equations, 6 figures)

This paper contains 15 sections, 4 equations, 6 figures.

Figures (6)

  • Figure 1: In the traditional constraint solving approach to procedural content generation, it is assumed that all relevant design concerns can be represented as constraints that must be satisfied by each output design in isolation. In other words, the solver’s job is to produce outputs that are guaranteed to be free from easily detectable flaws. This approach cannot capture population-level design considerations such as that design elements should be used with some typical frequency across the space of outputs even though the allowed frequency of those design elements is largely unrestricted within a single output. Our technique, YORO, transforms a constraint program so that the first solution output by the solver after each randomization is more likely to represent the target statistics.
  • Figure 2: YORO applied to a toy $4 \times 4$ grid generation task where black (dark) tiles are expected to be seen more often than white (light) tiles. Left: The input design establishes the vocabulary of allowed tiles, allowed tile adjacencies in different directions, and the target distribution for using each tile in new designs. Middle: Drawing from the target distribution at each cell, we come up with a fixed ordering of the tiles within each cell. In this sampled ordering, white will be explored first in 5 out of 16 cells (note that white was observed to be used 4 out of 16 cells in the input grid). Right: Four steps of constraint solving search in which the next available un-assigned variable is chosen and the implications of that choice are propagated out to nearby cells. After these first four steps, white tiles will have been placed in just 1 out of 4 of the top-row cells, matching the target distribution from the input image.
  • Figure 3: Exploring variable orderings for a $20 \times 20$ toy example where any tile can be placed next to any tile, but black tiles should be much more common than light tiles. Trivial: Without manipulating the variable ordering, the solver produces a valid-but-undesirable image composed of only black tiles. Uniform: By manipulating the variable ordering, we can inject diversity into the solver's outputs, but the statistics are far from the target. Tile-frequency: Applying the right kind of randomization to the variable ordering, we get outputs where close adherence to the target statistics is obvious from even a single output sample.
  • Figure 4: Exploring variable orderings in the Mario domain. Compare with Figure \ref{['fig:black-and-white-outputs']}. In this example, we are not yet modeling neighborhood-level statistics or attempting to enforce any interesting global constraints. Nevertheless, the YORO technique is able to immediately improve upon the results that would be seen without any decision variable ordering manipulation.
  • Figure 5: Exploring variable orderings for the Zelda domain. Here, we approximate Bateni's context-sensitive WFC method context-sensitive by sampling design choices at the level of whole neighborhoods. Further, we enforce an example global constraint: there must be a beige dirt-tile path (marked in pink) from the top-left to the bottom-right that only moves in downward or rightward steps.
  • ...and 1 more figures