Core implementation of the Wave Function Collapse algorithm by mxgmn as a module in Lua. the aim of this module is to only implement the core algorithm without the parsing of a file as an input making this perfect for a project that only needs the bitmap data to do stuff.
Warning
some cases are untested, as I dont need them for my current use case.
- Clone the repo.
$ git clone https://github.com/quebn/wfc-core-lua.git- Use the module
local wfc_core = require("wfc-core-lua")
-- bitmap is structured as { [integer]:integer, width:integer, height:integer } see `init.lua` for the luadoc structure definition.
local foo = wfc_core.overlapping(bitmap, {
name = "Foo",
N = 3,
ground = true,
periodic = true,
symmetry = 2,
})
-- generate function ouputs a list of bitmap, returns list with 1 item if no screenshot value is provided in generate function
local outputs = foo:generate()
-- do whatever with the generated outputssee examples.lua for more usage examples
Wave Function Collapse algorithm. The original Implementaion written in C#, serves as inspiration for this implementation.
NWFC - Wave Function Collapse but LÖVE . another implementation in lua for LÖVE2D development.
MIT License