MapGenerator

Inherits: RefCounted

Procedurally generates the overworld room grid.

Creates a X-floor × Y-column grid of Room objects with branching paths from Z starting points. Assigns room types by weighted random selection validated through MapRules. The boss room is placed at the center of the top floor.

Properties

Dictionary

random_room_type

{...}

Array[Array]

map_data

MapRules

map_rules

Methods

Array[Array]

generate_map()

Array[Array]

_generate_initial_grid()

Array[int]

_get_random_starting_points()

int

_setup_connections(i: int, j: int)

bool

_would_cross_existing_path(i: int, j: int, room: Room)

void

_setup_boss_room()

void

_setup_room_types()

void

_set_room_randomly(room_to_set: Room)

Room.Type

_get_random_room_type_by_weight()


Property Descriptions

Dictionary random_room_type = {...} 🔗

Weight map for random room type selection (COMBAT, EVENT, CAMP, ELITE).


Array[Array] map_data 🔗

The generated 2D grid of Room objects.


MapRules map_rules 🔗

Rules validator for room type placement.


Method Descriptions

Array[Array] generate_map() 🔗

Entry point: returns a fully generated map_data grid.


Array[Array] _generate_initial_grid() 🔗

Creates a blank 15×7 grid with positioned Room objects.


Array[int] _get_random_starting_points() 🔗

Picks PATHS starting columns (ensuring ≥2 unique).


int _setup_connections(i: int, j: int) 🔗

Connects room at i,j to a random neighbor on the next floor. Returns the column of the connected room.


bool _would_cross_existing_path(i: int, j: int, room: Room) 🔗

Returns true if connecting room would cross an existing path between the current column and its left/right neighbors.


void _setup_boss_room() 🔗

Reroutes all rooms on floor X to the center room of floor Y and marks it BOSS.


void _setup_room_types() 🔗

Assigns COMBAT to floor 0, CAMP to floor 13, and random types (via MapRules) to the rest.


void _set_room_randomly(room_to_set: Room) 🔗

Assigns a random type to room_to_set validated by map_rules.


Room.Type _get_random_room_type_by_weight() 🔗

Returns a Room.Type selected by cumulative weight from random_room_type.