Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

corridorLength max doesn't seem to be respected #211

Open
nluqo opened this issue Mar 7, 2023 · 7 comments
Open

corridorLength max doesn't seem to be respected #211

nluqo opened this issue Mar 7, 2023 · 7 comments

Comments

@nluqo
Copy link
Contributor

nluqo commented Mar 7, 2023

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

@ondras
Copy link
Owner

ondras commented Mar 9, 2023

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].

@kosinaz
Copy link
Contributor

kosinaz commented Mar 9, 2023

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.

@ondras
Copy link
Owner

ondras commented Mar 9, 2023

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.

@kosinaz
Copy link
Contributor

kosinaz commented Mar 9, 2023

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.

@nluqo
Copy link
Contributor Author

nluqo commented Mar 12, 2023

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.

@kosinaz
Copy link
Contributor

kosinaz commented Mar 12, 2023

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.

@ondras
Copy link
Owner

ondras commented Mar 12, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants