Head-up display
The head-up display (HUD) is a set of screen elements (also known as "HUD items") that are displayed on the top and bottom of the screen while the player is in a level. Its contents depend on the type of level the player is in, but it typically displays information such as the time the player has spent in the level, their score and number of collected rings, their character and number of lives. The position of the items that constitute the HUD on the screen can be changed via SOC or Lua.
Game HUD
The Game HUD is the primary HUD and is the HUD the player will see most when playing SRB2, displaying statistics that are immediately relevant to the gameplay at present. The Game HUD can be toggled on and off with the showhud
console variable (the shortcut key for this is F3), and it can be made translucent with the translucenthud
console variable.
In Single Player and Co-op, the score of the player, the time spent in the level, and the rings collected by the player are displayed in the top left corner, while the name and icon of the character used by the player and the number of lives the player has are displayed in the lower left corner. If the player's ring count is at 0, the "RINGS" element on the HUD will flash red to warn the player of this fact.
In gametypes or level types outside of standard Single Player/Co-op gameplay, extra elements to show additional information may be added to the HUD. Some of the above main elements may also be removed or modified with respect to the gametype/level type being played.
- In gametypes that allow the player to fire rings (Match, Tag, CTF), or when the
ringslinger
cheat is enabled otherwise, a set of icons for the available weapon rings will be displayed at the bottom of the screen. Typically only the red ring's icon will be displayed to start, but if the player has collected the panel for a weapon ring its icon will be visible in this part of the screen. If the player does not have any ammo for a weapon ring currently (or has no rings at all), the icon for it will be faded out. Otherwise, the amount of ammo the player has collected for a weapon ring will be displayed by its icon – if the ammo for a particular weapon is at its maximum limit, the amount will be displayed in yellow instead of white.
- Icons for any Chaos Emeralds the player has collected in Match or CTF will be displayed in the bottom left of the screen (where the player's life icon would be in Single Player/Co-op).
- In addition to the above, the HUD in CTF will also display icons for the red and blue CTF flags. These indicate the current status of both of the flags during the game – for instance, the flag icons as they normally are indicate that they are currently at their respective team bases. If one of the flags has been taken from its base by a player from the enemy team, the icon for it will be struck through to indicate this. Otherwise, if the flag has been dropped by a player after being taken from its base, the icon for it will display a timer to indicate how long it will remain in the level before automatically warping back to the base.
- Tag's HUD additionally may display a timer as well as relevant text depending on the current phase of the game (as well as which team the displayed player is on): during the time the hiders have to find a place to hide from the "IT" player, this displays the time left to hide in seconds; if a time limit is set, the time left to the end of the game in seconds will replace this after the hiding timer has finished.
- If playing in the Race gametype, an lap counter may also be displayed at the bottom right corner of the screen if the level played is a Circuit map.
- In Emerald Hunt levels, an radar will be displayed at the bottom of the screen. This consists of a set of 3 emerald icons; each of these displays a color depending on the distance the player is from the hidden Chaos Emeralds within the level. When the emerald has been collected, the icon for the emerald will no longer display.
- The Emblem Radar unlockable, when unlocked and enabled, has a similar function to the Emerald Hunt radar, but instead displays icons for all Emblems hidden in the level.
First-person mode
If the player is viewing the game through the first-person camera, regardless of the gametype/game mode, the HUD displayed is slightly modified to adjust to this: Characteristic of this form of the HUD is the addition of a crosshair in the center of the screen – the appearance of the crosshair may be adjusted or disabled in the Player Controls menus (Options → Setup Controls → Player 1/2 Controls → Crosshair) or through the crosshair
console variable. Any power-ups the player has collected, such as shields, invincibility and speed sneakers, will be displayed through icons on this HUD, as the player cannot be used as visual indication for the power-ups.
NiGHTS
When a NiGHTS level is being played, the HUD displayed is completely different to the normal HUD: the top left corner shows a chip counter. The top middle displays a timer indicating the seconds left in flying NiGHTS form. The top right corner displays the score obtained in the current mare only. The lower left corner displays the Drill Dash meter, which indicates how much longer the player can sustain the Drill Dash. The bottom middle displays the player's Link.
The chip counter has an arrow pointing to an image of the Ideya Capture and a bar for its remaining health. The arrow will display red if the player's chip count is enough to destroy the Capsule with; when the Capsule has been destroyed, the arrow will stop animating and the Ideya Capture icon will no longer display. The Link is only shown when the player has an active Link, displayed in the form of "n LINK" messages (n being the Link number). The timer and Drill Dash meters are only displayed while in flying NiGHTS form; they're hidden while in 3D free roam mode, as they don't apply there.
When the stage is started, "Get x Chips!" is displayed in the center of the screen (x is the number of chips to be collected to destroy the Ideya Capture). If the player reached the Ideya Capture but only partially destroyed it, "Get x More Chips!" is displayed instead (x is the number of chips to collect to finish destroying the Ideya Capture).
In NiGHTS-style Special Stages, the chip counter and both chip messages will display "Spheres" instead of "Chips", as the player will be collecting blue spheres instead of chips to destoy the Ideya Capture in these.
When recording a replay in NiGHTS Mode, the time spent in the level since the start of the mare will also be displayed in the bottom right corner of the screen, providing an easy reference for obtaining a new time record in the level.
If the level is being played in the Race/Competition gametypes, the normal Score and Time elements will be displayed instead of the ring/capsule section of the NiGHTS HUD.
Multiplayer Special Stages
Multiplayer Special Stages use a similar HUD to NiGHTS levels (see the NiGHTS section above), with three key differences: the sphere counter counts down instead of up and points into a Chaos Emerald instead of an Ideya Capture, the score counter in the top right corner is replaced with a ring counter, displaying how many rings are left in the stage, and the Drill Dash meter and Link are never displayed.
Rankings/Scores HUD
The Rankings/Scores HUD is a secondary HUD that displays any overall statistics and information relevant to the gametype, as well as listing all players present when in multiplayer. This HUD can be accessed by pressing and holding down the Rankings/Scores key defined in the controls, which by default is the Tab key – the Rankings/Scores HUD will remain active on-screen for as long as this key is held down.
Single Player
In Single Player, this HUD displays the Emerald Tokens, Chaos Emeralds, and Emblems collected at present by the player. The total number of Emerald Tokens collected is represented by a token icon alongside the number of tokens. The Chaos Emeralds collected by the player are represented as icons representing each of the 7 Chaos Emeralds, which fills most of the screen in the form of a hexagon shape when complete. The total Emblems collected is displayed alongside an Emblem icon at the center of the screen.
Multiplayer
In multiplayer gametypes, this HUD primarily displays the players currently present within the game itself (i.e not a spectator), along with the scores they have obtained so far or other statistics relevant to the gametype. The name of the gametype currently being played is also displayed in the bottom left corner. In most gametypes there will normally be only a single column of players; if there are more than 9 players the players list is split into two instead. However, in Team Match/CTF the list of players will be divided into their respective teams already. Note that no more than 20 players will be displayed at a time on-screen on this HUD.
The top area of the screen above the player listings is reserved for additional gametype-specific information:
- In Cooperative, this area is reserved for displaying the emeralds collected in the game so far, in addition to the total score obtained by all players combined.
- In Match/Tag/CTF, this area is reserved for displaying the point limit and/or time left in the level, if a point limit or time limit has been set.
- Additionally for Team Match/CTF, the score obtained by both teams is displayed at the center of this area besides the team icons.
- In Circuit levels for Race, this area is reserved for displaying the total number of laps set for the level.
In gametypes with spectators, the names of any spectators in-game will be displayed scrolling along the bottom of the screen, below the lists of players present in-game.
Record Attack/NiGHTS Mode
When watching a Record Attack/NiGHTS Mode replay, the Rankings/Scores HUD will display the score, time and rings obtained through the replay (rings is omitted for NiGHTS Mode replays).
HUD item modification
SOC and Lua allow the positions and video flags of the HUD items to be modified. This is useful when certain graphics that are used in the HUD have been replaced in a modification. The HUD can then be re-arranged to accommodate those graphics.
A HUD item's X
and Y
values are the X-axis/Y-axis coordinates of the HUD item on the screen, measured in pixels. The coordinates 0,0 are the upper left corner of the screen. Note that positioning is based on a 320×200 resolution base screen. If the HUD Item's X coordinate is 10, it will be placed 10 pixels to the right of the upper left corner on a 320×200 screen, and if the pictures Y coordinate is 10, it will be placed 10 pixels below the upper left corner on a 320×200 screen. For larger resolutions, the sizes and positions of the HUD items are adjusted to be proportionate. 640×400, for example, has twice the width and height of 320×200, so both the X and Y position are automatically doubled to accommodate the bigger resolution.
A HUD item's F
value is the HUD item's video flags (use V_*
constants). Common flags include V_SNAPTOTOP
, V_SNAPTOBOTTOM
, V_SNAPTOLEFT
, and V_SNAPTORIGHT
for aligning the HUD item in non-aspect correct resolutions, and V_PERPLAYER
for making the HUD item display for both players in splitscreen mode. Multiple video flags can be combined with |
, e.g. V_SNAPTOLEFT|V_SNAPTOBOTTOM
. Note that some HUD items dynamically receive additional video flags that cannot be removed through SOC or Lua modifications, e.g. V_PERPLAYER
for many player HUD items and either V_HUDTRANS
or V_HUDTRANSHALF
for certain things depending on if the player is spectating.
See the list of HUD items section for a full list of HUD items whose positions and video flags can be modified this way.
SOC definition
The code for changing the position and video flags of a HUD item through SOC follows the following syntax:
HUDITEM name
is the header of each block. name sets the name of the HUD item to be changed, excludingHUD_
. Refer to the table below for the names to be used.X
andY
are the coordinates of the HUD item on a 320×200 screen. See above for more information.F
is the video flags of the HUD item. See above for more information.
Example:
HUDITEM LIVES X = 4 Y = 58 F = V_SNAPTOLEFT|V_SNAPTOTOP
Lua definition
The code for checking or changing the position and video flags of a HUD item through Lua follows the following syntax:
hudinfo[name].property
references the HUD item. name is the name of the HUD item to be changed, includingHUD_
. Refer to the table below for the names to be used. property must bex
,y
, orf
.- If property is
x
ory
, check or set the coordinates of the HUD item on a 320×200 screen. See above for more information. - If property is
f
, check or set the video flags of the HUD item. See above for more information. - HUD item properties can both be checked and set through Lua, like other read+write variables in Lua. See below for examples of both.
Example:
-- Get the Y coordinate of HUD_RINGS
local pos = hudinfo[HUD_RINGS].y
-- Move HUD_LIVES up to be below HUD_RINGS
hudinfo[HUD_LIVES].x = 4
hudinfo[HUD_LIVES].y = pos + 16
hudinfo[HUD_LIVES].f = V_SNAPTOLEFT|V_SNAPTOTOP
List of HUD items
This is a list of the 14 HUD items that can modified by SOC or Lua in SRB2, along with their default coordinates and video flags. Note that most HUD items are "squished" in splitscreen; this is handled automatically by the V_PERPLAYER
video flag.
The following list contains these columns:
- ID: The internal number of the HUD item. You should never use this directly.
- HUD item name: The HUD item's name for use when editing its properties in SOC or Lua.
- Description: A description of how the HUD item is used in-game.
X
: The HUD item's X coordinate; 0 is the left edge, 160 is the center, and 320 is the right edge.Y
: The HUD item's Y coordinate; 0 is the top, 100 is the middle, and 200 is the bottom.F
: The HUD item's default video flags. As mentioned previously, some HUD items dynamically receive additional video flags that cannot be removed through SOC or Lua modifications, but the flags listed here are those that would be the default in SOC or Lua setups.- Graphic: An image depicting what the HUD item might look like.
ID | HUD item name | Description | X |
Y |
F |
Graphic |
---|---|---|---|---|---|---|
0 | HUD_LIVES
|
The character icon, character name, and remaining amount of lives in Single Player and Co-op The character icon and name are still shown even in gametypes that don't have limited lives They are however not displayed in NiGHTS levels nor Multiplayer Special Stages |
16 | 176 | V_SNAPTOLEFT|V_SNAPTOBOTTOM
|
|
1 | HUD_RINGS
|
The yellow "RINGS" text beside the player's ring count in normal stages. Flashes red when the player has no rings | 16 | 42 | V_SNAPTOLEFT|V_SNAPTOTOP
|
|
2 | HUD_RINGSNUM
|
The amount of rings in the player's possession in normal stages Shown when Options > Video Options... > Heads-Up Display > Score/Time/Rings is not set to "Mania" |
96 | 42 | V_SNAPTOLEFT|V_SNAPTOTOP
|
|
3 | HUD_RINGSNUMTICS
|
The amount of rings in the player's possession in normal stages Shown when Options > Video Options... > Heads-Up Display > Score/Time/Rings is set to "Mania" |
120 | 42 | V_SNAPTOLEFT|V_SNAPTOTOP
| |
4 | HUD_SCORE
|
The yellow "SCORE" text in normal stages | 16 | 10 | V_SNAPTOLEFT|V_SNAPTOTOP
|
|
5 | HUD_SCORENUM
|
The player's current score in normal stages | 120 | 10 | V_SNAPTOLEFT|V_SNAPTOTOP
|
|
6 | HUD_TIME
|
The yellow "TIME" text beside the time display in normal stages | 16 | 26 | V_SNAPTOLEFT|V_SNAPTOTOP
|
|
7 | HUD_MINUTES
|
The time display's minute in normal stages Shown when Options > Video Options... > Heads-Up Display > Score/Time/Rings is not set to "Tics" Counts down if there is a time limit (e.g. in Match by default), otherwise counts up |
72 | 26 | V_SNAPTOLEFT|V_SNAPTOTOP
|
|
8 | HUD_TIMECOLON
|
The colon graphic between minutes and seconds in the time display in normal stages Shown when Options > Video Options... > Heads-Up Display > Score/Time/Rings is not set to "Tics" |
72 | 26 | V_SNAPTOLEFT|V_SNAPTOTOP
|
|
9 | HUD_SECONDS
|
The time display's second (or tic if Options > Video Options... > Heads-Up Display > Score/Time/Rings is set to "Tics") in normal stages Counts down if there is a time limit, otherwise counts up |
96 | 26 | V_SNAPTOLEFT|V_SNAPTOTOP
|
|
10 | HUD_TIMETICCOLON
|
The period graphic between seconds and centiseconds in the time display in normal stages Shown when Options > Video Options... > Heads-Up Display > Score/Time/Rings is set to "Centiseconds" or "Mania" |
96 | 26 | V_SNAPTOLEFT|V_SNAPTOTOP
|
|
11 | HUD_TICS
|
The time display's centisecond in normal stages Shown when Options > Video Options... > Heads-Up Display > Score/Time/Rings is set to "Centiseconds" or "Mania" Counts down if there is a time limit, otherwise counts up Note: Despite this HUD item's name, this is not used if that setting is set to "Tics" |
120 | 26 | V_SNAPTOLEFT|V_SNAPTOTOP
|
|
18 | HUD_HUNTPICS
|
The radar in Emerald Hunt levels and when the Emblem Radar unlockable is enabled Extends both left and right if there's more than one Emerald Hunt Location or Emblem in the level, so it's best to place this somewhere centred |
152 | 168 | 0 | |
19 | HUD_POWERUPS
|
The HUD icons for shields and other power-ups, displayed based on Options > Video Options... > Heads-Up Display > Show Powerups (which defaults to first-person only). Note that when the player has multiple powerups, this HUD item will stack leftwards, so it's best to place this on the right side of the screen | 288 | 176 | V_SNAPTORIGHT|V_SNAPTOBOTTOM
|
The ID value in the above table jumped from 11 to 18 for a reason; there are several leftover HUD item definitions from v2.1 which are unused in v2.2. You can still modify them, but doing so has no meaningful impact in-game. If you still wish to see their data (which isn't useful for v2.2), you can expand the below table to view it.
See also
SOC | [view] | |
General | Clear • MainCfg
| |
Objects | Object • State • Sound • Sprite2 • SpriteInfo • Sprite2Info • Freeslot
| |
Unlockable content | Emblem • ExtraEmblem • Unlockable • ConditionSet
| |
Miscellaneous | Wipes • Character • Level • Cutscene / Scene • Prompt • Menu • HudItem
| |
Related links | Actions • Constants • Custom Object tutorial |