Wave Function Collapse
A downloadable game for Windows and Linux
An infinite, procedurally generated city, assembled out of blocks using the Wave Function Collapse algorithm.
Currently, there is no gameplay, you can only walk around and look at the scenery.
Controls: WASD for walking, Shift to run, Ctrl to jetpack.
Xbox controller: Left Stick for walking, right stick for looking around, A to jump, LB to run, RB to jetpack
Flight mode: Use M to toggle between flight mode and normal mode. In flight mode, you fly across the world, without any controls.
Check out my blog post with some technical details about the WFC algorithm for infinite worlds or read more about the WFC algorithm in general here.
Source code: https://github.com/marian42/wavefunctioncollapse
|Tags||Procedural Generation, Walking simulator|
- Added simple interiors and performance improvementsJan 15, 2019
- Flightmode, Controller support, world unloading, backtrackingNov 11, 2018
- Added details, new blocks, better movementNov 05, 2018
Log in with itch.io to leave a comment.
I can't download the wfc.zip for Windows. I've checked my AdBocker as advised to pause it for this page, but when I click the 'download' button for the Zip nothing happens (just a pop up page thanking me for downloading the demo - which I haven't).
I have this problem that I constantly turn left and don't know how to stop it. Can anyone help me?
Do you have a controller or joystick connected?
Yes. Just tried it after disconnecting, it worked. Thank you! :D
Wow! Multiplayer exploration mode with VR support! Check out Manifold Garden by William Chyr too!
Impressive work. I download source code on GitHub and I took a look at scripts. Thank you for sharing. I really appreciate the main aesthetic. I wish you the best ++
Oh its opensource to :D as someone who codes things this made my day better
ngl i open this game about once every couple months and have my mind blown again
I had a dream about this about 5months ago I think. Once I saw your "Infinite procedurally generated city in Unity" a few months later. Just got back on here today to make this comment. Wanted to see what the progress was.
One who made this must be a Genius. I wish there was a tutorial on how it was created!
How I can set up bounds or size in the unity project? Regards!
I noted that you wanted to talk about adding possible game mechanics. I think it'd be neat if you added larger almost arena like areas and "bosses" either making the game darksouls ish or a fast paced shooter. I do also want to say I wish you could go further down and up, maybe 5 layers down, 5 layers up that are reliable then after that it becomes a bit less likely to find rooms the further down or up you go?
LOOKS amazing, Parkour sim yay
A wonderful concept! I have literally had dreams like this. Will you add more building types?
it would be worse to run than flight sim
Have you ever heard of this manga called Blame? Because this program feel like it could have a lot of potential for a game with a similar concept. The technology seems like it would be really good for creating a survival horror sandbox game.
I really trying to get this thing working. But something is still missing from documentation perspective.
I tried to create custom tiles from beginning. Even successfully figured out how to do a complex moments, that are size of 16x, and made of parts that are 2x2 (1/4 of 16).
Couple moments that are not that clear to me. What is exact difference between Flipped and Symmetrical (horizontal) tile?
As I understood we can make connections, such as:
They don't look flipped, both look rotated, and that flag (Flipped or Symmetrical) feels more like just an identification of pairs, not how they actually behave.
But thing is, when I'm doing ModuleData, even Simplify data, everything also seems to be fine.
But during Game generation, after a bit distancing, it gets stuck in Backtracking, that looks very simple to me, but really hard for the algorithm. And surprisingly, it does builds some tiles during backtracking that shouldn't be matching.
It does builds an impossible patterns with mismatching Connectors, I don't know why. Like 55s connected with 2s, and other ones.
Is there any ideas what might be wrong?
Yep. Seems to be backtracking doesn't solve simple problems... Even in scene (3 tiles), where are straight lines only (no rotation in my case). Even with Boundary Constraints disabled. After one minute, it starts to do backtracking when there is no need in that. Like looks like a bug to me:
2998 Backtracking 758 steps...
+ Tried your tiles, picked up about 6, that will generate a plane (no walls). With boundary works, without nope.
I tweaked as much settings as possible, but result is still same.
Any ideas what's might be wrong?
This looks so dope! I seriously spent hours just parkouring on the roof tops. I just wonder if you are sstill working on it.
Thanks for providing the source code! I made a nice screen saver out of it. https://yeetcraft.imfast.io/WaveFunctionCollapse.scr
thanks for the free virus
Nice job! Respect!
hey! what does your tile set for this look like? rn im creating a tileset for my own implementation and having some trouble with a few things
Check out the blog post linked in the description, it contains a screenshot of the tileset.
I love stuff Like this! I love the idea of a vast never ending structure. So eerie.
I love what I've seen! Unfortunately, it seemed to give up attempting to render more after a certain distance, and I found myself with a relatively small limited area to explore. Anything I'm missing? Everyone else seems to be having no trouble.
You probably have a slow PC. You can install Unity engine and download source code to experiment with rendering distance, drawing distance and map height.
Yes, I'm aware of the issue, you need to restart the game. Sorry!
This has a ton of potential. It even prompted me to make a super cringe title for a video of us playing it (after the intro part)
Wish this was for mac, I love wandering in games like this!! :0
traveled to the bottom level and good god it was scary
What you have made is really cool. especially the blender part. I see 2 issues though. if it was to be a massive game.
1. If you wander for long. The amount of inactive objects piling up grows out of hand. A suggestion would be to save the values as a player pref or something and then recreate it if you should return to them.
2. if you wander for too far. you can get to an area where unity based programs renders stuff badly. try 20000x,0,0 and move around. A solution to this would be to normalize the positions once a while.so you technically are moving around in 100x,100y, it's just treated differently for the code.
Thank you! I'm aware of these problems and hopefully I'll find the time to fix them.
This looks great.
There is also a pgrogam called Houdini, which is simmilar to autodesk Maya but can be used to also GENERATE PROCEDURAL ASSETS AND WORLDS.
I have the same idea that you have, but no resources or programming experience just art.
Houdini allows for destructable terrain!
So you could turn this idea into a roquelike procedural shooter!
Would be great. Houdini also allows for procedural textures ect.
But its a much better idea to procedurally generate a 1000 buildings and 10.000 assets up front with textures. And then procedurally place those in a world with procedurally generated vehicles and robots, and modelled enemy's. Using your algorytm.
Because destructable terrain features are included in the generation process in houdini if you specify. Then you will have a real game! With not super much work compared to triple AAA games.
If I ever win a million ill make Nuclear Throne in 3D with the same amount of creative as plants vs zombies garden warfare.
EDIT: And dont use unity! It has problems running on many devices except android. Its made for mobile devices not windows for instance. Unity is the Java of game engines. Its not really made for gaming. Its made for Mobile apps and does a good job at that. But to slow and many bugs for gaming.
If you want to take an algorythm like this, or make your own in Houdini. Make sure you stay low poly, limit yourself and use low resolution textures. Its the game itself that should make it more fun. Not the high resolution graphics. Save your processor speed for destruction and AI. Remeber, most of the world is still running a dual core 2.0 gyg and intelhd2000 card..
There is nothing wrong with making a game that looks good in toon style without real time rendered raytracing water drops and reflections.
you don't seem to know what you are talking about with unity. Really not xD
Unity is fantastic for windows, mac and linux. Small problem with Android having to get the apk and such and add it to unity. Try it yourself.
also you program mostly in C# in unity. Java is not an option and it's not written in java either. It's written in C++.
Beautiful world! Unlike most I am more curious on how you created the great tile sets and how you made them all fit together. Where did you learn to do this? Is there any resources I could look up?
I made them in Blender. You can set a custom snapping distance and I just placed a reference tile next to the one I'm working on. I didn't make a lot of other stuff in Blender before that, so this was kind of a learning project for me.
Hey I'm very interested on how you learned to write and implement this algorithm. I downloaded your source code and tried to understand it in the unity editor, but it was a bit too difficult for me. Where did you learn how to write the algorithm and implement it in Unity? Thanks
If you want to learn about my implementation of WFC, check out this article, the talk by Oskar Stålberg, and the readme of this github repo. If you want to learn how to use Unity, check out thte tutorials by Sebastian Lague. Starting with this WFC project might be difficult as it's very code-heavy.
Thanks for the info! I want to start it in 2d though because it would be easier to learn the algorithm in less dimensions ;)
I've opened your project in unity and set map height to 256. Creation range is 72 chunks. It's even more amazing and unreal w this settings! Thank you very much for this submission. I'm now interested in creation of more structured city (several fixed levels of streets, which means there would be underground ones, stairs inside "houses", more different blocks). By the way, is it possible to create blocks with sizes 2*2*2, 5*100*456 or such using minimal changes in your wfc code?
@LTVA You can make blocks that are bigger than 1x1x1, for example 1x2, by cutting your big block into 1x1x1 blocks and using connectors between them that aren't used anywhere else. In theory, you could make any size block like this, but it would be cumbersome for bigger ones. You could also try to implement that, but that would take a lot of work.
could you add more bottom starirs because i was at the bottom level and there were no stairs and i searched for 10 minutes
If you press M twice, you'll get back to the surface!
How can I make it have more levels in depth?
I don't quite understand the question. What do you mean with depth?
I am pretty sure he is talking about height.
I am wondering hows I can make it have more city deeper down
Download source code, open Game map in Unity, select Map and change «Map height» value, then click Build.
this is so cool!
Absolutely amazing, very beautiful city. Only 16 mb too
This seems really cool, but I cant figure out how to download it...
Did you try to click the Download button next to "wfc.zip" (if you use Windows)?
This is really cool.
I take it that alt+F4 is the only real way to exit the demo?
Also, what kind of hardware are you targeting? The demo was pretty laggy on a Celeron N3060 with integrated graphics, but I should probably have expected that.
Anyway, this is fantastic, and I want to play with it more when I get better hardware.
Since this project is more of a tech demo than a game, I didn't put in lots of convenience features, like a menu, exiting or graphics options. I think the limiting factor is the graphics card and not the processor. I might add graphics options and an exit feature later, but it's not my priority unfortunately.
It is possible to get the basic unity options for resolution and all by starting it while pressing the shift key.
Yes, that should already be possible.
I tried out the executable on a PC and it is really inspiring. Nice work!
On a Mac and new to Unity -- is there something obvious I am doing wrong if I can move the camera about but nothing renders? I installed Blender and can open the Blocks asset. The project builds with 4 warnings but no errors.
With Map selected and in scene mode I can see green wireframes after using Initialize nXn Area, but nothing renders in game mode.
Looks fantastic, love rooms! Was running it for some friends!
But it looks like sometimes the city just "ends" or that theres weird glitches you can fall off of.
Still everyone was impressed ;)
That is the algorithim. You can actually hang the algorithim if you don't let it finish removing and placing blocks, causing it to constantly remove and replace blocks at the 'edge'
Is it possible to replace these blocks with others to make a different world ?
How can i do it ?
Yes, it is possible. Download the source code and open it in Unity. There is a blender file that you need to edit to create new blocks. You might need to do some configuration in the Unity editor. Let me know if you have any questions.
Thanks for ur kindness.
I tried to import a new model, edit its "Module Prototypes" manually. Create module data and save it.
Return to the Game scene and click initialize, but it can't generate, is there something i did wrong?
You need to keep the first two blocks (solid and empty). Also, you can't generate a castle from just one block, you need to split it into many blocks that fit next to each other. Then you need to set connectors for your blocks. You can read how they work here. In your screenshot, the block has a 0 connector on top and a 1 connector on the bottom. It will only place another block above it that has a 0 connector on its bottom face. But there is no such block in your example.
Something to consider is the movement through the world. I want to try this but it's too stilted. Adding something like bunny hopping to gain speed or some other type of rush mechanic would make it much more interesting to navigate. But all-in-all this looks very cool. Following!
Absolutely love this, mate! Even threw together a quick fan-art thing here: https://tinyplanetsandscreenshots.tumblr.com/post/181936073817/applied-quantum-m...
It'd be amazing if there was a hover-in-place option, but you've done a totally stellar job! Cheers!
Thank you, I like the tiny planet image! You can kind of hover in place if you go into flight mode (M) and slow down (hold S).