Announcement

Collapse
No announcement yet.

Procedurally Generated caves

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Procedurally Generated caves

    Hi everyone,
    First off, thank you for all the help! I am new to Unreal engine, as well as the Unreal engine forums, so any help is much appreciated. I am trying to procedurally generate a cave using blueprints, and actors and meshes that my team creates. I am testing out the blueprint logic with in game meshes such as couches and lamps (hahahaha).

    Here are the blueprints for my "cave":
    Click image for larger version

Name:	cave_blueprint.jpg
Views:	1
Size:	177.8 KB
ID:	1137418

    My theory to procedurally generating this cave is to have an array named "Walkthrough" filled with all the possible options for cave pieces. I then have a for each loop, and it loops through the array of actors. For each actor it should add a static mesh. I want to use the static meshes that are attached to the cave pieces, but I only figured out how to apply one mesh to all of the pieces. And it had to be a mesh that exists in the original program without any editing. After each piece is created, I attach the next piece to the previous one, and position the pieces.

    Here is my attempt to do the generation using couches instead of cave pieces
    Click image for larger version

Name:	couches.jpg
Views:	1
Size:	197.3 KB
ID:	1137419

    Overview of problems:
    1. I don't know how to get the position of the couches to move through drag and drop. No matter where I spawn the cave blueprint, the couches spawn there
    2. I don't know how to get blueprints to let me use a variety of meshes that I choose, I can only figure out how to pick one mesh that is inherent in the program.

    Any help would be much appreciated. I am open to both tips/solutions to my problems, as well as any other ideas on how to procedurally generate a cave.

    Thanks everyone!

    #2
    I don't know how to get the position of the couches to move through drag and drop. No matter where I spawn the cave blueprint, the couches spawn there
    You'll want to get the transform of the owner actor and then do "Transform By" the location you set on your spawned meshes.

    2. I don't know how to get blueprints to let me use a variety of meshes that I choose, I can only figure out how to pick one mesh that is inherent in the program.
    You'll want to import any meshes you need to use for your generation before hand (so, if you have FBX files for your pieces of the cave, go into the Content Browser and click "Import", then they'll show up like the couch - if you select "Import Materials" it should create the materials for you).
    Storyteller - An immersive VR audiobook player

    Dungeon Survival - WIP First person dungeon crawler with a focus on survival and environmental gameplay ala roguelikes

    Comment


      #3
      Thanks! And is there an option to let me pick more than one mesh? I want each cave piece to have a different mesh

      Comment


        #4
        Originally posted by ftblms65 View Post
        Thanks! And is there an option to let me pick more than one mesh? I want each cave piece to have a different mesh
        Switch on Enum with each output leading to a different mesh. I suggest creating an Enum asset over using Switch on Int since you can name each remember in the Enum which makes it much easier to remember what leads to what.
        Map Generator 1.0
        Map Generator 2.0
        Map Generator 3.0

        Comment


          #5
          Thanks, I think I am slowly understanding.

          Here is my new blueprint:
          Click image for larger version

Name:	cave_two_blueprint.jpg
Views:	1
Size:	195.0 KB
ID:	1053620

          Is there any way to use an Enum array and have a random enum from the list picked to use as the value? I.E. instead of connecting "glass door" to "switch on enum" I would connect an enum array and somehow pick a random value out of the array.

          Comment


            #6
            Solved it, thanks for all the help guys!!!

            Comment


              #7
              Originally posted by Zeustiak View Post
              Switch on Enum with each output leading to a different mesh. I suggest creating an Enum asset over using Switch on Int since you can name each remember in the Enum which makes it much easier to remember what leads to what.
              Alternatively, you could have an array with all the meshes and call a random mesh by plugging a random int into the "get" node.
              DO contact me with questions about Blueprint or other Unreal features! I don't bite! Or charge money! Just press that blue Skype button and fire away.

              Project Culverin - Open Ended First Person Shooter

              Comment

              Working...
              X