Stairs sometimes go out of bounds

Anonymous 4 years ago updated by Daedalus 4 years ago 15


I have the latest and sometimes get stairs positioned badly and it will not have enough room e.g. it will go through the wall where I cannot reach to go up.

I have tried to make the generation map bigger to help 12x12 map, 5x5 room and 3 rooms to help but ideally I'd like to have smaller rooms or rectangular rooms that work with stairs in all places.

Any ideas of a fix for this?




Hey K Monkey, sorry for the delay, we were about to start having a look at the code, but it seems you were faster :)

We'll test your code and eventually put it in the next update!

Under review

What kind of map/algorithm are you using?


I have tried it on both Recursive and Hunt and Kill with Digging Virtual Map. Happens on both if room size is set to 5x4 and under. So far have not seen it happen when set to 5x5 yet.

You will notice at the top (yellow) the stairs (sci fi prefab) going out of bounds so you cannot go up these stairs

Small update that it eventually did the same with 5x5 room sizes. I was using 5 rooms max and 3 minimum when it happened.

I managed to reduce (eliminate?) the stair problem by making the stairs shorter. I haven't had this bug yet!

However, related to this same issue, the Ladder variation 1 that uses one square at times will place the ladder in an area where the upper floor has no map generated. I think it may be related to sparseness setting?

Also, the ladder at times will generate in front of a door making it a problem (I can only think of putting the stair in the middle of the square it uses but this is not ideal).

Any pointers?


It does not have any kind of tile at all upwards?

That is correct, there is no tile above the ladder variation 1 or a door. It tends to happen when sparseness is used.

Can you please post a shot with all the settings (and most of all the Last Used Seed, so we can reproduce the exact same map)?

I used the sci fi prefab (turned off rocks and perimeter) to demonstrate it.

This is the extreme case but does show that the ladder can appear in the wrong place. The disconnected maps is another thing but wasn't causing my own maps any problems yet :)

Hope this helps

Thank you, we'll investigate the problem.

Thanks, hope you can find out the problem.

Here is another seed with slightly closer settings to what i use in my own maps to help.

I think I found a bug in the MapInterpreter.cs file where you place the Stairs. It seems that the code is looking at the currentMap twice for both floors when it should look at the belowMap instead?

around line 700:

if (!allowStairsCloseToDoors && (currentMap.HasAdjacentDoor(cell_here.location) || currentMap.HasAdjacentDoor(cell_next.location))) continue;

should be:

if (!allowStairsCloseToDoors && (belowMap.HasAdjacentDoor(cell_here.location) || belowMap.HasAdjacentDoor(cell_next.location))) continue;

It seems to have fixed the problem about Stairs sometimes placed in the way of doors but you will know better (i'm not really a coder) :)


Hey K Monkey, sorry for the delay, we were about to start having a look at the code, but it seems you were faster :)

We'll test your code and eventually put it in the next update!

It has worked pretty well since applying that bit of code for the stairs and I have recently been using BSP mapping for a more dungeon look.

I think some future options to "force" ladders or stairs to be in the map would be great as right now it's hit and miss for the stairs and in my game I would prefer it to always have stairs.

Lastly, I couldn't figure out a "nicer" way to fix the ladders blocking doorways issue. I decided to create a collision checker on start and remove all/any doors next to the Ladder in all 4 directions. Ideally, you would do this in your code ;)

Yeah, ladders were designed to be more "generic" (e.g., some way to get up/down to the next floor, for example an elevator). Also, tile size plays an important role to avoid ladders/stairs block doorways. In general, something needs to be done to better handle the situation.

"Force ladder" (in Rooms Only, for example) could be a thing.