BorisTheBrave / DeBroglie

DeBroglie is a C# library implementing the Wave Function Collapse algorithm with support for additional non-local constraints, and other useful features.
https://boristhebrave.github.io/DeBroglie/
MIT License
467 stars 37 forks source link

Can't use the NearbyTracker #11

Open bsambrone opened 4 years ago

bsambrone commented 4 years ago

I tried copy/pasting the private class NearbyTracker from the SeparationConstraint, but I realize it's referencing a boatload of internal classes. Any particular reason why this class isn't public?

What I'm trying to do is create a custom constraint so that tiles of type X cannot be within Y tiles of type Z.

BorisTheBrave commented 4 years ago

The entire tracker framework is internal as I couldn't find a nice way of making it public without exposing too many internals. It's just an optimization, so it doesn't really prevent custom constraints.

The NearbyTracker one specifically I hadn't considered to be reusable. I've had to tweak it several times to get the separation constraint right, so I'm not that confident in what I've got. It's got some quirks specific to the use case it was designed for.

That same struggle is why the constraint you described isn't part of DeBroglie already.