I'm trying to create a random map of the dungeon.
There are two rooms, as shown in the image above, and connect them with a two-square-wide aisle.
The starting point, ending point, and bending point of the passage are determined at random.
Add more aisles
When you add a passage after the second time, you pull it without worrying about the passage you drew before, so some of it may overlap or be adjacent to the passage you drew before.
After pulling the passage a couple of times, I want to automatically shape the passage so that the width of the passage becomes 2 squares in any place.
Specifically, I would like to meet the following two conditions.
1. Do not contain 3x3 spaces in the aisle.
2.2 x 2 square characters can go to the right room no matter which exit of the left room.Also, you can go to the left room from any exit of the right room.
Characters of the size of 2x2 squares move one square at a time in the vertical, horizontal, and diagonal directions.
However, you cannot move the topography like the image below to the bottom left ->top right, top right ->bottom left.
What algorithm should I use to shape it?
Additional
Rooms and aisle areas are distinguished.
I'd like to get a rectangular area of the aisle and shape the aisle.
Players are one square in size, but there are one and two enemy characters.
algorithm
Instead of pulling with two, pull with one, and be aware of overlapping when pulling a plurality of passages.
Would it be possible to double the length and width after it is finished?
00000000000000000000000000
0111100000000000000000
0111111111111110000000
0111100000000011111110
0111111111111111111110
0111100000000011111110
0000000000000000000000
00000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000
00111111110000000000000000000000000000000000
00111111110000000000000000000000000000000000
00111111111111111111111111111100000000000000
00111111111111111111111111111100000000000000
00111111110000000000000000001111111111111100
00111111110000000000000000001111111111111100
00111111111111111111111111111111111111111100
00111111111111111111111111111111111111111100
00111111110000000000000000001111111111111100
00111111110000000000000000001111111111111100
00000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000
© 2024 OneMinuteCode. All rights reserved.