Thing

From SRB2 Wiki
Jump to navigation Jump to search
For Objects, which are sometimes mislabeled as Things, see Object.
A section of a map with a Thing highlighted.

A Thing is a map component that is used to spawn an Object when the map is loaded. Examples include spawn points for players, enemies, rings, monitors and scenery items.

Things are closely related to Objects, but they are not the same. Most Thing types correspond directly to an Object type. For example, a Thing of the type "Crawla" will spawn an Object of the type "Crawla". However, some types of Objects cannot be placed directly on a map via a Thing, such as missiles or shields. Similarly, some Thing types are not directly linked to an Object type. For example, special placement patterns such as the Circle of Rings spawn a group of Objects in a predetermined arrangement rather than just a single Object.

Specification

In the binary map format, the Things of a map are stored in the THINGS lump as a list. Each Thing has a 10-byte entry consisting of the following:

Bytes Data type Description
0–1 Signed 16-bit integer X position
2–3 Signed 16-bit integer Y position
4–5 Signed 16-bit integer Angle
6–7 Unsigned 16-bit integer Lower 12 bits: Type
Upper 4 bits: Parameter
8–9 Signed 16-bit integer Lower 4 bits: Flags
Upper 12 bits: Z position

Thing properties

Thing type

For a list of Thing types, see Thing types.
Zone Builder's Thing properties window. Click to enlarge.

This determines the Thing's type. In the binary map format, it can range from 0 to 4095, whereas UDMF allows Thing type numbers up to 65535. Map editors will usually separate Thing types into different categories using a drop-down list, which makes the Thing placement process easier. They will also display additional properties for a Thing type when selected in the Thing properties window, which are determined by the configuration file loaded for the editor.

X/Y position

These are the absolute X and Y map coordinates the Thing is located at, measured in fracunits. These can be any value from -32768 to 32767. These properties are normally set when a Thing is first placed in the map or dragged around after being placed; however, in Zone Builder and SRB2 Workbench, they can also be changed manually through the Thing properties window.

Z position

For most Thing types, this property is the Z-offset that determines how far up from the floor – or how far down from the ceiling – the Thing is placed, measured in fracunits. For most Thing types, the Z-offset is measured from the floor up by default, but for Thing types that hang from the ceiling by default, such as the Chain, it is measured from the ceiling down. If the Thing's Flip flag is checked, this behavior is inverted – if the offset is usually measured from the floor up, it is now measured from the ceiling down, and vice versa. In the binary map format, the Z position can range from 0 to 4095; UDMF allows Z positions between -32768 and 32767. Thing types that do not use this property directly for determining the Thing's Z-offset (or at all) include the Axis, Axis Transfer, Axis Transfer Line, and the non-customizable Hoop.

Map editors also provide an Absolute option – when the box for this is checked, the Thing's absolute Z position from 0 is determined instead. The map editor will then calculate the required relative Z position automatically, which will be displayed when the Thing properties window is next opened.

Because Doom did not originally support Z-offsets for Things, there is no dedicated Z position field in the binary map format. SRB2 works around this by assigning the upper 12 bits of the 16-bit Flags value to the Z position. As a result, only 4 bits are left for the actual flags, so SRB2 only allows for 4 Thing flags in the binary format. Map editors that are not specifically adapted for SRB2 will not display a field for the Z position. In these editors, the Z position must be set via the Flags value instead; see below for details.

Angle

This property controls the direction the Thing is facing. This is measured relative to the east in a counterclockwise fashion, so 0º is north, 90º is east, 180º is south, and 270º is west. In the binary format, some Thing types (e.g., the Star Post) use this property for additional effects; in these cases it can have any value and might even exceed 360º. Any value within a range of -32768 to 32767 can be used here.

Parameter

This is a special value ranging from 0 to 15 that can determine extra properties for a Thing. Notable Thing types that use this property include various NiGHTS items as well as the Fan Particle Generator and Flame Jets. It is only available in binary maps; UDMF maps have access to the more flexible arguments instead.

The Parameter value is not part of Doom's original map format and was added specifically for SRB2. In the binary map format, it is stored in the upper 4 bits of the Thing's Type value. As a result, the actual Thing type is restricted to 12 bits in binary maps and may therefore only range from 0 and 4095 – unlike in Doom and in UDMF, where it can range from 0 to 65535. Because the Parameter value is SRB2-specific, only map editors that are adapted specifically for SRB2, such as Zone Builder and SRB2 Workbench, provide a field for it. In other map editors, such as the original Doom Builder and SRB2 Doom Builder, it must be set via the Type field – the Parameter value must be multiplied by 4096 and then added to the Thing type number, e.g. ,the Blue Crawla (Thing type 100) with a parameter value of 2 would have a Thing type number of 100 + 2×4096, or 8292.

Flags

These are a series of toggles that may be applied to a Thing to change how the spawned Object behaves. There are currently 5 Thing flags, of which 4 apply to the binary map format, and 2 apply to UDMF. Note that these flags are not the same as Object flags, which determine an Object's properties and cannot be set in the map editor.

In the binary map format, the mathematical total of the corresponding values for the selected flags is given in the Flags value box below the flags list. Note that this value also contains the Thing's Z position, multiplied by 16 – the resulting Flags value is calculated as: Thing flags + Z position×16. This is because SRB2 uses the upper 12 bits of the Flags field to store the Z position. Some Thing types (e.g., the NiGHTS Bumper) use the flags value directly as a parameter; in these cases, the flags and the Z position do not have their usual effects.

The flags, their purposes and availability per map format are given below:

Value Editor name Internal name Binary UDMF Description
1 Extra MTF_EXTRA Yes No This is a special flag that has no general effect but is rather used by certain Thing types for turning on extra features or alternative behavior. These will usually be labeled in Zone Builder.
2 Flip MTF_OBJECTFLIP Yes Yes This flag inverts the Thing's gravity direction, and also inverts whether the Thing's Z position is measured from the floor or ceiling. For instance, power-up monitors will be flipped upside-down and laid on the ceiling instead of the floor, while Things that hang from the ceiling by default (e.g., chains) will be flipped upside-down but laid on the floor instead of the ceiling.

In most cases, this flag will also give the corresponding Object(s) the secondary Object flag MF2_OBJECTFLIP when checked. Exceptions to this include the following Thing types:

4 Special MTF_OBJECTSPECIAL Yes No This is a special flag that has no general effect but is rather used by certain Thing types for turning on extra features or alternative behavior. These will usually be labeled in Zone Builder.
8 Ambush MTF_AMBUSH Yes No This is a special flag that has no general effect but is rather used by certain Thing types for turning on extra features or alternative behavior. These will usually be labeled in Zone Builder.

In binary maps, this flag will also give the corresponding Object(s) the Object flag MF2_AMBUSH when checked. Exceptions to this include the following Thing types:

16 Absolute Z height MTF_ABSOLUTEZ No Yes This flag toggles whether the Thing's Z position is absolute, unaffected by floor or ceiling height. Note that this flag is not available in the binary map format, due to the way it stores a thing's Z position.

Editor metadata

In Zone Builder (for binary maps) and Ultimate Zone Builder (for UDMF maps) it is possible to set custom names and sprites, rename flags and label various other Thing properties through special comments to modify how they appear in the editor. They must be listed as comments within the definition of the corresponding Object, be that in SOC (#) or Lua (-- or //).

Zone Builder

Property Description
$Title or $Name The name of the Thing inside the editor, e.g. $Title Steam Jet.
$Sprite The name of the sprite lump the Thing should use in the editor, e.g. $Sprite STEMD0. Note that the desired sprite lump must also be included in the resources for this to work.
$Category The category this Thing can be found in, e.g. $Category Techno Hill.
$Flags1Text The label for the Extra flag, e.g. $Flags1Text Disable collision.
$Flags4Text The label for the Special flag, e.g. $Flags4Text Continuous.
$Flags8Text The label for the Ambush flag, e.g. $Flags8Text Mute sounds.
$AngleText The label for the Angle value, e.g. $AngleText Radius.
$ParameterText The label for the Parameter, e.g. $ParameterText Order.
$FlagsValueText The label for the "Flags value" textbox.
$Angled or $Arrow Enables the arrow pointing to the direction of the thing's angle.
$NotAngled or $NoArrow Disables the arrow pointing to the direction of the thing's angle.

Ultimate Zone Builder

Property Description
$Title The name of the Thing inside the editor, e.g. $Title Steam Jet.
$Sprite The name of the sprite lump the Thing should use in the editor, e.g. $Sprite STEMD0. Note that the desired sprite lump must also be included in the resources for this to work.
$Category The category this Thing can be found in, e.g. $Category Techno Hill. Subcategories can be created using a backslash: "Enemies/Arid Canyon" will put the actor within the "Arid Canyon" subgroup of the "Enemies" group.
$ArgN Allows the label for an argument to be overridden. N is the argument number, ranging from 0 to 9: e.g. $Arg0. The following $ArgN properties can only be used if this is present.
$ArgNDefault Allows to set the default value for this argument.
$ArgNRenderStyle Allows a visual representation of this argument, drawing the specified shape using the argument's value as a radius. Supported values are Circle and Rectangle.
$ArgNRenderColor Allows to specify a custom color for $ArgNRenderStyle. The color should be specified as an RRGGBB hexadecimal value.
$ArgNToolTip Allows a custom tooltip to be displayed when hovering over the argument label. The newline character \n can be used to format the text.
$ArgNType Restricts the argument to a specific type. See the available types in the Argument types below.
$ArgNEnum If the argument type contains an enum (11, 12 or 26), this is used to specify the enum options or bits/flags. This can be done in two ways:
  • By providing a custom array of enum options. For example, $Arg0Enum { 0="Green"; 1="Red"; 2="Blue";} will show Green, Red and Blue options for the first argument.
  • By using the name of an existing enum. For example, $Arg0Enum yesno will show Yes and No options for the first argument.
$ArgNFlags If the argument type is set to "Enum option + bits/flags" (26), this is used to specify the enum bits/flags. Just like $Arg0Enum, this can use an existing enum or a custom array.
$StringArgN Allows the label for a string argument to be overridden. N is the argument number, ranging from 0 to 1: e.g. $Arg0. The following $StringArgN properties can only be used if this is present.
$StringArgNToolTip Allows a custom tooltip to be displayed when hovering over the string argument label. The newline character \n can be used to format the text.
$WallSprite This thing will be displayed as a papersprite in Visual Mode.
$FlatSprite This thing will be displayed as a floorsprite/splat in Visual Mode.
$SpawnCeiling This thing will be displayed at a height relative to the ceiling instead of the floor in Visual Mode.
$Angled Enables the arrow pointing to the direction of the thing's angle.
$NotAngled Disables the arrow pointing to the direction of the thing's angle.
$Color Allows overriding the category color for this Thing. Possible values range from 0 to 19: see the Color table below.
$IgnoreRenderStyle The Thing's renderstyle setting will be ignored by the editor. This may be useful for viewing invisible Things in Visual Mode.
$ClearArgs Clears any arguments inherited by the game configuration.
$Obsolete Marks this Thing type as obsolete. The Thing will be detected by "Check obsolete things" Map Analysis Mode and will display as such in the Thing Properties window, as well as the Thing Info panel.
$GZDB_SKIP Halts the parser from reading the current script any further. This can be used to skip SOC or Lua scripts that do not contain any Thing definitions.

Argument types

  • 0 = Integer (default)
  • 4 = Action special
  • 5 = Sector effect
  • 8 = Angle in degrees
  • 10 = XXRRGGBB color
  • 11 = Enum option
  • 12 = Enum bits/flags
  • 13 = Sector tag
  • 14 = Thing tag
  • 15 = Linedef tag
  • 22 = Byte angle
  • 23 = Thing Radius
  • 24 = Thing Height
  • 26 = Enum option + bits/flags

Color table

Index Config Name System Name   Index Config Name System Name   Index Config Name System Name   Index Config Name System Name
0 ██ Dark Gray DimGray 5 ██ Magenta DarkViolet 10 ██ Light Green LimeGreen 15 ██ White WhiteSmoke
1 ██ Blue RoyalBlue 6 ██ Brown DarkGoldenrod 11 ██ Light Cyan PaleTurquoise 16 ██ Pink LightPink
2 ██ Green ForestGreen 7 ██ Gray Silver 12 ██ Light Red Tomato 17 ██ Light Orange DarkOrange
3 ██ Cyan LightSeaGreen 8 ██ Light Gray Gray 13 ██ Light Magenta Violet 18 ██ Light Brown (default) DarkKhaki
4 ██ Red Firebrick 9 ██ Light Blue DeepSkyBlue 14 ██ Yellow Yellow 19 ██ Orange Goldenrod

UDMF-only Thing properties

This article or section is incomplete. It doesn't have all of the necessary core information on this topic. Please help the SRB2 Wiki by finishing this article.

Tags

Pitch and roll

Scale

Arguments

See also

  Map components [view]

ThingLinedefSidedefVertexNodeSectorRejectBlockmap