Skip to content

Class "LevelGenerator"⚓︎

Info

This class gives access to the level generator, the tool that generates a floor.

This class cannot be instanciated. The only way to access it is through callback parameters.

Functions⚓︎

GetAllRooms ()⚓︎

LevelGeneratorRoom[] GetAllRooms ( )⚓︎

Returns a table of LevelGeneratorRoom representing all the rooms that have been generated so far.


GetDeadEnds ()⚓︎

LevelGeneratorRoom[] GetDeadEnds ( )⚓︎

Returns a table of LevelGeneratorRoom representing all the dead end rooms that have been generated so far.


GetNonDeadEnds ()⚓︎

LevelGeneratorRoom[] GetNonDeadEnds ( )⚓︎

Returns a table of LevelGeneratorRoom representing all the non dead end rooms that have been generator so far.


PlaceRoom ()⚓︎

int PlaceRoom ( int Column, int Row, RoomShape Shape, LevelGeneratorRoom Origin )⚓︎

Place a LevelGeneratorRoom object onto the level-grid. The Origin parameter is used as the index of the connecting room. For instance, if you want to place a room on top of the starting room, then Origin can be the starting room of the floor.

The column and row values need to be between 0 and 12 (inclusive).

Returns the GenerationIndex of the placed room. If placement was not possible, returns nil.

Multiple origins

The Origin parameter is used to ensure consistency with the existing rooms. During the generation phase, the game always picks a room and starts placing rooms around it. This parameter reflects this behavior.

When placing a room, you may be wondering which of its neighbors must act as the origin. This has consequences on the placement of special rooms, as the game places special rooms in a specific order based on the distance between each dead end room and the start of the floor. The distance from the start of the floor of the new room is equal to the distance from the start of the floor of Origin plus one. In practice you are free to chose any neighboring room as a point of origin.