Namespace DeBroglie.Constraints
Classes
AcyclicConstraint
Enforces that there are no loops at all
BorderConstraint
BorderConstraint class restricts what tiles can be selected in various regions of the output.
For each affected location, BorderConstratin calls Select with the Tile specified.If the Ban field is set, then it calls Ban instead of Select.
ConnectedConstraint
A constraint that ensures that all the relevant cells can traces a path between them. Commonly the relevancy definition matches the path one, so this effectively forces a single connected component.
CountConstraint
Enforces that the global count of tiles within a given set must be at most/least/equal to a given count
EdgedPathSpec
Configures pathing where a given set of tiles form the path, and connect adjacently if both have appropriate "exits".
FixedTileConstraint
LoopConstraint
Enforces that the entire path is made out of loops, i.e. there are at least two routes between any two connected points.
MaxConsecutiveConstraint
The MaxConsecutiveConstraint checks that no more than the specified amount of tiles can be placed in a row along the given axes.
MirrorXConstraint
Maintain
MirrorYConstraint
PairSeparationConstraint
This constraint forces one set of tiles to not be placed near another set.
ParityConstraint
This constraint doesn't actually constrain anything, it improves the quality for the search. It only works for tilesets that entirely, or predominantly, have even numbers of exits (i.e. straights, corners, crossroads, but not forks or deadends). These sorts of tilesets can be challenging for WFC without the additional guidance this constraint supplies.
The parity of any set of tiles is defined as the even/oddness of the sum over those tiles of path exits. Let's assume that path exits are symmetric - x has an exit to adjacent tile y if y has an exit to x. Then the parity of a connected region of cells is often computable even before all the tiles are selected. The parity constraint uses this to lookahead and determine what tiles must be placed.
This constraint is experimental.
PathConstraintUtils
Contains utilities relating to ConnectedConstraint
PathConstraintUtils.AtrticulationPointsInfo
PathConstraintUtils.SimpleGraph
PathSpec
Configures pathing where a given set of tiles form the path, and always connect if adjacent to each other.
PathViewExtensions
SeparationConstraint
This constriant 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.
SymmetryConstraint
Abstract constraint for any sort of global symmetry where a choice of a tile in an index implies a selection for a specific index elsewhere.
Interfaces
IPathSpec
Factory for an IPathView
IPathView
A view of the underlying TilePropagator used for various path constraints, such as ConnectedConstraint.
This is best understood as exposing two array of bool variables, called "path" and "relevant". These are variables in the constraint solver sense - that is, we track if they could be true/false, and those evolve over time. The path variable at a given index is possibly true if CouldBePath is true, and it's possibly false if MustBePath is false. IPathView is responsible for propagating those variables back to the source of truth, the TilePropagator.:
- Calling update propagates from TilePropagator to {Could/Must}Be{Path/Relevant}.
- Calling {Select/Ban}{Path/Relevant} propagates back.
The path constraint is thus free to work entirely on the path and relevant variables, and doesn't use TilePropagator at all. The mapping between these two variables and the TilePropagator can cause a variety of effects.
The arrays of path and relevant don't need to match the topology of the TilePropagator at all, they use the Graph variable for their topology.
The interpretation of path and relevant varies between the different path constraints, but generally the path=t
ITileConstraint
Interface for specifying non-local constraints to be respected during generation.
Enums
BorderSides
Used by BorderConstraint to indicate what area affected.