Making Dungeons Smaller
Posted: Thu Aug 08, 2019 9:26 pm
I really enjoy Daggerfall Unity. But in my opinion most dungeons are just too big. I want to create a mod making the non main quest dungeons smaller. These dungeons often seem random but are hardcoded in the game files (at least in classic Daggerfall). For this to be possible there need to be a way to generate a dungeon with the appropriate theme (e.g. crypt, mine, laboratory, ...) and matching npcs. I think I remember a early blog post (~2014) where this was already possible.
I imagine things the following way:
Since I'm not sure if a), b), and c) (e.g. different behaviour on .net core) hold for the build-in C# hashCode field I suggest MurmurHash3.
This procedure will guarantee that dungeons are still the same for all people using the same size distribution.
Now before I start I first want some thoughts on my approach. Is there maybe already a mod?
I imagine things the following way:
- Create three integer input fields "small", "medium" and "large" in the mod config for dungeon size
- The values of the fields have to be 100 in sum an represent the probability for a small, medium and large dungeon respectively
- Take the utf8 representation of the English name of the dungeon and calculate its MurmurHash3 32bit
- The resulting 32bit can be interpreted as an integer (lets call it the seed), and will be
- the same on all platforms
- uniformly distributed
- always the same for the same dungeon name
- Taking v:=(seed mod 100) will place the dungeon in one of the size categories (small if v<"small", medium if v<"small"+"medium", large else)
- Use the seed to initalize a Random
- Make a first call to determinate the actual dungeon size in blocks (between 8 and 15 for small, 16 and 24 for medium, and 25 to 32 for large)
- Use the Random to calculate the dungeon and place the npcs, do NOT use this Random for the loot placement
Since I'm not sure if a), b), and c) (e.g. different behaviour on .net core) hold for the build-in C# hashCode field I suggest MurmurHash3.
This procedure will guarantee that dungeons are still the same for all people using the same size distribution.
Now before I start I first want some thoughts on my approach. Is there maybe already a mod?