Rex's plugins for Construct2
  • Home
  • Map
  • Tutorial/Templates
  • News
  • About

rex_dungeon_gen

Plugin, ACE table, Discussion thread
Dependence: None

Introduction
Generate random dungeon map which composed of walls, rooms, and corridors asynchronously. Reference: rot.js

Usage
Sample
Generate map
Call one of these actions under "Map - Generate" category to create a new random map asynchronously in a webworker.
  • Action:Digger
  • Action:Uniform
  • Action:Rogue
"Condition:On completed" will be triggered while generating completed. "Condition:Is generating" will return true while generating.

Types of tile
There are 2 possible raw symbols of each tile -
  • 0 : empty space
  • 1 : wall
Empty space (0)
Empty space could be subdivided into "room space", "corridor", or "door".
  • Room space : current empty space tile is in a room.
  • Corridor : current empty space tile is not in a room, and all neighbors are not room spaces.
  • Door : current empty space tile is not in a room, and one or more neighbors are room spaces. i.e. a corridor which connects to a room.
Wall (1)
Wall could be subdivided into "border wall", or "filled wall"
  • Border wall : current wall is beside any empty space in 8 directions.
  • Filled wall : current wall is not a border wall. This kind of tile could be ignored while creating.
Type of corridor
A corridor could be subdivided into
  • Dead end : it has 1 corridor neighbor only
  • L-junction : it has 2 corridor neighbors, and they are arranged in a  L-shape
  • I-junction : it has 2 corridor neighbors, and they are arranged in a line
  • T-junction : it has 3 corridor neighbors
  • X-junction : it has 4 corridor neighbors
according to the neighbors of this corridor.
Retrieve the map
Gets raw symbol value of a specific tile back by "Expression:ValueAt" in logic ( X, Y)
  • 0 = empty space
  • 1 = wall
  • (-1) = invalid ( out of map )
Or uses "Condition:Tile type" to classify a specific tile into one of types in logic ( X, Y). There are 6 possible types
  • Filled wall
  • Border wall
  • Room space
  • Corridor
  • Door
  • Invalid ( out of map )
The size of map could be read by "Expression:MapWidth", "Expression:MapHeight".
Moreover, uses "Condition:Corridor type" to classify a specific corridor in logic ( X, Y).

Retrieve rooms
Designer could retrieve rooms in a for each condition, or by room index.
Retrieve rooms in a for each condition
Boundaries of each room could be retrieved by "Condition:For each room".
Get boundaries of the retrieved room in these expressions -
  • Expression:CurRoomLeft
  • Expression:CurRoomRight
  • Expression:CurRoomTop
  • Expression:CurRoomBottom
and the center of position of this room in these expressions -
  • Expression:CurRoomCenterX
  • Expression:CurRoomCenterY
and the size of this room -
  • Expression:CurRoomWidth
  • Expression:CurRoomHeight
The index of retrieved room is "Expression:CurRoomIndex".
Retrieve room by index
The amount of rooms could be got by "Expression:RoomsCount".
Get index of room in a specific logic position by "Expression:LXY2RoomIndex( x, y )".
Get boundaries of a specific room by index in these expressions -
  • Expression:RoomLeft ( index )
  • Expression:RoomRight ( index )
  • Expression:RoomTop ( index )
  • Expression:RoomBottom (index )
and the center of position of this room in these expressions -
  • Expression:RoomCenterX ( index )
  • Expression:RoomCenterY ( index )
and the size of this room -
  • Expression:RoomWidth ( index )
  • Expression:RoomHeight ( index )

Cancel
Call "Action:Cancel" to cancel maze generating.
Release
Call "Action:Release" to release current maze in memory.

Official save/load
This plugin supports official save/load.

And more...
Uses rex_eventbalancer plugin + rex_loopiterator plugin to create tiles in multi-ticks, and rex_board_squareTx plugin to get the position of each tile. rex_board_squareTx plugin could support orthogonal or isometric map.

Create a free web site with Weebly
  • Home
  • Map
  • Tutorial/Templates
  • News
  • About