Log In  


Cart #nizosuzohi-0 | 2025-01-28 | Code ▽ | Embed ▽ | No License
3

I've been trying to implement texture based wave function collapse in pico 8 for quiet some time now and this version is the one i like the most so far, even though it's obviously not working right.
By now my brain hurts already, so i thought maybe some of you could help me figure out what's wrong with it or maybe give me some clues on how else i can implement the algorithm.

What is going on:

  • random pixel is placed on the screen (chosen from all possible pixels from 8x8 sprite)

  • algorithm gets an array from the screen around the placed pixel and gets an array of all possible pixels adjacent to already placed pixel from the input texture.

  • then it overlaps the screen array with a texture array and if they match it adds all the values to a new array, which will be our entropy for all adjacent sides.

  • this entropy is being compared with already existing entropy values around the placed pixel and only the matched ones are being kept.

  • then it looks for the candidate with the lowest entropy and picks one at random and places a random pixel from the list.

  • everything repeats until there's no candidates left

I really hope this code description is clear enough. I'll anyway try to explain it better if necessary.

3



[Please log in to post a comment]