In this dungeon lesson, the WaveFunctionCollapse algorithm is used to define the base shapes of a game level then a Houdini Digital Asset is built to generate a variety of different dungeons in UE4. WFC technology can enhance your procedural level design by letting you drive the final output using a control setup to spawn a larger solution for your level. This control can be a bitmap image or attributes on points and both methods will be used in this lesson. 


You can learn how to create some of the Dungeon Props in the following Tutorial.         


NOTE: These lessons use the SideFX Labs tools. Make sure the latest release (non production build) is installed before doing this lesson. 
The project files used for this lesson were created with Unreal 4.24


INTRODUCTION

To start you will take a look at the completed asset in UE4 and explore some of its capabilities. You will then review how the tool is setup in Houdini to understand the techniques that will be taught in the following four lessons. 

Length: 06:21

PART 1 | Wave Function Collapse Nodes 

In this lesson, you will take a look at the WFC nodes available in SideFX Labs and how they work together to create patterns that can be used to generate a level. You will then use the Wang Tiles Sample node from SideFX Labs to populate the grid and create the basic shape of a finished level.

Length: 14:26

PART 2 | Basic Layout using WFC

Now that you have the points and can see the level taking shape, the next step is to start assigning references to geometry in UE4 so that the points can be populated with assets. This will involve tools such as the Attribute Value Replace node which allows you to more easily assign Blueprint references.

Length: 25:12

PART 3 | Add Walls and Cliffs 

Because of their sideways orientation, the walls and cliff faces require a special setup. This involves creating points that have their normals aimed the right way and ensuring that these walls can be procedurally generated from the WFC level design.

Length: 18:39

PART 4 | Decorate the Rooms 

To populate the level with columns, crates, debris and enemies, you will use the existing geometry and layer in a secondary WFC setup to procedurally generate the decorations. This demonstrates how WFC can be used in many different ways to create rich game levels that are ready for gameplay.

Length: 25:16

CREATED BY

SIMON VERSTRAETE

Simon is a tech Artist that loves building procedural tools and assets. By adding more and more procedural approaches to his workflow, he is able to build 3D models with speed and flexibility. During his studies at Digital Arts and Entertainment, he taught himself how to work with Houdini. After his studies, he started working on Ary and the Secret of Seasons at eXiin. Currently he is a Houdini freelancer and focuses on creating procedural content.

More from Simon Verstraete

COMMENTS

  • bazuka 7 months, 1 week ago  | 

    Great tutorial my friend, thanks for sharing knowledge ;) with everyone

    Cheers

  • BlissettDMB 7 months, 1 week ago  | 

    Always Quality From SideFx and Seriously great quality work from #Simon Verstraete.
    I've had a quick scan of this course, and I can definately see new quality tools and workflows that will aid My Pipeline.
    Always top quality training.
    Thanks Simon and Thanks SideFx.

  • affectreflect 7 months, 1 week ago  | 

    Forever grateful Simon.Your lessons have helped so many artists all around the world.And thanks SideFx for the ever amazing Houdini.

  • AndreasNull 7 months, 1 week ago  | 

    Great tutorial and tool!
    For some reason, the WFC Initialize Grid does not have any kind of visualisation on my end.
    I see only points.
    Houdini Apprentice 18.0.416 + Lab 416 (local). Any advice?

    • dantarion 7 months, 1 week ago  | 

      Click the eye thing at the bottom right of a viewport to go to Display Options. Go to the geometry tab, Particle section at bottom left, "Point Size" is what you want to adjust.

      I was wondering this too, by default it was so small I couldn't tell if loading the texture worked right or not.

      • Siver 7 months, 1 week ago  | 

        The visualization of the pattern should be there when used the latest version of Labs, non-production . Further these are guides coming from the HDA.

  • dantarion 7 months, 1 week ago  | 

    I feel like I am doing something wrong. After the wavefunctioncollapse node, the Cd attribute no longer exists on my points. I can see that name gets assigned to 1_1_1 or 0_0_0 but it looks like the wang_tiles_decoder is expecting a Cd attribute.

    I also had an issue where the sample image's jpg compression had some offwhite pixels in it? I'm not sure if user error but would love to finish this tutorial series!

    • dantarion 7 months, 1 week ago  | 

      Fixed my issue by using an attribute copy node to copy the Cd attribute back to the points, matching with the name attribute :D

  • Kvale 7 months, 1 week ago  | 

    If you download the latest "non production build" from github and install Labs manually, the WFC tools has been updated to include visualizer and Cd attrib.

    Github:
    github.com/sideeffects/SideFXLabs

    Install guide:
    www.sidefx.com/tutorials/sidefx-labs-installation/

  • gabhpe 6 months, 3 weeks ago  | 

    Hello Simon.
    Great tutorial!
    Is it possible to use trace psd file, draw a bluepritn of a level, and use it with wang tiles decoder to detect the tiles?
    I am trying to do so but without success.

    • Siver 6 months, 3 weeks ago  | 

      Hey,
      Yes that would be possible. I think you should look how the WFC_Initialize works as this does what you are looking for. It converts an image into points with colors that are used for the Wang decoder.
      In general you can do a WFC_Initialize (this loads the image) then doing a Wang decoder then using the Wang samples to preview.

  • kuimig 6 months, 3 weeks ago  | 

    GJ Simon
    thx for share!

  • DirtPizza 6 months, 3 weeks ago  | 

    Does anyone experience the WFC_Initilize from texture producing not whole numbers on the name attribute like "0.991_0.991_0.991"?

    • Siver 6 months, 3 weeks ago  | 

      Yes, that can happen sometimes. I noticed it as well. What I often do is use the color adjustment node and use the contrast or other sliders to tweak it.

      • DirtPizza 6 months, 3 weeks ago  | 

        Thanks!

  • DirtPizza 6 months, 3 weeks ago  | 

    Is anyone experience Houdini crashes when trying to add Parameters to the HDA?
    As soon as I add the Rows from the WFC_Initilize and hit Apply or Accept I get a crash.

    30984: Fatal error: Segmentation fault
    Saving application data to

    • DirtPizza 6 months, 3 weeks ago  | 

      Caught signal 11

      Traceback from 15056 ThreadId=0x00008b80
      CURRENT THREAD 35712
      +0x17628623 [GA_ATIString::setString] C:\Program Files\Side Effects Software\Houdini 18.0.287\bin\libGA.dll
      +0x176209c4 [GA_ATIString::copyData] C:\Program Files\Side Effects Software\Houdini 18.0.287\bin\libGA.dll
      +0x0d3fcf40 [SOP_AttribTransfer::xferAttribs] C:\Program Files\Side Effects Software\Houdini 18.0.287\bin\libSOP.dll
      +0x0d3ff6df [SOP_AttribTransfer::xferGrpAttribs] C:\Program Files\Side Effects Software\Houdini 18.0.287\bin\libSOP.dll
      +0x0d3f7478 [SOP_AttribTransfer::cookMySop] C:\Program Files\Side Effects Software\Houdini 18.0.287\bin\libSOP.dll
      +0x0d94519d [SOP_Node::cookMe] C:\Program Files\Side Effects Software\Houdini 18.0.287\bin\libSOP.dll
      +0x1807ee0a [OP_OTLOptions::operator!=] C:\Program Files\Side Effects Software\Houdini 18.0.287\bin\libOP.dll
      +0x1808c0bf [OP_Node::cook] C:\Program Files\Side Effects Software\Houdini 18.0.287\bin\libOP.dll
      +0x180aa01b [OP_Node::internalCookInput] C:\Program Files\Side Effects Software\Houdini 18.0.287\bin\libOP.dll
      +0x180aebfa [OP_Node::lockInput] C:\Program Files\Side Effects Software\Houdini 18.0.287\bin\libOP.dll
      +0x0d94ddb0 [SOP_Node::lockInput] C:\Program Files\Side Effects Software\Houdini 18.0.287\bin\libSOP.dll
      +0x17f74f91 [OP_AutoLockInputs::lockInput] C:\Program Files\Side Effects Software\Houdini 18.0.287\bin\libOP.dll
      +0x0d943702 [SOP_Node::cookGuide] C:\Program Files\Side Effects Software\Houdini 18.0.287\bin\libSOP.dll
      +0x0d3480ce [SOP_NodeVerb::cookInputs] C:\Program Files\Side Effects Software\Houdini 18.0.287\bin\libSOP.dll
      +0x0d9454ec [SOP_Node::cookMyselfAsVerb] C:\Program Files\Side Effects Software\Houdini 18.0.287\bin\libSOP.dll
      +0x0d94519d [SOP_Node::cookMe] C:\Program Files\Side Effects Software\Houdini 18.0.287\bin\libSOP.dll
      +0x1807ee0a [OP_OTLOptions::operator!=] C:\Program Files\Side Effects Software\Houdini 18.0.287\bin\libOP.dll
      +0x1808c0bf [OP_Node::cook] C:\Program Files\Side Effects Software\Houdini 18.0.287\bin\libOP.dll
      +0x180aa01b [OP_Node::internalCookInput] C:\Program Files\Side Effects Software\Houdini 18.0.287\bin\libOP.dll
      +0x180aebfa [OP_Node::lockInput] C:\Program Files\Side Effects Software\Houdini 18.0.287\bin\libOP.dll
      +0x0d94ddb0 [SOP_Node::lockInput] C:\Program Files\Side Effects Software\Houdini 18.0.287\bin\libSOP.dll
      +0x0dd06b28 [SOP_Switch::cookMySop] C:\Program Files\Side Effects Software\Houdini 18.0.287\bin\libSOP.dll
      +0x0d94519d [SOP_Node::cookMe] C:\Program Files\Side Effects Software\Houdini 18.0.287\bin\libSOP.dll
      +0x1807ee0a [OP_OTLOptions::operator!=] C:\Program Files\Side Effects Software\Houdini 18.0.287\bin\libOP.dll
      +0x1808c0bf [OP_Node::cook] C:\Program Files\Side Effects Software\Houdini 18.0.287\bin\libOP.dll
      +0x180aa01b [OP_Node::internalCookInput] C:\Program Files\Side Effects Software\Houdini 18.0.287\bin\libOP.dll

      • DirtPizza 6 months, 3 weeks ago  | 

        I narrowed this down to the attribute transfer node at 7:28 in Part 2 video.
        If my display flag is set on that attribute transfer or lower the scene will crash when I click Apply or Accept on the HDA type properties.
        Any ideas?

        • Siver 6 months, 2 weeks ago  | 

          Update your Houdini to another version might help, if you still have a lot of issues contact support.

  • chris rogers2 6 months, 2 weeks ago  | 

    i think the video uses houdini 18.0.391. Im trying to get it to work with 18.0.460, 18.0.416 had a lot of errors and showed nothing, .460 has errors but shows something.
    If 460 doesnt work, ill download 391 and try.

    • chris rogers2 6 months, 2 weeks ago  | 

      18.0.461 works for me (sidefx labs version 460).
      earlier i did get errors but didnt follow the directions, so it might have been user error.
      thanks for the tools and tutorials Simon!

      • DedRed 5 months, 2 weeks ago  | 

        It was broken in 18.0.460 (labs 460) for me as well. Specifically the wang tiles sample came in rotated incorrectly (and inconsistently) when they were copied to points. I updated to the lasted daily build (18.0.496) and it fixed it.

  • gabhpe 6 months, 1 week ago  | 

    Hello Simon.
    Is there a way to instance an actual HDA instead of a prefab?

    • Siver 6 months, 1 week ago  | 

      Hey, There are some options to use another HDA as input but it is limited.
      I recommend baking the hda and use that geometry in the other HDA.

  • dipaolo21 6 months, 1 week ago  | 

    Hello Simon, How did you get the grid to display as Spheres?

    • Siver 6 months ago  | 

      Hey, Do you mean at the WFC nodes? They are now grids instead of spheres

  • Mykman 5 months, 3 weeks ago  | 

    Hi Simon,

    Thanks for the amazing tutorial !
    I have started to have a look how it works and I ran into problems.
    - I can see only the proxy dungeon tiles in houdini and unreal , where can I replace them and how with proper props ?
    - Is there a way to see how the wang sample file content looks like (inside the stash node)? (naming convention / structure etc.)
    If you could help with this that would be awesome !

    • Siver 5 months, 2 weeks ago  | 

      Hey, The project uses the wang nodes as templates. This is a great way to check if the layout is working. Some of the models used in the videos have also a tutorial
      https://www.sidefx.com/tutorials/dungeon-props/
      The idea is that you can use this setup to plug in your own models.

      The wang sample are all stored in the stash, so it loads fast. The wang models itself are controlled by the 'name' attribute found in the primitives attributes.
      These are not random numbers stored in that attribute this is based on the blob tileset patterns. See image here to what each number reference to https://imgur.com/a/FtC68GM
      Use this image as well in the first part of the video to explain a bit more about the wang tiles.

  • chloesun 5 months, 2 weeks ago  | 

    Hey Simon, thanks for the awesome tutorial! I wonder what rules do you need to keep in mind when designing your own modules, especially when thinking about organic shape...also, for now, SideFX labs only have 2d_wfc node developed, is 3d_wfc node/tools WIP?

    • Siver 5 months, 2 weeks ago  | 

      Hey, What I did to make my own tiles is to export the wang tiles and use that as my guides. From there I fill the wang tiles with modular models in game engine. (based on reference or what feel right)

      Further for the 3D_WFC node, I'm not sure if this is currently in development. But definitely request it here https://www.sidefx.com/bugs/submit/ ! (you can submit bugs here or request features)

  • DedRed 5 months, 1 week ago  | 

    There seems to be a bug between the 2d_wavefunctioncollapse and wang_tiles_decoder nodes. When "Allow Rotations" is enabled on the wfc node by the time the wang tiles sample node gets copied to points they come in rotated incorrectly and inconsistently. The main changes I saw in the attributes when turning "Allow Rotations" on and off were in the transform attribute. As a work around I just deleted the transform attribute after the 2d_wavefunctioncollapse node. That seems to solve it, but I don't know if the transform attribute might be useful for anything else using this workflow. Using 18.0.496, labs 496-embedded

  • CYTE 3 weeks, 4 days ago  | 

    Hey Simon, thank you for that great tutorial series! Do you know how one would set up a blueprint communication to the hda inside unreal? I want a new random seed for my level each time the map gets played inside unreal. Any idea on how to do that?

    Cheers
    CYTE

    • Siver 3 weeks, 2 days ago  | 

      The Houdini plugin for Unreal engine is used for editor time only not on playtime. The Houdini helps building your levels faster and save out the result. You can save out multiple maps and load a random map on play.

  • CYTE 3 weeks, 1 day ago  | 

    Thank you for the clarification!

  • alex_posto 14 hours, 22 minutes ago  | 

    Hey Simon, thanks for this amazing tutorial!
    I'm pretty new to Houdini and I was thinking how should I modify this system to support more than one level ? For example I want to build a castle and for this I need to have more than one level so that I can build vertically as well.
    Thanks a lot again! :)

    • alex_posto 14 hours, 20 minutes ago  | 

      I read the comment again and realised is not that clear :/ By "level" I mean vertically stacking stuff on top of another :)

      • Siver 12 hours, 43 minutes ago  | 

        Ideally the WFC node could work in 3D but at the moment it is only working in 2D space. What you can do is look over each floor/grid and in the loop use the WFC nodes and the Wang node to calculate the pieces.

Please log in to leave a comment.