Open nluqo opened 1 year ago
The corridorLength
option seems to be used (only) here: https://github.com/ondras/rot.js/blob/master/src/map/features.ts#L256
At a first glance, the implementation makes sense: whenever the algorithm tries to create a random corridor, it picks its length from the given range.
Can you plese show a full code that demonstrates the wrong behavior? Please note that corridorLength
is supposed to be an array of [minLength, maxLength].
I ran into this a long while ago. If I remember correctly the confusion here is that the corridorLength param is about "corridor sections" in practice, because each corridor can continue in any number of additional corridors. This way you can have an S shaped corridor connecting two rooms, but each section of the S will be at least corridorLength long. Also, there is a good chance you will have 3 corridors facing the same direction (---), resulting in a long, winding hallway.
I ran into this a long while ago. If I remember correctly the confusion here is that the corridorLength param is about "corridor sections" in practice, because each corridor can continue in any number of additional corridors. This way you can have an S shaped corridor connecting two rooms, but each section of the S will be at least corridorLength long. Also, there is a good chance you will have 3 corridors facing the same direction (---), resulting in a long, winding hallway.
Yeah, true. That is the nature of the algorithm: sticking together randomly picked segments until the space is filled.
A better param would be roomDistance I guess, but then the non-straight corridor creation would be more complicated. And that wouldn't be a "true digger mindset" anyway.
In the provided image, I'm just adding {corridorLength:[0,3]}
to the Digger example. The issue is pretty obvious I think and there are clearly corridor sections exceeding the max corridorLength. I suppose it's possible that one straightaway is composed of multiple "sections" each conforming to the maximum length, but then the parameter seems rather pointless.
From a gameplay perspetive, it's just unfortunate that there isn't an out of the box dungeon map generation algorithm that can avoid super long hallways, loops, and dead ends. My personal opinion, but those are usually very disappointing map features for players. I agree that room distance would be helpful, maybe as part of a different provided algorithm if necessary.
Try Uniform instead of Digger. If I remember correctly, Rogue also generated some dead ends for me, but Uniform was fine. Otherwise, you can easily implement an algorithm that fits your needs. I'm happy to help you, if needed.
I suppose it's possible that one straightaway is composed of multiple "sections" each conforming to the maximum length, but then the parameter seems rather pointless.
True. This is exactly what is happening.
Perhaps I'm misunderstanding how this works, but the corridorLength option ROT.Map.Digger seems to do almost nothing.
If I set it to 0, I do get directly connected rooms which is fine. But anything higher produces really long winding, looping, and dead-end hallways. This pretty strongly affects the traversal time between rooms obviously.
https://i.imgur.com/XUBn8Xx.png