|
| 1 | +/** |
| 2 | + * This proc generates rooms in a specified area of random size and placement. Essential for procedurally generated areas, BSP works by cutting a given area in half, |
| 3 | + * then cutting one of those subsections in half, and repeating this process until a minimum size is reached, then backtracking to other subsections that are not of |
| 4 | + * the minimum size yet. These cuts are offset by small random amounts so that the sections are all varied in size and shape. |
| 5 | + * |
| 6 | + * BSP excels at creating rooms or areas with a relatively even distribution over an area, so there won't be too much blank open area. However if you discard rooms that |
| 7 | + * overlap pre-existing map structures or areas, you may still get blank areas where nothing interesting appears. |
| 8 | + * |
| 9 | + * Return: |
| 10 | + * * a json list of room data to be processed by json_decode in byond and further processed there. |
| 11 | + * |
| 12 | + * Arguments: |
| 13 | + * * width: the width of the area to generate in |
| 14 | + * * height: the height of the area to generate in |
| 15 | + * * hash: the rng seed the generator will use for this instance |
| 16 | + * * map_subsection_min_size: The minimum size of a map subsection. When using this for rooms with walls, the minimum possible square will be a 5x5 room. Barring walls, |
| 17 | + * this will be a 3x3 room. The maximum size will be 9x9, because a further cut could reduce this size beneath the minimum size. |
| 18 | + * * map_subsection_min_room_width: The minimum room width once the subsections are finalized. Room width and height are random between this amount, and the subsection |
| 19 | + * max size |
| 20 | + * * map_subsection_min_room_height: The minimum room height once the subsections are finalized. Room width and height are random between this amount, and the subsection |
| 21 | + * max size |
| 22 | + */ |
| 23 | +#define rustg_bsp_generate(width, height, hash, map_subsection_min_size, map_subsection_min_room_width, map_subsection_min_room_height) \ |
| 24 | + RUSTG_CALL(RUST_G, "bsp_generate")(width, height, hash, map_subsection_min_size, map_subsection_min_room_width, map_subsection_min_room_height) |
0 commit comments