BSP Tree¶
BSP means Binary Space partitioning. It’s an advanced container which parts area into smaller areas randomically.
The algorithm of partitioning is here: http://www.roguebasin.com/index.php?title=Basic_BSP_Dungeon_generation
Properties¶
-
property
display
:
bsp-tree;
Required YES
-
property
body
:
DRAW-OBJ-SELECTOR;
Default null
Link to subareas with draw-obj
-
property
padding
:
INTEGER;
Default 0
Padding between subareas.
-
property
justify
:
JUSTIFY-X, JUSTIFY-Y | center | random;
Default start, start
Align of body element.
-
property
iterations-count
:
INTEGER;
Default 3
How many iterations will be executed to parts area into two smaller areas. Each iteration split each area to two smaller areas (vertically or horizontally). Max number of areas is
(iterations-count - 1) ** 2
where**
is a power operatorIf area is too small to split (with min-width and min-height) then splitting will be stopped.
If iteration is greater than iterations-count and width of area is greater than max-width (or vice-versa with height), then area should split into two areas again.
-
property
min-width
:
INTEGER;
Default 0
If width of subarea (+ padding) is smaller than min-width then splitting will be stopped.
-
property
min-height
:
INTEGER;
Default 0
If height of subarea (+ padding) is smaller than min-height then splitting will be stopped.
-
property
max-width
:
INTEGER;
Default width of subarea
If iteration is greater than iterations-count and width of area if greater than max-width, then area should split into two areas again.
-
property
max-height
:
INTEGER;
Default height of subarea
If iteration is greater than iterations-count and height of area if greater than max-height, then area should split into two areas again.
Example¶
district {
display: bsp-tree;
body: house;
iterations-count: 4;
padding: 10;
justify: center;
width: 500;
depth: 500;
min-width: 100;
min-height: 100;
}
You can try on https://pixelopolis.herokuapp.com/examples/Containers/Bsp-tree