Git Product home page Git Product logo

Comments (4)

mxgmn avatar mxgmn commented on April 28, 2024 1

Hi! To constrain the output, you need to:

  1. Ban all unwanted options.
  2. Call Propagate() to propagate the bans.

For an example, see how I constrain ground pixels here.

from wavefunctioncollapse.

SKFrozenCloud avatar SKFrozenCloud commented on April 28, 2024

Could you just explain the snippet of code you linked so that I can write my own?

from wavefunctioncollapse.

mxgmn avatar mxgmn commented on April 28, 2024

Sure!

if (ground)
{
    for (int x = 0; x < MX; x++)
    {
        for (int t = 0; t < T - 1; t++) Ban(x + (MY - 1) * MX, t);
        for (int y = 0; y < MY - 1; y++) Ban(x + y * MX, T - 1);
    }
    Propagate();
}

This code executes in examples where we need to fix the ground level. That is, in examples like Skyline, Flowers and Platformer, where we see the picture from the side and not from the top. If we omit this code, the ground level could appear anywhere in the output (like in the middle of an image), or there could even be multiple ground levels. Try changing to ground="False" in samples.xml and see what happens.

Ground pattern is the last pattern in the input, so its index equals T-1.

  1. In the first interior for in the code, we ban all non-ground (that is, t != T-1) patterns from the ground level.
  2. In the second for, we ban the ground pattern from non-ground (that is, y != MY-1) levels.

And then we propagate the bans.

In your example, to generate islands, you need to ban all non-water patterns from the border of the image, and then propagate.

I guess I'll reopen the issue because this is a common question.

from wavefunctioncollapse.

SKFrozenCloud avatar SKFrozenCloud commented on April 28, 2024

Thanks, now I understand.

from wavefunctioncollapse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.