Yogstation 13 - Modules - TypesVar Details - Proc Details

Dungeon Generator

Spawning isn't done in procs to save on overhead on the 60k turfs we're going through.

Vars

area_refThe original area that kicked off the whole generator. Used as a basis for all area based decisions
areas_includedThe area that this generator is working in
closed_turf_typesExpanded list of the types that spawns if the turf is closed
desired_room_countThe number of rooms the random room placement algorithm will attempt to generate when the function is called, unless the function is called with specific arguments otherwise
gen_gurf_onlyIf this is set to TRUE then it will only change turfs that are /turf/open/genturf, for more flexability in design
generated_roomsA list of the room datums generated by the Rust-g algorithm, and stored here
hashThe rng Seed of the generator, randomly chosen between 1 and 1000 when the terrain is generated
heightHeight of the area being generated. Dynamically determined at init by getting the min and max y values
map_subsection_min_room_heightMinimum height of a room generated in a map subsection, walls included. A minimum height of 5 is a 3 tall room with walls on each side. THIS VALUE SHOULD NOT BE LARGER THAN THE map_subsection_min_size!!!!!!!!!!!
map_subsection_min_room_widthMinimum width of a room generated in a map subsection, walls included. A minimum width of 5 is a 3 wide room with walls on each side. THIS VALUE SHOULD NOT BE LARGER THAN THE map_subsection_min_size!!!!!!!!!!!
map_subsection_min_sizeBinary space partition works by cutting the map area in half, then that chunk in half, then that chunk in half, over and over until the next cut would create subsections smaller than the min specified size. so the size can be between the min size, and the min_size*2-1. The number of rooms you get back will be random based on how the algorithm decides to slice
min_xMinimum and Maximum X and Y coordinates, and the Z-level of the area being generated in. Generate_Terrain() will get these values for you automatically
open_turf_typesExpanded list of the types that spawns if the turf is open
owned_mobsAll mobs created by the generator. Either from the base generator or itself or the subsequent rooms created should add their mobs here
probability_room_typesA list of the probability that a type of room theme can be selected. look at mapping.dm in yog defines
room_datum_pathThe path to the corresponding room datum for the generator. If you make a new generator subtype, make a new room subtype to go with it For example if you made:
weighted_closed_turf_typesWeighted list of the types that spawns if the turf is closed
weighted_open_turf_typesWeighted list of the types that spawns if the turf is open
widthWidth of the area being generated. Dynamically determined at init by getting the min and max x values
working_turfsTurfs that the generator can use to generate stuff. As rooms are created, they are deducted from this list so that in the end there is one "main" area left over

Procs

build_dungeonWith the area we're going to be working in paved with the proper tiles, we now begin constructing the actual dungeon
generate_rooms_with_bspReturns a list of rooms using the Binary Space Partition(bsp) algorithm. Binary space gives a pretty even spread of rooms with minimal overlapping by subsecting the area in half, and then that section in half, and that in half, until the next subsequent cut would be smaller than the minimum size. Each of these cuts have minor deviations for randomness, and alternate between vertical and horizontal cuts. Rooms are then generated in those sections of random height and width UP TO the size of the containing section. Rooms may border each other but will never overlap. Since the map area becomes a checkerboard of cuts, area coverage is extremely good
generate_rooms_with_rrpReturns a list of rooms using the Random Room Placement(rrp) algorithm. Random room placement simply generates rooms of random height and width, then selects a random X and Y value to be the bottom left corner of it. The only validation check this algorith performs is if a newly generated room overlaps with an existing room that the algorithm generated previously. If it does, the algorithm will generate a new room and coordinates for it and try again.
parse_rooms_jsonConverts the json list of room objects into a list of
toggle_owned_mob_aiToggle the AI setting of all mobs in the generator. If the assistant starts crying like a child lost in a haunted house, you can turn off the mobs and escort them to their parent.
valid_room_checkDesignate behavior for whether or not you want the rooms kept or discarded here. At base this will just ensure the center of the room falls within the workable area the generator has access to

Var Details

area_ref

The original area that kicked off the whole generator. Used as a basis for all area based decisions

areas_included

The area that this generator is working in

closed_turf_types

Expanded list of the types that spawns if the turf is closed

desired_room_count

The number of rooms the random room placement algorithm will attempt to generate when the function is called, unless the function is called with specific arguments otherwise

gen_gurf_only

If this is set to TRUE then it will only change turfs that are /turf/open/genturf, for more flexability in design

generated_rooms

A list of the room datums generated by the Rust-g algorithm, and stored here

hash

The rng Seed of the generator, randomly chosen between 1 and 1000 when the terrain is generated

height

Height of the area being generated. Dynamically determined at init by getting the min and max y values

map_subsection_min_room_height

Minimum height of a room generated in a map subsection, walls included. A minimum height of 5 is a 3 tall room with walls on each side. THIS VALUE SHOULD NOT BE LARGER THAN THE map_subsection_min_size!!!!!!!!!!!

map_subsection_min_room_width

Minimum width of a room generated in a map subsection, walls included. A minimum width of 5 is a 3 wide room with walls on each side. THIS VALUE SHOULD NOT BE LARGER THAN THE map_subsection_min_size!!!!!!!!!!!

map_subsection_min_size

Binary space partition works by cutting the map area in half, then that chunk in half, then that chunk in half, over and over until the next cut would create subsections smaller than the min specified size. so the size can be between the min size, and the min_size*2-1. The number of rooms you get back will be random based on how the algorithm decides to slice

min_x

Minimum and Maximum X and Y coordinates, and the Z-level of the area being generated in. Generate_Terrain() will get these values for you automatically

open_turf_types

Expanded list of the types that spawns if the turf is open

owned_mobs

All mobs created by the generator. Either from the base generator or itself or the subsequent rooms created should add their mobs here

probability_room_types

A list of the probability that a type of room theme can be selected. look at mapping.dm in yog defines

room_datum_path

The path to the corresponding room datum for the generator. If you make a new generator subtype, make a new room subtype to go with it For example if you made:

You should make:

And set the room_datum_path to that path

weighted_closed_turf_types

Weighted list of the types that spawns if the turf is closed

weighted_open_turf_types

Weighted list of the types that spawns if the turf is open

width

Width of the area being generated. Dynamically determined at init by getting the min and max x values

working_turfs

Turfs that the generator can use to generate stuff. As rooms are created, they are deducted from this list so that in the end there is one "main" area left over

Proc Details

build_dungeon

With the area we're going to be working in paved with the proper tiles, we now begin constructing the actual dungeon

generate_rooms_with_bsp

Returns a list of rooms using the Binary Space Partition(bsp) algorithm. Binary space gives a pretty even spread of rooms with minimal overlapping by subsecting the area in half, and then that section in half, and that in half, until the next subsequent cut would be smaller than the minimum size. Each of these cuts have minor deviations for randomness, and alternate between vertical and horizontal cuts. Rooms are then generated in those sections of random height and width UP TO the size of the containing section. Rooms may border each other but will never overlap. Since the map area becomes a checkerboard of cuts, area coverage is extremely good

generate_rooms_with_rrp

Returns a list of rooms using the Random Room Placement(rrp) algorithm. Random room placement simply generates rooms of random height and width, then selects a random X and Y value to be the bottom left corner of it. The only validation check this algorith performs is if a newly generated room overlaps with an existing room that the algorithm generated previously. If it does, the algorithm will generate a new room and coordinates for it and try again.

parse_rooms_json

Converts the json list of room objects into a list of

toggle_owned_mob_ai

Toggle the AI setting of all mobs in the generator. If the assistant starts crying like a child lost in a haunted house, you can turn off the mobs and escort them to their parent.

For quick refence the commands are:

valid_room_check

Designate behavior for whether or not you want the rooms kept or discarded here. At base this will just ensure the center of the room falls within the workable area the generator has access to