Jibble

Author Topic: [PLUGIN] agsfastwfc 0.1.0  (Read 1065 times)

eri0o

[PLUGIN] agsfastwfc 0.1.0
« on: 18 Aug 2019, 03:13 »
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: Adventure Game Studio
  1. bool AgsFastWFC.Overlapping(
  2.                   int destination, int sprite,
  3.                   int seed,
  4.                   bool periodic_input, bool periodic_output,
  5.                   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.
« Last Edit: 27 Aug 2019, 18:06 by eri0o »

Kweepa

  • Mutated Guano Deviser
    • Best Innovation Award Winner 2009, for his modules and plugins
    • Kweepa worked on one or more games that won an AGS Award!
    •  
    • Kweepa worked on one or more games that was nominated for an AGS Award!
 ??? :exploding brain emoji:
Still waiting for Purity of the Surf II

Matti

Interesting! I had fun trying out the demo  :)

selmiak

  • ǝsıɔɹǝxǝ ʞɔǝu puɐ uıɐɹq
    • I can help with play testing
    • I can help with proof reading
    • I can help with translating
    • I can help with web design
    • selmiak worked on one or more games that won an AGS Award!
    •  
    • selmiak worked on one or more games that was nominated for an AGS Award!
eri0o got hacked by the AI and is forced to do this now... 8-0

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

  • Analysis Paralysis
    • Retro Wolf worked on one or more games that was nominated for an AGS Award!
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

  • Local Moderator
  • Rottwheelers
  • Pretty Badass
    • Dualnames worked on one or more games that won an AGS Award!
    •  
    • Dualnames worked on one or more games that was nominated for an AGS Award!
Re: [PLUGIN] agsfastwfc 0.1.0
« Reply #7 on: 04 Sep 2019, 14:17 »
I'm not sure what this does, it seems to be creating a pattern?
No more military army stuff. I'm alive and back.

eri0o

Re: [PLUGIN] agsfastwfc 0.1.0
« Reply #8 on: 04 Sep 2019, 14:45 »
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.