
Procedural Worlds from Simple Tiles (2017) - jsnell
http://ijdykeman.github.io/ml/2017/10/12/wang-tile-procedural-generation.html
======
fenomas
Really interesting, but I think anyone interested in this would do well to
check out [0]. It takes the article's second algorithm somewhat further,
considering all the output tiles to start out as uncollapsed wave functions,
and then going through and trying to collapse them in such a way as to obey
local constraints (matching at their borders) and large-scale constraints
(having each tile occur in the output at a frequency similar to some frequency
defined by the inputs).

Also on the notational side, [0]'s approach of using a plain graphic as an
input, and inferring the desired tiles and tile frequencies from it, is maybe
more approachable than that of TFA. (Though in either case, if you hack on it
I suspect you'll eventually wind up doing something ad-hoc..)

[https://github.com/mxgmn/WaveFunctionCollapse](https://github.com/mxgmn/WaveFunctionCollapse)

~~~
MattRix
The other fun thing with WFC is that you can wrap the constraints on the edges
(ex. matching the right edge of the rightmost tiles to the left edge of the
leftmost tiles), which allows you to easily make tiling patterns.

You can also start matching tiles and edges for more than just colours... for
example, you can have 3-dimensional tiles, or you can even match edges of
tiles using time as a dimension, like I did here:
[https://twitter.com/MattRix/status/979020989181890560](https://twitter.com/MattRix/status/979020989181890560)

~~~
fenomas
That's awesome! Is the code open somewhere?

------
slx26
The best part is probably that this system is so simple that it allows for
many extensions, customizations or new rules and variations. You could solve
this on prolog, for example, defining tiles as 4 numbers (one for each side),
and what you effectively get is a distribution of tiles, that you can later
"paint" as you want. You could later add even softer constraints, like density
or others.

------
DonaldPShimoda
This reminds me of one of my favorite technical blog posts [0], which shows a
different approach to achieve a similar goal.

[0] [http://journal.stuffwithstuff.com/2014/12/21/rooms-and-
mazes...](http://journal.stuffwithstuff.com/2014/12/21/rooms-and-mazes/)

------
ggggtez
Neat, yes, but when you do procedural generation from local information only,
you often get artificial looking "dungeons".

Though, it does make me curious about what extending this to use a
"hierarchical" tileset might do. For example, start with large tiles that
define a probability distribution. Tile those. Use that to initialize the
probability distribution for the smaller tile generation.

------
jon_richards
Very interesting. I wonder how much inspiration this drew from carcassonne.

~~~
ryanar
I just played Carcassonne last night and immediately thought of it when I
started reading the piece. I am not sure how the game designers built the game
to almost always ensure there was a valid configuration, in my play-throughs I
think I have only hit that situation once.

~~~
stutonk
After looking up a couple images -- that game appears to use Wang tiles.
They're also sometimes used for terrain textures in video games to make
seamless mosaics with less obvious repetition.

[https://en.wikipedia.org/wiki/Wang_tile](https://en.wikipedia.org/wiki/Wang_tile)

~~~
tgb
While they could be drawn similarly to how Wang tiles are drawn, they
definitely lack the aperiodicity property of Wang tiles. (Eg there are tiles
with all four edges the same, hence you could tile the plain with nothing but
that tile.) Of course the other distinction is that you only use each tile
once in Carcassonne, unlike a set of Wang tiles.

~~~
fwip
It doesn't look like aperiodicity is a required property of Wang tiles. Just
the cool ones. :)

~~~
tgb
I suppose you're right.

------
PaulHoule
What about using Metropolis sampling?

------
Bromskloss
Maybe something for the demo scene.

