Skip to content

Defining a level

wooshrow edited this page Jan 2, 2023 · 9 revisions

Defining a level

Levels in the Lab Recruits environment are specified using comma-seperated .csv files. These can be generated from any spreadsheet program. In this folder you will find some example levels.

Example file in a spreadsheet with conditional formatting

Specification

A level file consists of two elements, the interaction table, and the floors. A level is meant to specify the locations of grid objects with optional parameters and an interaction table that specifies relations between objects. The layout of a level file is as follows:

Interaction table
<NewLine>
Floor 0
<NewLine>
Floor 1
<NewLine>
Floor 2
...
<NewLine>
Floor n

Interaction table

The first sheet should specify the interaction table. The interaction table specifies for each sensor, which actuators are activated when it is pressed. In the game, buttons (either plain or collored) are "sensors". Doors are actuators. So, a button can be interacted to open/close doors connected to it. A Color-button can also be connected to a Color-screen, which will turn the screen to the same color when the button is interacted.

A new line first specifies the sensor, followed by any number of actuators:

[sensor1],[actuator1],[actuator2], ...
[sensor2],[actuator2],[actuator4], ...

For example:

button0,door0,door1,door2
button1,door1

Furthermore, you can also have "NPCs" in a level. An NPC can be made to auto-walk through the level. The route can be specified in the interaction table:

[npc1],[g1],[g2], ...
[npc2],[g4],[g3], ...

Here, npcN refers to the id of an object with an npc tag, and gN the id of waypoints of the walk pattern.

Floors

A grid cell can contain multiple objects, each with multiple optional parameters. Below is a list of all object symbols that can be interpreted as objects.

Fixed placeables

Placeable Symbol
Wall w
Floor f
Ramp r

Use ramps with direction. E.g. r>e will place a stair-case structure facing east, with 45-degree climb. See the examples in HZRDDirect.csv.

Placeables with behavior

Placeable Symbol Description
Character a controllable in-game character (a player)
Door d can open or close
Button b can be toggled, can be connected to zero or more doors
Colorbutton cb can be toggled, can be connected to zero or more colorscreens
Colorscreen cs its color can be changed
NPC npc by game controlled agent (currently it cant do anything but stand still or auto-walk; todo)
NPC waypoint ng npc can be made to auto-travel through a set of waypoints
Goal-flag g can be used to represent an objective for players; give many points
Fire dhf fire hurts characters

Since version 2.2 we also have "monsters" that can hurt the players. Also, since version 2.2, touching a goal-flag with the id "Finish" will mark the game as finished/gameover.

Placeable Symbol Description
Monster m an infected lab-subject

Decoration placeables (have no behavior)

Placeable Symbol
Bookcase bc
Table t
Desk p2
Desk Chair c
Ceiling (with lamp) cl
Ceiling (with exit sign) ce
Wall (with fire extinguisher) wf

An object definition should be immediately followed by the following parameters:

Seperator Values Description
^ Alphanumeric ID, must be unique*
> {n,e,s,w} Rotation in four directions
# (for color-button/cb only) color-code Hexadecimal color-code e.g. 00ff00 for green, optional transparency value

*IDs cannot have the same name as an placeable object, i.e. "w", "f", "cb", etc.

Parameters are parsed in order from the end backwards.

It is suggested to use Excel to edit the files. Example: an environment (image below):

w,w,w
w,f:b^button0,w
w,f:a^agent0,w
w,f:d>s^door0,w
w,f:g^flag0,w
w,w,w