BenPyton/ProceduralDungeon

[BUG] Dungeon Generator spawns extra floors.

DuckJohnn opened this issue · 3 comments

Bug Description
Hello. I'm trying to make dungeon game, where rooms and floors to those spawns randomly. Spawning random floors on rooms works fine, but generator spawns some extra floors around the area for some reason. These random floors spawns inside these "Room" levels (check level blueprint for each room), but those unwanted extra floors spawns in groups, even if "Event BeginPlay" to "SpawnActor" from every room(level) blueprint is disconnected. These extra rooms are invisible, but those have collision.

To see this bug:

  1. Open level: "LevelLoader"
  2. Press > (Play)
  3. Wait for the dungeon to load
  4. Press F8 to change to free camera
  5. Go above the game area
  6. Press: "alt+c" to see collisions

Screenshots
https://prnt.sc/RrvAGLcAFOdT
https://prnt.sc/k8f-L8_MqU_M

Here is link for project:
https://drive.google.com/file/d/13YWzstl4K6w6dJiIuI7nndWgUIF6_XEm/view?usp=sharing

Technical informations

  • OS: [Windows 10]
  • Unreal: [4.27.2]
  • Plugin Version: [e.g. 2.0.1]

Hi DuckJohnn,

Your issue is not the plugin's fault : you've just forgot some floors that you placed (maybe by mistake?) in your Room4 (see screenshot below).
image

Also, even if it's not related to your issue, I recommend to you to spawn your floors with no collision check, so they will never be misplaced at runtime.
image

Wow. How didn't I see that? Maybe, because room was very dark. Now it works. Thanks, but I still have a problems.
Sometimes rooms leads to empty areas, or other rooms without other having door connection.

Maybe, because room was very dark.

Yes, because you didn't place any light in it. You have 2 possibilities when designing your rooms :

  • You can place the room level in the master level to get the lighting from it, and design your room from there (it is interesting to do this if the lighting in the master level is important for the room design). ⚠️ Make sure you are editing the right level ! (by making the room level active in the levels window)
  • You open directly the room level (with no light yet) but you turn the preview to Unlit isntead of Lit, so you can see the meshes.

However, it is important to add some lights in your rooms, for the player to see (if the rooms are completely closed for example, with a roof and no windows).

Sometimes rooms leads to empty areas, or other rooms without other having door connection.

I think I don't understand very well what your saying...
Do you say there are doors (blue boxes) not leading to other room?

If this is what you mean, then you have some solutions (but not only those) :

  • You can place a wall instead of a door (like in the example of the wiki) and the wall mesh could fit the room's wall so the player can't guess there should be a door here.
  • You can make enough rooms with only 1 door (or make greater probability to spawn a room with 1 door) and let the generation ends "naturally" (no unconnected door left) so you don't have unconnected doors. However you don't have anymore the control of how many rooms will be generated and the dungeon can be very big.
  • You can make more complexe rules in your ChooseNextRoomData so, for example, you can automatically place only 1-door rooms after a certain amount of rooms generated.

But keep in mind you can also come with another solution, it only depends on what you want your dungeon to be 😉.

I hope those small tips will help you somehow 🙂