Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: is it possible to use it passing fixed tiles? #31

Open
Nazariglez opened this issue May 6, 2023 · 1 comment
Open

Question: is it possible to use it passing fixed tiles? #31

Nazariglez opened this issue May 6, 2023 · 1 comment

Comments

@Nazariglez
Copy link

Hello! I was about to implement my own wfc and found this, I have being playing with it and it's great!

I have a case of use where I need to create a map, but this map have fixed tiles in it, let's say that the tile in (0,0) must be type 1, (1,4) is type 2 and then the rest of tiles must be randomly generated using wfc

Does this crate cover that case? Can you point me in the right direction on how to do this?

Thanks

@LunaticWyrm467
Copy link

LunaticWyrm467 commented Nov 14, 2023

I've figured out how to do it when the pattern size is 1x1, but I'm having a bit of trouble figuring out how to work it with larger pattern sizes.
Anyways, @Nazariglez you'll want to use the following impl:

use wfc::ForbidPattern;

// TileConstrainer is a custom made struct, name it whatever you like and put whatever fields you need in it.
impl ForbidPattern for TileConstrainer {
    fn forbid<W: Wrap, R: rand::Rng>(&mut self, fi: &mut ForbidInterface<W>, rng: &mut R) {
        let output_size: Size = fi.wave_size();
        // Use 'fi' for your purposes...
    }
}

As I mentioned before though, I don't know how to work it with larger pattern sizes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants