diff options
author | kartofen <mladenovnasko0@gmail.com> | 2022-08-11 21:45:03 +0300 |
---|---|---|
committer | kartofen <mladenovnasko0@gmail.com> | 2022-08-11 21:45:03 +0300 |
commit | 30d1c9b30b5642efcba66bdc7956f4d7e321fc97 (patch) | |
tree | ae3cf3aeb4b01f1cb70ae84cc84d453e08da35a5 /README.md | |
parent | 57315da56fa3b036f8e3e2d32a5f90a11ae7c3de (diff) |
more used friendly
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 51 |
1 files changed, 36 insertions, 15 deletions
@@ -1,37 +1,58 @@ -### Wave function collapse +### 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) +![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. +It can use colored tileset like the one included in the files directory, which is copied from +Mxgmn's Wave Function Collapse README. -All files including the tiles are saved in the files directory +There is a script to turn the generated images 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` +To clean use `./build.sh clean` + +Two files will be build in the bin directory, +`bin/gen_tiles` and `bin/wfc` + +I am pretty sure the `bin/wfc` should work on Windows, +`bin/gen_tiles` uses linux-only header to +create the directories for the files (files and files/tiles) + +It would be easy to make everything work on windows, +I just dont want to take my time and make it cross platform. + +And I dont want to use Makefile, because I dont like it, +the project is not too big, a shell script is enough. ### 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. +Firstly `bin/wfc --help` can be used for some info on program arguments + +The main program `bin/wfc` uses the tiles in `files/tiles`, which are ppm files. +There is a file called `tiles.dat` in the same directory that holds information about the tiles, and it enables `bin/wfc` to generate the tile rotations + +The `bin/gen_tiles` generates the `tiles.dat` file and optionally the tiles themselves. +There is a file called `config.h` under the src directory which is used to specify things about +`tiles.dat` and basically configuring `bin/gen_tiles`. More info in the file as comments. + +To use a tileset, different from the one that can be generated from `bin/gen_tiles` +you need to specify the tile-types you are going to use in `src/config.h`, then copy-paste +the tiles into `files/tiles` directory and then name them `tile_<num>.ppm`, where +num is the index of the tile in the `tiles_to_load` array in `src/config.h` (Not the tile index in the table). -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 +1. 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 +2. Only tile based wave function collapse, I dont understand the other more complex one ### References -[wave function collapse readme](https://github.com/mxgmn/WaveFunctionCollapse) +[Mxgmn's Wave Function Collapse README](https://github.com/mxgmn/WaveFunctionCollapse) |