I start a PhD in Computer Science at Brown this fall.
Currently, I work with language models and on visual programming at HypeHype.
My research is sponsored by Embark Studios and my GitHub Sponsors.
Bitmap & tilemap generation from a single example with the help of ideas from quantum mechanics
License: Other
I start a PhD in Computer Science at Brown this fall.
Currently, I work with language models and on visual programming at HypeHype.
My research is sponsored by Embark Studios and my GitHub Sponsors.
For the competition PACTF, there is a question about a programmer cutting off a branch of a github repository. The files given in the problem are the same files in this repository except for the fact that this repository has the gitignore and gitattributes files. Is there a link to the ctf here? If there is, then where is the flag
Hello,
The source code is seriously unreadable:
Those point are seriously hindering the amazing work that this algorithm is. No one is able to understand such code. It's even hard to make use of it.
I can help with formatting, but not refactoring since I obviously can't understand what's going on.
Hello!
I'm trying 3D version of Overlapping Model, but I met this issue. In many cases, empty pattern (with no voxel) and whole pattern (with full same voxels) dominates all. I cut off the weights to 1, but I thought this is not the best answer. Because almost every building or object has empty pattern and full pattern. So it's natural, but hard to get naturalness.
So did you tried any density function for stationary on Overlapping Model on 3D?
Hi,
I'm trying to implement a way to give the algorithm a pre-defined output image containing fixed (already put in place) tiles (in overlap mode).
I do not understand the code very well but I have some ideas.
So on this line the output image is created:
WaveFunctionCollapse/OverlappingModel.cs
Line 116 in a6f79f0
observed
array with our pre-defined image (before running the algorithm)?observed
do?init
or observer
function.
EDIT:
My use-case is specifying an output image where the border is filled with "water" so that you can guarantee that the algorithm always generates "islands". Same goes with "rooms".
3Bricks.bmp opens fine in C# (Windows, CLR), opens fine in my editor (Paint.NET), but crashes and burns in Java:
Exception in thread "main" java.lang.RuntimeException: Failed while trying to read 3Bricks.bmp!
at com.technicallyvalid.kollapse.Main.runOverlappingModel(Main.kt:74)
at com.technicallyvalid.kollapse.Main.main(Main.kt:30)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.lang.IndexOutOfBoundsException: off < 0 || len < 0 || off + len > b.length!
at javax.imageio.stream.ImageInputStreamImpl.readFully(ImageInputStreamImpl.java:346)
at com.sun.imageio.plugins.bmp.BMPImageReader.read8Bit(BMPImageReader.java:1160)
at com.sun.imageio.plugins.bmp.BMPImageReader.read(BMPImageReader.java:923)
at javax.imageio.ImageIO.read(ImageIO.java:1448)
at javax.imageio.ImageIO.read(ImageIO.java:1308)
at com.technicallyvalid.kollapse.Main.runOverlappingModel(Main.kt:72)
... 6 more
Might be a damaged header or something. In any case, it'd be nice if someone could open and re-save 3Bricks.bmp in a trusted editor.
Whenever i run the project from VS15, i get 50 syntax errors, and i'm not sure how to fix them. (Please note i am still very new to programming)
Picture:
https://gyazo.com/a92b0a9da673cdedd8488889fe63f617
Someone moving to the C++ version (for speed, perhaps) shouldn't have to port their config files to the format supported by that version.
JSON support is currently beeing implemented for that version (Issue/Discussion) and I'll implement it here as well so that there's some common ground between the 2 versions. We've currently agreed to this or (this, fomatted differently) format. Any objections?
Hi, not really an issue, but are we intended to build our own data.xml files (similar to the summer tileset) manually? Or is there a way to infer this from an existing level design? I currently have a fairly large tileset that I'm trying to map out, and I can't help but feel like I'm definitely making mistakes while trying to do this manually.
I see a Kotlin implementation but it would be nice to have a pure Java implementation.
Hi,
I'm trying to add a tile to my tileset that does not have symmetry. Here is the tile:
I believe that this tile has none of the symmetry types (X, I, L, etc). Please correct me if I am wrong! However, I cannot seem to define this in the data.xml file; In fact, is it true that because of this line:
WaveFunctionCollapse/SimpleTiledModel.cs
Line 64 in fad1066
It would be a good idea to have some unit tests on this code. Ensure that given an input and some seed, it does a pixel-by-pixel comparison of that output with an expected output image. Would make changes much safer. (I have a few examples in Kollapse, if that helps any).
Hello, awesome work on this algorithm. Really cool stuff.
I'm still reading the code and getting a grip on what's happening, so I don't understand every part of the code yet. But in the readme you give an example of a human started level completed by the algorithm. So I tried to implement that.
I tried manually creating a wave that has only one coefficient set to true on the tiles that I draw, with the rest set to false. I then set that as the wave in the simple tiled model. But this approach doesn't work as the algorithm always fails after about 19 iterations (using the Castle example). (Basically as soon as the propagation reaches the user defined tiles, the result is unsuccessful).
Could you explain how did you do the autocompletion?
I couldn't find the authors of the summer tileset and will be grateful for information about them.
The tileset you call "Summer" was created by Hermann Hillmann and distributed on sites popular with hobby game developers 10+ years ago. I'm not sure what the official source is any more or how to contact the author; all the old links I knew to it seem to have been taken offline.
Here's an archive.org copy of the VBExplorer site crediting Hermann Hillmann. It has the ~2MB download including winter tiles as well. It says:
Game Tile Set #1 Excellent free game tile set by Hermann Hillmann(2MB). These and more tiles are included in the Character Pack
WaveFunctionCollapse version tested: commit 333f592 (HEAD as of this writing)
In Main.cs, on line 40, we check to see if the model has found a solution with the given seed. If it has found a solution, we then save a bmp file of the solution. Thus, the expectation is that any bmp file saved via this program should be completely "collapsed".
For some examples, this is not the case, and bmp files are saved that are partially still in a "superposition" state. The only reason I can see for this is that model.run() is sometimes returning true even if it hasn't found a solution.
To reproduce this bug, delete every entry of samples.xml except one:
<samples>
<simpletiled name="Summer" width="15" height="15" periodic="False" limit="15"/>
</samples>
And change line 38 of Main.cs from
int seed = random.Next();
to
int seed = 474849158;
Then run the program.
I expect to see one of two things: "CONTRADICTION" printed in the console with no bmp file created, or "DONE" printed in the console with a fully-collapsed BMP file created.
Instead, "DONE" is printed and a partially-resolved BMP file is created.
Hey, I'm running into some issues compiling this using mcs on MacOS High Sierra. Specifically, here's my terminal output after running
mcs -pkg:dotnet /reference:System.Drawing.dll *.cs
and installing mono using brew. I'm not at all familiar with C# or .NET, so any guidance with this would be appreciated ... it definitely looks like a versioning issue.
Here's my mono version:
Mono JIT compiler version 5.10.1.47 (2017-12/8eb8f7d5e74 Fri Apr 13 20:18:12 EDT 2018)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
TLS: normal
SIGSEGV: altstack
Notification: kqueue
Architecture: amd64
Disabled: none
Misc: softdebug
Interpreter: yes
LLVM: yes(3.6.0svn-mono-master/8b1520c8aae)
GC: sgen (concurrent by default)
And here's my output:
OverlappingModel.cs(50,17): error CS1525: Unexpected symbol `(', expecting `,', `;', or `='
OverlappingModel.cs(50,28): error CS1525: Unexpected symbol `int', expecting `,', `;', or `='
OverlappingModel.cs(50,33): error CS1525: Unexpected symbol `byte', expecting `,', `;', or `='
OverlappingModel.cs(55,4): error CS1519: Unexpected symbol `;' in class, struct, or interface member declaration
OverlappingModel.cs(70,4): error CS1519: Unexpected symbol `;' in class, struct, or interface member declaration
OverlappingModel.cs(92,4): error CS1519: Unexpected symbol `;' in class, struct, or interface member declaration
OverlappingModel.cs(97,5): error CS1519: Unexpected symbol `for' in class, struct, or interface member declaration
OverlappingModel.cs(97,14): error CS1519: Unexpected symbol `=' in class, struct, or interface member declaration
OverlappingModel.cs(97,21): error CS1519: Unexpected symbol `<' in class, struct, or interface member declaration
OverlappingModel.cs(97,44): error CS1519: Unexpected symbol `:' in class, struct, or interface member declaration
OverlappingModel.cs(97,50): error CS1519: Unexpected symbol `-' in class, struct, or interface member declaration
OverlappingModel.cs(97,54): error CS1519: Unexpected symbol `+' in class, struct, or interface member declaration
OverlappingModel.cs(97,62): error CS1519: Unexpected symbol `++' in class, struct, or interface member declaration
OverlappingModel.cs(97,76): error CS1519: Unexpected symbol `=' in class, struct, or interface member declaration
OverlappingModel.cs(97,83): error CS1519: Unexpected symbol `<' in class, struct, or interface member declaration
OverlappingModel.cs(97,106): error CS1519: Unexpected symbol `:' in class, struct, or interface member declaration
OverlappingModel.cs(97,112): error CS1519: Unexpected symbol `-' in class, struct, or interface member declaration
OverlappingModel.cs(97,116): error CS1519: Unexpected symbol `+' in class, struct, or interface member declaration
OverlappingModel.cs(97,124): error CS1519: Unexpected symbol `++' in class, struct, or interface member declaration
OverlappingModel.cs(98,4): error CS9010: Primary constructor body is not allowed
OverlappingModel.cs(122,5): error CS1519: Unexpected symbol `=' in class, struct, or interface member declaration
OverlappingModel.cs(122,20): error CS1519: Unexpected symbol `;' in class, struct, or interface member declaration
OverlappingModel.cs(123,15): error CS1519: Unexpected symbol `=' in class, struct, or interface member declaration
OverlappingModel.cs(123,25): error CS1519: Unexpected symbol `+' in class, struct, or interface member declaration
OverlappingModel.cs(123,28): error CS1519: Unexpected symbol `)' in class, struct, or interface member declaration
OverlappingModel.cs(123,33): error CS1519: Unexpected symbol `;' in class, struct, or interface member declaration
OverlappingModel.cs(124,12): error CS1519: Unexpected symbol `=' in class, struct, or interface member declaration
OverlappingModel.cs(124,23): error CS1519: Unexpected symbol `T' in class, struct, or interface member declaration
OverlappingModel.cs(124,24): error CS1519: Unexpected symbol `]' in class, struct, or interface member declaration
OverlappingModel.cs(124,25): error CS1525: Unexpected symbol `]', expecting `,' or `]'
OverlappingModel.cs(125,16): error CS1519: Unexpected symbol `=' in class, struct, or interface member declaration
OverlappingModel.cs(125,29): error CS1519: Unexpected symbol `T' in class, struct, or interface member declaration
OverlappingModel.cs(125,30): error CS1519: Unexpected symbol `]' in class, struct, or interface member declaration
OverlappingModel.cs(128,9): error CS1519: Unexpected symbol `foreach' in class, struct, or interface member declaration
OverlappingModel.cs(128,20): error CS1519: Unexpected symbol `in' in class, struct, or interface member declaration
OverlappingModel.cs(128,30): error CS1519: Unexpected symbol `)' in class, struct, or interface member declaration
OverlappingModel.cs(129,3): error CS9010: Primary constructor body is not allowed
OverlappingModel.cs(129,3): error CS8041: Primary constructor already has a body
OverlappingModel.cs(140,4): error CS1519: Unexpected symbol `;' in class, struct, or interface member declaration
OverlappingModel.cs(142,14): error CS1519: Unexpected symbol `=' in class, struct, or interface member declaration
OverlappingModel.cs(142,24): error CS1519: Unexpected symbol `4' in class, struct, or interface member declaration
OverlappingModel.cs(142,26): error CS1525: Unexpected symbol `]', expecting `,' or `]'
OverlappingModel.cs(142,28): error CS1525: Unexpected symbol `]', expecting `,' or `]'
OverlappingModel.cs(143,14): error CS1519: Unexpected symbol `=' in class, struct, or interface member declaration
OverlappingModel.cs(143,21): error CS1519: Unexpected symbol `<' in class, struct, or interface member declaration
OverlappingModel.cs(143,28): error CS1519: Unexpected symbol `++' in class, struct, or interface member declaration
OverlappingModel.cs(144,3): error CS9010: Primary constructor body is not allowed
OverlappingModel.cs(144,3): error CS8041: Primary constructor already has a body
OverlappingModel.cs(156,20): error CS1525: Unexpected symbol `bool', expecting `class', `delegate', `enum', `interface', `partial', or `struct'
SimpleTiledModel.cs(40,15): error CS1525: Unexpected symbol `(', expecting `,', `;', or `='
SimpleTiledModel.cs(40,26): error CS1525: Unexpected symbol `int', expecting `,', `;', or `='
SimpleTiledModel.cs(40,36): error CS1525: Unexpected symbol `>', expecting `,', `;', or `='
SimpleTiledModel.cs(45,4): error CS1519: Unexpected symbol `;' in class, struct, or interface member declaration
SimpleTiledModel.cs(49,9): error CS1519: Unexpected symbol `=' in class, struct, or interface member declaration
SimpleTiledModel.cs(49,28): error CS1519: Unexpected symbol `(' in class, struct, or interface member declaration
SimpleTiledModel.cs(49,29): error CS1519: Unexpected symbol `)' in class, struct, or interface member declaration
SimpleTiledModel.cs(50,13): error CS1519: Unexpected symbol `=' in class, struct, or interface member declaration
SimpleTiledModel.cs(50,31): error CS1519: Unexpected symbol `(' in class, struct, or interface member declaration
SimpleTiledModel.cs(50,32): error CS1519: Unexpected symbol `)' in class, struct, or interface member declaration
SimpleTiledModel.cs(56,9): error CS1519: Unexpected symbol `foreach' in class, struct, or interface member declaration
SimpleTiledModel.cs(56,28): error CS1519: Unexpected symbol `in' in class, struct, or interface member declaration
SimpleTiledModel.cs(56,43): error CS1519: Unexpected symbol `(' in class, struct, or interface member declaration
SimpleTiledModel.cs(56,50): error CS1519: Unexpected symbol `tiles' in class, struct, or interface member declaration
SimpleTiledModel.cs(56,63): error CS1525: Unexpected symbol `tile'
SimpleTiledModel.cs(56,53): error CS1520: Class, struct, or interface method must have a return type
SimpleTiledModel.cs(56,68): error CS1525: Unexpected symbol `)'
SimpleTiledModel.cs(143,5): error CS1519: Unexpected symbol `=' in class, struct, or interface member declaration
SimpleTiledModel.cs(143,19): error CS1519: Unexpected symbol `;' in class, struct, or interface member declaration
SimpleTiledModel.cs(144,11): error CS1519: Unexpected symbol `=' in class, struct, or interface member declaration
SimpleTiledModel.cs(144,35): error CS1519: Unexpected symbol `(' in class, struct, or interface member declaration
SimpleTiledModel.cs(144,36): error CS1519: Unexpected symbol `)' in class, struct, or interface member declaration
SimpleTiledModel.cs(146,14): error CS1519: Unexpected symbol `=' in class, struct, or interface member declaration
SimpleTiledModel.cs(146,24): error CS1519: Unexpected symbol `4' in class, struct, or interface member declaration
SimpleTiledModel.cs(146,26): error CS1525: Unexpected symbol `]', expecting `,' or `]'
SimpleTiledModel.cs(146,28): error CS1525: Unexpected symbol `]', expecting `,' or `]'
SimpleTiledModel.cs(148,5): error CS1519: Unexpected symbol `for' in class, struct, or interface member declaration
SimpleTiledModel.cs(148,14): error CS1519: Unexpected symbol `=' in class, struct, or interface member declaration
SimpleTiledModel.cs(148,21): error CS1519: Unexpected symbol `<' in class, struct, or interface member declaration
SimpleTiledModel.cs(148,28): error CS1519: Unexpected symbol `++' in class, struct, or interface member declaration
SimpleTiledModel.cs(149,3): error CS9010: Primary constructor body is not allowed
SimpleTiledModel.cs(155,9): error CS1519: Unexpected symbol `foreach' in class, struct, or interface member declaration
SimpleTiledModel.cs(155,32): error CS1519: Unexpected symbol `in' in class, struct, or interface member declaration
SimpleTiledModel.cs(155,47): error CS1519: Unexpected symbol `(' in class, struct, or interface member declaration
SimpleTiledModel.cs(155,58): error CS1519: Unexpected symbol `neighbors' in class, struct, or interface member declaration
SimpleTiledModel.cs(155,71): error CS1525: Unexpected symbol `neighbor'
SimpleTiledModel.cs(155,61): error CS1520: Class, struct, or interface method must have a return type
SimpleTiledModel.cs(155,80): error CS1525: Unexpected symbol `)'
SimpleTiledModel.cs(176,5): error CS1519: Unexpected symbol `for' in class, struct, or interface member declaration
SimpleTiledModel.cs(176,15): error CS1519: Unexpected symbol `=' in class, struct, or interface member declaration
SimpleTiledModel.cs(176,23): error CS1519: Unexpected symbol `<' in class, struct, or interface member declaration
SimpleTiledModel.cs(176,26): error CS1519: Unexpected symbol `;' in class, struct, or interface member declaration
SimpleTiledModel.cs(176,31): error CS1519: Unexpected symbol `++' in class, struct, or interface member declaration
SimpleTiledModel.cs(176,46): error CS1519: Unexpected symbol `=' in class, struct, or interface member declaration
SimpleTiledModel.cs(176,54): error CS1519: Unexpected symbol `<' in class, struct, or interface member declaration
SimpleTiledModel.cs(176,57): error CS1519: Unexpected symbol `;' in class, struct, or interface member declaration
SimpleTiledModel.cs(176,62): error CS1519: Unexpected symbol `++' in class, struct, or interface member declaration
SimpleTiledModel.cs(177,4): error CS9010: Primary constructor body is not allowed
SimpleTiledModel.cs(177,4): error CS8041: Primary constructor already has a body
SimpleTiledModel.cs(183,5): error CS1519: Unexpected symbol `for' in class, struct, or interface member declaration
SimpleTiledModel.cs(183,14): error CS1519: Unexpected symbol `=' in class, struct, or interface member declaration
SimpleTiledModel.cs(183,21): error CS1519: Unexpected symbol `<' in class, struct, or interface member declaration
SimpleTiledModel.cs(183,28): error CS1519: Unexpected symbol `++' in class, struct, or interface member declaration
SimpleTiledModel.cs(184,3): error CS9010: Primary constructor body is not allowed
SimpleTiledModel.cs(184,3): error CS8041: Primary constructor already has a body
SimpleTiledModel.cs(189,5): error CS1519: Unexpected symbol `for' in class, struct, or interface member declaration
SimpleTiledModel.cs(189,14): error CS1519: Unexpected symbol `=' in class, struct, or interface member declaration
SimpleTiledModel.cs(189,21): error CS1519: Unexpected symbol `<' in class, struct, or interface member declaration
SimpleTiledModel.cs(189,28): error CS1519: Unexpected symbol `++' in class, struct, or interface member declaration
SimpleTiledModel.cs(189,43): error CS1519: Unexpected symbol `=' in class, struct, or interface member declaration
SimpleTiledModel.cs(189,51): error CS1519: Unexpected symbol `<' in class, struct, or interface member declaration
SimpleTiledModel.cs(189,54): error CS1519: Unexpected symbol `;' in class, struct, or interface member declaration
SimpleTiledModel.cs(189,59): error CS1519: Unexpected symbol `++' in class, struct, or interface member declaration
SimpleTiledModel.cs(190,4): error CS9010: Primary constructor body is not allowed
SimpleTiledModel.cs(190,4): error CS8041: Primary constructor already has a body
SimpleTiledModel.cs(202,20): error CS1525: Unexpected symbol `bool', expecting `class', `delegate', `enum', `interface', `partial', or `struct'
Compilation failed: 115 error(s), 0 warnings
While porting this over to Kotlin (whee), I discovered what I think is the root cause of my troubles: when populating the patterns
and stationary
arrays in OverlappingModel, the keys of weight
are iterated over. The order of this enumeration is non-deterministic, and the patterns and stationary can vary significantly based on the ordering.
For purposes of enumeration, each item in the dictionary is treated as a KeyValuePair<TKey, TValue> structure representing a value and its key. The order in which the items are returned is undefined.
https://msdn.microsoft.com/en-us/library/xfhwa508(v=vs.110).aspx
The affected code is here:
foreach (int w in weights.Keys)
{
patterns[counter] = patternFromIndex(w);
stationary[counter] = weights[w];
counter++;
}
Hi,
I'm interested in using your project in a game called Magical Life. Is there a Nuget package of your project, or some way I can incorporate it into my game? Does your project's license allow for usage in a game?
Thanks,
SneakyTactician
i am trying to create 3d models, voxelsize: 8
could that be more than the program expects to handle ?
D:\dev\wfc-3d-basic>WFC-3D.exe < Station Unhandled Exception: System.ArgumentException: The output char buffer is too small to contain the decoded characters, encoding 'Unicode (UTF-8)' fallback 'System.Text.DecoderReplacementFallback'. Parameter name: chars at System.Text.Encoding.ThrowCharsOverflow() at System.Text.Encoding.ThrowCharsOverflow(DecoderNLS decoder, Boolean nothingDecoded) at System.Text.UTF8Encoding.GetChars(Byte* bytes, Int32 byteCount, Char* chars, Int32 charCount, DecoderNLS baseDecoder) at System.Text.DecoderNLS.GetChars(Byte* bytes, Int32 byteCount, Char* chars, Int32 charCount, Boolean flush) at System.IO.BinaryReader.InternalReadChars(Char[] buffer, Int32 index, Int32 count) at System.IO.BinaryReader.ReadChars(Int32 count) at Stuff.ReadVox(BinaryReader stream) at Stuff.ReadVox(String filename) at Model..ctor(String name, String subsetName, Int32 FMX, Int32 FMY, Int32 FMZ, Boolean periodic, String groundName) at Program.Main()
On Fedora 24, Mono JIT compiler version 4.2.4.
WaveFunctionCollapse git:(master) ✗ mono Main.exe
< Chess
> DONE
> DONE
< Chess
> CONTRADICTION
> CONTRADICTION
> CONTRADICTION
> CONTRADICTION
> CONTRADICTION
> CONTRADICTION
> CONTRADICTION
> CONTRADICTION
> CONTRADICTION
> CONTRADICTION
< City
> DONE
> DONE
< Flowers
> DONE
> DONE
< Hogs
> DONE
> DONE
< Hogs
> DONE
> CONTRADICTION
> CONTRADICTION
> CONTRADICTION
> DONE
< Knot
> DONE
> DONE
< Less Rooms
> DONE
> DONE
< Mountains
> DONE
> DONE
< Office
> DONE
> DONE
< Paths
> DONE
> DONE
< Platformer
> DONE
> DONE
< Platformer
> DONE
> DONE
< Red Maze
> DONE
> DONE
< Rooms
> DONE
> DONE
> DONE
< Rule 126
> DONE
> DONE
< Simple Knot
> DONE
> DONE
< Simple Maze
> DONE
> DONE
< Simple Wall
> DONE
> DONE
< Simple Wall
> DONE
> DONE
< Simple Wall
> DONE
> DONE
< Simple Wall
> DONE
> DONE
< Trick Knot
> DONE
> DONE
< Village
> DONE
> DONE
< Water
> DONE
> DONE
< Summer
Unhandled Exception:
System.Exception: 0.0001 is not a valid value for Single. ---> System.FormatException: Input string was not in a correct format.
at System.Number.ParseSingle (System.String value, NumberStyles options, System.Globalization.NumberFormatInfo numfmt) <0x413eb590 + 0x00183> in <filename unknown>:0
at System.Single.Parse (System.String s, NumberStyles style, System.Globalization.NumberFormatInfo info) <0x413eb550 + 0x00017> in <filename unknown>:0
at System.Single.Parse (System.String s, NumberStyles style, IFormatProvider provider) <0x413eb440 + 0x0003b> in <filename unknown>:0
at System.ComponentModel.SingleConverter.FromString (System.String value, System.Globalization.NumberFormatInfo formatInfo) <0x413eb3d0 + 0x0001f> in <filename unknown>:0
at System.ComponentModel.BaseNumberConverter.ConvertFrom (ITypeDescriptorContext context, System.Globalization.CultureInfo culture, System.Object value) <0x413d5060 + 0x00259> in <filename unknown>:0
--- End of inner exception stack trace ---
at System.ComponentModel.BaseNumberConverter.ConvertFrom (ITypeDescriptorContext context, System.Globalization.CultureInfo culture, System.Object value) <0x413d5060 + 0x0028b> in <filename unknown>:0
at System.ComponentModel.TypeConverter.ConvertFromString (System.String text) <0x413cc070 + 0x00021> in <filename unknown>:0
at Stuff.Get[T] (System.Xml.XmlNode node, System.String attribute, T defaultT) <0x413eac30 + 0x000b7> in <filename unknown>:0
at SimpleTiledModel..ctor (System.String name, System.String subsetName, Int32 width, Int32 height, Boolean periodic, Boolean black) <0x413e7000 + 0x01827> in <filename unknown>:0
at Program.Main () <0x4135ee30 + 0x003fb> in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.Exception: 0.0001 is not a valid value for Single. ---> System.FormatException: Input string was not in a correct format.
at System.Number.ParseSingle (System.String value, NumberStyles options, System.Globalization.NumberFormatInfo numfmt) <0x413eb590 + 0x00183> in <filename unknown>:0
at System.Single.Parse (System.String s, NumberStyles style, System.Globalization.NumberFormatInfo info) <0x413eb550 + 0x00017> in <filename unknown>:0
at System.Single.Parse (System.String s, NumberStyles style, IFormatProvider provider) <0x413eb440 + 0x0003b> in <filename unknown>:0
at System.ComponentModel.SingleConverter.FromString (System.String value, System.Globalization.NumberFormatInfo formatInfo) <0x413eb3d0 + 0x0001f> in <filename unknown>:0
at System.ComponentModel.BaseNumberConverter.ConvertFrom (ITypeDescriptorContext context, System.Globalization.CultureInfo culture, System.Object value) <0x413d5060 + 0x00259> in <filename unknown>:0
--- End of inner exception stack trace ---
at System.ComponentModel.BaseNumberConverter.ConvertFrom (ITypeDescriptorContext context, System.Globalization.CultureInfo culture, System.Object value) <0x413d5060 + 0x0028b> in <filename unknown>:0
at System.ComponentModel.TypeConverter.ConvertFromString (System.String text) <0x413cc070 + 0x00021> in <filename unknown>:0
at Stuff.Get[T] (System.Xml.XmlNode node, System.String attribute, T defaultT) <0x413eac30 + 0x000b7> in <filename unknown>:0
at SimpleTiledModel..ctor (System.String name, System.String subsetName, Int32 width, Int32 height, Boolean periodic, Boolean black) <0x413e7000 + 0x01827> in <filename unknown>:0
at Program.Main () <0x4135ee30 + 0x003fb> in <filename unknown>:0
I wrote a java port of both the SimpleTiledModel and the OverlappingModel available here.
Comments make reading and debugging the code much easier.
They are especially necessary if the code has one letter variable names!
I've noticed whenever someone tries to explain this algorithm, they compare it with the process of solving a sudoku puzzle, so maybe rename the project (and therefore the algorithm) to:
Sudoku + (WaveFunction) Collapse = SudokuCollapse, best of both worlds?
This way the phrase wouldn't collide with that which it is inspired by (#79) but would still reference it, and would include a reference to something that best explains how it works. What do you think?
This is not directly related to this particular implementation of WFC but more of a theoretical and a general problem. Recently I started developing my own implementation of WFC that operates on an unbounded output and tolerates contradictions (algorithm does not stop at a contradiction but instead provides contradictions as part of the solution). While my algorithm is generally working as expected and I am happy with its results, there are certain edge cases where the Shannon entropy heuristic causes a valid non-controversial deadlock to happen (see gliders in Conway's Game of Life). It is not a contradiction but the output is garbage for all practical purposes because the distribution of tiles in the output does not reflect the distribution of the respective tiles in the input at all. You can imagine two lines of certain tiles extending themselves into infinity as they mutually enforce each other. A typical oscillation loop.
Please help me brainstorm for ideas how to overcome this artifact. If I don't get any better ideas then I'm going to deal with this as oscillations are typically dealt with in engineering --- by adding random noise. I would make sure that the output is randomly observed a small distance away from the area that is currently being processed according to the Shannon entropy heuristic. As a result the whole output is scattered with occasional single observations, which would act as an obstacle to the Shannon entropy heuristic. I'm in a situation where a contradiction is the lesser evil than the deadlock.
WaveFunctionCollapse version tested: 1cf308c (HEAD of master as of this writing)
When I run the program with a specific setting and image, I get an infinite loop on line 85 of OverlappingModel.cs in the constructor:
while (residue >= power)
{
residue -= power;
count++;
}
This loop appears to be doing a combination division and modulo of "residue / power". When I replace it with a division and modulo, I get a division by zero error -- IE, 'power' becomes zero.
To reproduce this bug, replace the contents of samples.xml with:
<samples>
<overlapping name="Office4" N="5" periodic="True"/>
</samples>
And add the following png image to your 'samples' folder:
It's possible that this image is simply an invalid input for the parameters given. Maybe there can never be a valid output for this image when N = 5 and periodic = true. If this is the case, I would expect an exception, or maybe an early return with some "invalid state" flag set, or some sort of detectable/recoverable error. If it is a valid input, then obviously I expect a valid constructed object.
This code doesn't include actual quantum concepts per se, nor wave functions in the complex plane, nor Schrödinger equation, please make the statement clear about not using real physics.
EDIT: Thanks, many Youtubers seems to propagate the idea that this somehow uses quantum physics, which does not.
Hi. It will be good if you divide away the I/O part from actual logic part so we can actually extract whatever we need. I also suggest thinking about adding a C++ implementation. Also i'm getting too much contradictions if I specify high image sizes for some samples.
Hi!
Thank you for the algorithm and the code! I was translating the code to C++ and everything makes sense to me except this line:
Line 185 in 8bbf089
Why are we only interested in the number of remaining tiles for the node 0 for the return value of Propagate
?
As far as I understand, as soon as the number of remaining tiles for a node (not only the node 0) reaches zero, the algorithm should fail.
I think we can do this check after each call to Ban
in Propagate
. Or in NextUnobservedNode
and we return a special value (e.g. -2) in this case.
Best regards,
Pierre
Hi Maxim,
This is not an issue to your repo, but I do not have Twitter, and so no other way to contact you.
We are a group of first years from Imperial College London. Strongly inspired by your repo, we have made a simple implementation of WFC in C. If you are interested please have a look:
https://github.com/ic-pcg/waveFunctionCollapse
Thank you for your amazing repo, it was most helpful!
Line 61 in 3157ed0
Hello!
Thanks for great algorithm, I saw this stuff on reddit and following until nowadays.
Recently, I tried your algorithm with fast-wfc (but you added this with your repo too), and I found this is very fast but also memory-consuming. For make bigger map, I got out-of-memory error.
So I tried make many maps like grid, and patch them together. So I tried to solve the problem with constraints (predefined patterns with up and left line) with same model, but there were too many failures. It succeeds at all.
So my question is, is this normal? I wonder if you have a lot of failures under these constraints. Thanks for advance!
(For reference, number of patterns of my data is around 8,000)
For anyone curious (on a mac):
Run:
$ brew install mono (if you don't have it)
WaveFunctionCollapse $ mcs -pkg:dotnet /reference:System.Drawing.dll *.cs
WaveFunctionCollapse $ mono Main.exe
(it starts working your CPU)
🌻
关注大牛您(star)了...
The description given in the readme about entropy seems off.
On each step the overall entropy decreases
Verification: in Model.cs inside the for loop of the method Run(), compute sum of entropies before Observe() and after Propagate(), and compare the values.
Result: sometimes the sum before is less than the sum after.
Comment: the overall entropy can increase after an observe-propagate step.
Note that the entropy of any node can't increase during the propagation phase
Verification: in Model.cs at the end of Ban(), compare the entropy before and after update (excluding NaN values, and optionally adding a boolean to test if propagation phase).
Result: sometimes the entropy before is less than the entropy after update.
Comment: the entropy of a node can increase during the propagation phase
possibilities are not arising, but can be canceled
This sounds more like some kind of cardinality rather than entropy.
Verification: in Model.cs in Init(), initialize startingEntropy with T, and in Ban() update entropies[i] with sumsOfOnes[i].
Result: The generated images are similar, only Skyline and Platformer look more uniform (visual inspection, and it depends on random seed).
The entropy formula used is not monotonic wrt individual weights, and doesn't measure the number of possibilities but the uniformity of the distribution. Adding a weight that is very small or very large compared to the existing weights can decrease the entropy, and consequently removing such a weight would increase the entropy.
Hello - I have installed 'dotnet sdk' but cannot get the 'dotnet run --configuration Release WaveFunctionCollapse.csproj' command line to work. Any advice? Thank you.
That's an excerpt from the readm, in which repo are the voxel models?
Not sure if I'm just doing something wrong here but I tried running the algorithm today on a dummy tileset I made and got some results I wasn't expecting. I've uploaded a zip file with what I was using here: Base.zip
I modified samples.xml with this entry:
<simpletiled name="Base" width="3" height="3"/>
I also had to modify the for loop in Main.cs to let me run the algorithm 10,000 times as there seemed to be a lot of contradictions. One of the results I got looked like this:
I don't understand how I got this though, as there are no neighbor constraints that include base_corner_1 on both the left and the right.
Good day,
I added this algorithm, using the implementation fast-wfc from Mathieu Fehr and Nathanaël Courant, as a plug-in to be used with Adventure Game Studio:
https://github.com/ericoporto/agsfastwfc
I haven't added full API yet because I got into some other stuff, but wanted to say thanks on creating this algorithm because I think it will be very useful to procedurally generate content in games. I talked with Mathieu about and he told me maybe you would like to be notified about it too :)
You can close this.
Please chose a license for the good of the open-source community (:
As it currently stand, albeit very nice, this tremendous amount of work cannot be incorporated into other research / products / etc. That's because in many countries, unlicensed work belongs by copyright laws to its original author.
Something like MIT would probably be ideal. Your name will be kept, but we'll all be able to use it for our own purposes.
Edit: I just noticed you put blocks within your sources, but a LICENSE file would still be better.
Cheers.
Is it just... hardcoded? If so, that's not really good practice...
1.var bitmap = new Bitmap($"sample/{name}.png"); have a mistake,I use vs2017 build program then visual studio tell me no context on this file of "name".
2.file path only use absolute address
Hello:
I saw this repo, it looks great. However, when I tried to use the repo to generate some images, I have some issues. I have a simple Captcha image: ABCYQ.PNG.
I want to use it for overlapping, so I put this line in Samples.xml:
<samples> <overlapping name="ABCYQ" N="3" symmetry="2" size="30" periodic="True" limit="5"/> </samples>
But for my PC with 16-core CPU, I didn’t get any results after more than one hour.
Then, I would like to try with simpletiled, so in the Samples.xml, I added this line:
<samples> <simpletiled name="ABCYQ" size="10" periodic="False" limit="25"/> </samples>
But I got run time error:
There is no corresponding data XML file for the image.
I looked at the data XML file for circle image, and I found the circle has been split into 8 parts, the data XML list all each part, and all its neighbor’s part, and subsets parts.
I want to know if there is any helper program, which I can use to split the image like the circle image, and generate all parts like in circle data XML file.
In the above case, I want to get a data XML file which contains 5 distinct parts: as: ‘A’, ‘B’, ‘C’, ‘Y’, ‘Q’. As ‘A’ being the left most one, ‘B’ being second part, which ‘A’ is on the left, ‘C’ on the right, etc…
For more general item, can I get a split program, which can divided any image into 4 equal size parts, as left upper, right upper, left bottom, right bottom.
This way, it will be much easier to run the program, otherwise, for every image, have to create a data XML file by hand, then using simpletiled seems to be impossible, using overlapping is too much time consuming.
Please advise,
Thanks
,
Hi!
I am trying to generate a picture where some tiles may only be in the original rotation. But I still want to be able to define adjecency relations on all 4 sides of those tiles? How is this possible?
When using Symmety "X", it won't rotate, but then I can't define which tiles are allowed to be below or above (I think?).
Is there a way to do this?
Are there any workarounds?
What would need to be modified in the code for this to work? I might do it, if it is feasable!
Thank you in advance!
I'm trying to make sense of the entropy calculation. Line 61 in Model.cs has:
startingEntropy = Math.Log(sumOfWeights) - sumOfWeightLogWeights / sumOfWeights;
and the readme says this is the Shanon Entropy, which should be -sumOfWeightLogWeights
with log base 2, though the choice of log base doesn't change the result of the algorithm. I understand that the weights won't sum to 1 once tiles begin to be excluded.
To account for the weights not summing to 1, you'd just need to normalize the distribution by dividing each weight by sumOfWeights
, right? So that would be:
entropy = -sum(Math.Log(weight[i] / sumOfWeights) * weight[i] / sumOfWeights)
but I don't see how this is equivalent to line 61. What are the steps I'm missing to go from this to line 61?
WFC allows us to set some initial constraints to limit outcomes.
One thing I would like to do, is to use parts of an outcome as constraint, then generate again.
The only problem is, given the same seed and parts of its outcome as constraints, I cannot obtain the same outcome again, because observation order is now different (initial entropy are different).
Can I satisfy this requirement without modifying WFC's underlying algorithm? I think I just need a smart way to do weighted randomization at observation step?
(This is assuming the random input is order-independent, for example, if we use a seeded hash function instead of random number generator.)
I am trying to run it on Mac OS (10.13). I've downloaded the dotnet and installed it as indicated on the main page of this package. I then run with
% ./dotnet run ~/Desktop/WaveFunctionCollapse-master/WaveFunctionCollapse.csproj --project ~/Desktop/WaveFunctionCollapse-master/
and I see:
It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '2.1.0' was not found.
You can resolve the problem by installing the specified framework and/or SDK.
The specified framework can be found at:
but that URL lists only Windows and Linux versions. How is the Mac version of dotnet supposed to run this if it needs something that doesn't exist for Mac? Apologies, I know nothing about the dotnet world... Am a biologist with background in C and Unix from many years back... What am I doing wrong?
I think thats nice its a experience for the new cumor
WTF is this?
Line 101 in 6c1481c
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.