[PLUGIN] agsfastwfc 0.1.0

Started by eri0o, Sun 18/08/2019 03:13:47

Previous topic - Next topic

eri0o

I recently built a very experimental plugin to test some ideas, the AGS Fast Wave Function Collapse Plugin.

First some images to help explain the possibilities.





The plugin right now has only a simple interface like this:

Code: ags
bool AgsFastWFC.Overlapping(
                  int destination, int sprite,
                  int seed,
                  bool periodic_input, bool periodic_output,
                  int N=3, int ground=0)



  • int destination The Graphic property of a Dynamic Sprite you have created to draw the result.
  • int sprite The source sprite you want to feed FastWFC Overlapping algorithm.
  • int seed An integer number, will provide the randomness of the output.
  • bool periodic_input Should be true if the input is periodic.
  • bool periodic_output Should be true if the desired output is periodic.
  • int N A NxN pattern of pixels in the output should occur at least once in the input. Default is 3x3 pixels.
  • int ground Default is 0.

The algorithm can in some cases fail, depending on the configurations, this is why it returns either a true, for success, or false, for failure.

A GitHub Repository is up to share the code and I added more information there too. You can also download the code as a zip. If you want to try the demo game, you can also download it for windows or linux (64-bit only).

I did only the ags parts and picked the interesting algorithm from a very interesting implementation I found online, which is better explained in the GitHub repo. It's reasonably fast as you can notice when interacting with the demo.

Kweepa

Still waiting for Purity of the Surf II

Matti


selmiak


eri0o

Thank you guys for trying it out!

I need to figure out how to pass tilesets, thinking on creating a managed struct to describe each tile and pass an array of tiles but I don't know yet how to read this on the plugin side.

Below a gif of it working from the algorithm original GitHub page. But the implementation used here is not the original.


Retro Wolf

Not going to even try to understand how this works, but this stuff is right up my alley!

eri0o

I think it picks a tile of NxN size from the input image and places somewhere on the output image, and then it picks a tile of NxN size from the input image and places it on the output image with one of the borders of the tile being the same pixels (fitting, like with jigsaw pieces), and do this step a ton of times until the image is filled. But the algorithm appears to be optimized to do this blazingly fast (I think you can even hit it on each ags FRAME!) and also I haven't yet got bad outputs (like full black screen for the house example above)

Dualnames

I'm not sure what this does, it seems to be creating a pattern?
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

eri0o

You input a pattern (left) and set the rough size of a square tile, it will then replicate the pattern by matching pixels, overlapping the tiles. I could also support a non-overlapping tile generation - think like old Zelda games. There are more details on the original algorithm page, the difference is the implementation in use here is fast. The animated gif is a visualization, it actually happens in 2ms or less.

SMF spam blocked by CleanTalk