Author Topic: Random dungeon generation not random enough?  (Read 2707 times)

0 Members and 1 Guest are viewing this topic.

Mateusz P-G

  • Hero Member
  • *****
  • Posts: 558
  • Polish Translator
    • View Profile
Random dungeon generation not random enough?
« on: May 05, 2013, 02:09:31 AM »
So, we know that the dungeons in Dweller are not fully random
but instead made from a random arrangement of premade rooms.
This is not what I wanted to discuss, however. Read on.

What bothers me is that I get this feeling for quite a while that
the algorithm which selects the rooms is pretty limited if not even
somewhat broken. It seems to be selecting a couple rooms (and
their rotated variants) for the whole level and they tend to repeat
awfully often. It's common to have the same room appear twice
or even 3 times within the same level, while there's plenty more
to chose from. Why?

Also, I'm not sure why the Crypt has an awfull lot of corridors and
super-common "cells with gates" rooms and barely ever uses the
fancy wide halls with statues, altars and church-like benches which
were supposed to add that Catacombs feeling to it.
 :(
« Last Edit: May 05, 2013, 02:19:20 AM by Mateusz P-G »
If you remember the sprites from my avatar, know that you're awesome!

Dweller admin

  • Administrator
  • Hero Member
  • *****
  • Posts: 926
    • View Profile
Re: Random dungeon generation not random enough?
« Reply #1 on: May 05, 2013, 09:36:07 PM »
Hmm, well, each room is assigned a "frequency" and it works the same way as for items. An item with a high frequency is more common than an item with a low value. Also, a room that can be rotated to create two or four variants will be treated as two or four rooms instead of one.

When it comes to the crypts the plain rooms had a frequency of 2 while the special ones had a frequency of 1. I've started by setting the frequency to 1 to all rooms. When it comes to the normal dungeons the plain rooms have a three or four time higher frequency than the special rooms. These number may have to be adjusted, but it's a tedious job!

As to several identical rooms showing up on the same level I really don't know what's going on.

Mateusz P-G

  • Hero Member
  • *****
  • Posts: 558
  • Polish Translator
    • View Profile
Re: Random dungeon generation not random enough?
« Reply #2 on: May 18, 2013, 01:06:54 AM »
Ok, I think I finally understood while some rooms are so rare and others are
very common. It's not because of the rooms' frequency at all. It's the matter
of how the game builds the level layouts.

When checking on how to connect the rooms, the number of exits for each
of them is strictly determined (so that there's no doors leading nowhere).
The algorithm only "wants" to draw at least one passable path around the
dungeon and doesn't "care" about branching out more, and both of these
factors result in most rooms having exactly 2 exits instead of "at least 1"
like I thought earlier.
If you remember the sprites from my avatar, know that you're awesome!

Dweller admin

  • Administrator
  • Hero Member
  • *****
  • Posts: 926
    • View Profile
Re: Random dungeon generation not random enough?
« Reply #3 on: May 22, 2013, 06:38:25 PM »
The algorithm starts by placing a room with four exits in the middle of the map and then starts adding rooms outwards from the starting room. Each time it adds a room it makes sure that any adjacent rooms match up with the exits. Sides of a room adjacent to empty sections on the map are given a 50-50% chance of being given an exit.

Mateusz P-G

  • Hero Member
  • *****
  • Posts: 558
  • Polish Translator
    • View Profile
Re: Random dungeon generation not random enough?
« Reply #4 on: May 22, 2013, 10:26:18 PM »
Sides of a room adjacent to empty sections on the map are given a 50-50% chance of being given an exit.

Doesn't this actually translate to 2-exit rooms being statistically most common, confirming my hypothesis?
 ;)
If you remember the sprites from my avatar, know that you're awesome!