Page 1 of 2

Dungeon Generator

Posted: Thu Jul 09, 2015 6:26 am
by LypyL
Current Version: 1.2

https://drive.google.com/file/d/0B8_oQw ... sp=sharing

Setup Instructions:

1. Import as custom package in Unity (Assets > Import Package > Custom Package)

2. Drag the DungeonGenerator prefab into scene

3. Play scene, set parameters as desired and click "Create New Dungeon" (or call CreateDungeon() from code)

Some basics about the settings:

Seed - Leave it at zero to get a random dungeon every time. Otherwise, the resulting dungeon will always be the same for the provided seed.

Number of internal blocks - This doesn't include the root block. So if you set this to zero or below, you will still get a root block (and 4 border blocks), at 1 you will get a root block + 1 internal block and so on

Number of exit blocks - the generator can create dungeons with additional start/exit blocks. The total # of exits can't exceed the # of internal blocks of course. Set to 0 for just 1 dungeon exit like normal.

Min Distance from root - This is a distance you want all your additional exit blocks to be at least from the root block (I'm presuming the root block will be the starting block, and others used as exits, so it's desirable to have some distance between them). The generator will always try and make the start blocks as far away as possible, and will try and brute force generate different layouts for a while until all the starting blocks are at least that far away. There is no guarantee they will be in the end (and it might impossible based on the given settings)

There isn't currently an easy way to get the player object inside of the dungeon. If you want to run around inside a dungeon you generated, the easiest way is to parent the player object to something in the dungeon and set it's position to (0,0,0) for now.

Additional information

http://imgur.com/a/LcqZh

Re: Dungeon Generator

Posted: Fri Jul 10, 2015 5:18 am
by LypyL
Updated to fix some bugs that were causing blocks to be placed incorrectly. Should be working correctly now.

Example of a 30 block dungeon (just counting the internal blocks, I have no idea how many border blocks there were)

Image

Re: Dungeon Generator

Posted: Fri Jul 10, 2015 5:43 am
by Interkarma
That's frickin' awesome... I can't imagine what it would be like to get lost in a dungeon that inconceivably huge. Would definitely need some kind of help to get through it.

I wonder about giving the player an ability to leave chalk-marks on the walls, or maybe a pet guar that leads you to the exit. :D

Re: Dungeon Generator

Posted: Fri Jul 10, 2015 9:08 am
by Nystul
woah! this looks huge

Re: Dungeon Generator

Posted: Fri Jul 10, 2015 9:28 am
by LypyL
Interkarma wrote:That's frickin' awesome... I can't imagine what it would be like to get lost in a dungeon that inconceivably huge. Would definitely need some kind of help to get through it.

I wonder about giving the player an ability to leave chalk-marks on the walls, or maybe a pet guar that leads you to the exit. :D
Or a cyanide pill :lol:

Question - have the required shaders for builds changed with the latest updates?

edit: Also, can you think of a way to find a dungeon (any dungeon) that would use a certain block? In other words, I have a block index / name, and I want to find any dungeons that use that block
Nystul wrote:woah! this looks huge
Yeah, it's far larger than would ever be useful I think, it just made for a good screenshot :lol:

Re: Dungeon Generator

Posted: Fri Jul 10, 2015 10:45 am
by Interkarma
LypyL wrote: Or a cyanide pill :lol:
:lol:
LypyL wrote: Question - have the required shaders for builds changed with the latest updates?
Yep, much shorter list now! The only shaders you need are Standard, DaggerfallBillboardBatch, DaggerfallTilemap.
LypyL wrote: edit: Also, can you think of a way to find a dungeon (any dungeon) that would use a certain block? In other words, I have a block index / name, and I want to find any dungeons that use that block
Sure, just use API to brute-force iterate over the maps. This isn't the most efficient way to do this (takes a minute or two), but it's easy enough to follow.

Code: Select all

const string searchForBlock = "S0000999.RDB";
List<string> mapsContainingBlock = new List<string>();
MapsFile mapsFile = DaggerfallUnity.Instance.ContentReader.MapFileReader;
foreach (string regionName in mapsFile.RegionNames)
{
    DFRegion region = mapsFile.GetRegion(regionName);
    if (region.MapNames == null || region.MapNames.Length == 0)
        continue;

    foreach (string mapName in region.MapNames)
    {
        DFLocation location = mapsFile.GetLocation(regionName, mapName);
        if (location.HasDungeon)
        {
            foreach (var block in location.Dungeon.Blocks)
            {
                if (block.BlockName == searchForBlock)
                    mapsContainingBlock.Add(string.Format("{0}/{1}", regionName, mapName));
            }
        }
    }
}

Re: Dungeon Generator

Posted: Fri Jul 10, 2015 7:38 pm
by LypyL
Interkarma wrote: Snip
Thanks for the info!

Re: Dungeon Generator

Posted: Sat Jul 11, 2015 4:18 am
by Aliem
Jeeze that is a work of art! I'd love to crawl through that beast.
I wonder about giving the player an ability to leave chalk-marks on the walls
That would be awesome, and I would legitimately love to see something like this added!

Re: Dungeon Generator

Posted: Sat Jul 11, 2015 6:44 pm
by LypyL
https://drive.google.com/file/d/0B8_oQw ... sp=sharing

Daggerfall: Descent

Just put a copy of the arena2 directory from Daggerfall into "Daggerfall_Descent_Data" and launch :D



Brakes - Space

Get unstuck - F1

Change Camera - f2

Toggle Free Look - f3

edit: Updated

Re: Dungeon Generator

Posted: Mon Jul 13, 2015 10:19 pm
by Interkarma
LypyL wrote:https://drive.google.com/file/d/0B8_oQw ... sp=sharing

Daggerfall: Descent

Just put a copy of the arena2 directory from Daggerfall into "Daggerfall_Descent_Data" and launch :D

Brakes - Space

Change Camera - f2

Toggle Free Look - f3

edit: Updated
Going to check this out today. :D Will get back to you later and let you know how it goes.