aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: 23349484ed57f3b23d46b0922a999001c77e3a01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
### Wave function collapse

This an implementation of very primitive tile-based wave function collapse.
It uses tiles to generate an image, similar to this:

![Demo 0 of the program](demo/demo0.png) ![Demo 1 of the program](demo/demo1.png)

It generates the tiles as ppm, then generates the image, similar to the demo image as ppm. There is a script to turn the ppm files into png using imagemagick.

All files including the tiles are saved in the files directory

### Build

To build use `./build.sh`
To build and run use `./build.sh run`

### How it works

There are two programs, the first one generates the tiles and a special little file which includes the information
if a tile should connect to another tile. The tiles are specified as bitmaps, their symmetry type, and on which sides it connects.
And the program generates every tile and all of its rotations as ppm files.

The other program reads the ppm tiles and the tile-info file (tiles.bin) and it creates the tilemap.
Using the tile-info file it internally creates a table of bit masks to apply to the neighbors of collapsed tiles.
Other than that it functions very similar to a normal a normal simple tiled model

### Limitations

1. For now i am using a second program to generate the tiles and their rotation
   as explained in the previous section
2. No more than 63 tiles, because i am using a 64-bit integer to store the superpositions
   of tiles
3. Only tile based wave function collapse, i dont understand the other more complex one

### References

[wave function collapse readme](https://github.com/mxgmn/WaveFunctionCollapse)