Constraints
Constraints are a way to make additional hard requirements about the generated output. Unlike models, constraints can be non-local, meaning they force some property of the entire output, not just within a small rectangles.
You can have as many constraints as you like during generation, however with multiple constraints it can be hard for the WFC to find a valid solution. Turning on backtracking can aleviate this.
Each constraint is for enforcing a different effect. The available constraints are discussed below.
Border
BorderConstraint class restricts what tiles can be selected in various regions of the output. It's pretty common that you want to specify the borders as being ground, or empty, or whatever, as otherwise if DeBroglie will often generate structures that lead off the edge and are clipped.
Note
BorderConstraint only affects the initial set of tiles that can be legally placed. That means it is not doing anything except calling Ban and Select on startup, which you can also do manually. BorderConstraint is just a convenience.
BorderConstraing specifies a set of cells using a simple logic. First, an inclusion set of cells is defined by the Sides field. This field is a bit field of flags, where there is one flag for each of the boundary sides of the output area (4 in 2d, 6 in 3d). An exclusion set is defined similarly from the ExcludeSides field. To get the set of locations affected, subtract the exclusion set from the inclusion set, then optionally invert if InvertArea is set.
For each affected location, BorderConstratin calls Select with the Tile specified. If the Ban field is set, then it calls Ban instead of Select.
Example



Path Constraints
Path constraints are a collection of related constraints described on a separate page.
Fixed Tile
The FixedTileConstraint class forces a given location to be the specified Tile at initialization. If you don't specify a location, a random legal location is chosen.
You can use FixedTileConstraint to force certain features to always be generated.
Example
Max Consecutive
The MaxConsecutiveConstraint class prevents more than a certain number of tiles appearing consecutively along the x, y or z axis.
MaxCount | |
2 |
![]() |
3 |
![]() |
10 |
![]() |
Mirror
The MirrorXConstraint and MirrorYConstraint class forces the generated output to be symetric about the x-axis / y-axis.
Example

Symmetry
The SymmetryConstraint constraint is a abstract generalized version of the mirror constraint. It can be used for more complicated symmetries of the generated output.
Count
The CountConstraint class forces the number of a given tile or set of tiles to be at most or at least a given number.
Separation
The SeparationConstraint class forces particular tiles to not be placed near each other.
It's useful for giving a more even distribution of tiles, similar to a Poisson disk sampling.
Pair Separation
The PairSeparationConstraint class forces one set of tiles to not be placed near another set.
Custom Constraints
You can define your own constraints by extending ITileConstraint. The Init method is called once per propagator run, and the Check method is called after each step, each time tiles are selected.
Inside these methods, you can call Select and Ban to control what tiles can be legally placed. You can also call SetContradiction() to indicate that something is wrong and generation cannot continue. This will cause the propagator to give up, or backtrack, according to settings.