|This article or section should contain one or more images. Please spruce up the article by adding an image.|
The sky is a special effect commonly seen in SRB2 levels, originating from Doom's rendering engine. There are a large selection of skies included in SRB2, which are available for use in custom modifications.
Skies in SRB2 are special textures that are wrapped around the map in a cylindrical fashion to create the illusion of a "sky". Sky textures all have the naming format of
SKYn where n is the "sky number", an integer that can be anything from 0 to 99999 with no leading zeros (though level headers can only use numbers up to 32767). Extended map numbers are not accepted as alternatives for sky numbers above 99 here. The sky number a level uses initially is determined by the
SkyNum parameter in a level header, which then applies the corresponding
SKYn texture as the level's sky on loading it up in-game. Note that sky textures are in fact displayed backwards in-game.
Skies can also be changed dynamically in-game with use of linedef type 423 (Change Sky), the Lua function
P_SetupLevelSky, or otherwise by use of the development mode console command
skynum. However, it is important to note that, being a purely visual effect, a sky can be applied to players either locally or globally:
- When the sky is changed locally for a player, only that player will see the new sky applied to the level from their view; all other players will still be viewing the previous global sky applied (or their own local sky). In Lua, the local sky currently applied is represented by the global variable
- When the sky is changed globally, all players will see the same new sky. The sky initially given via SkyNum in the level header can be considered a globally-set sky, for instance. In Lua, the global sky currently applied is represented by the global variable
F_SKY1 is the name of a special flat used to render the sky above – or sometimes below – sectors. It is not a true flat; while there is a lump named
F_SKY1 in the IWAD, the engine considers it a signal to the renderer that the appropriate sky textures should be rendered where ceiling/floor flats otherwise would be.
Note that, while a map's
SkyNum might for example be 29 (Spring Hill Zone's sky), as defined in the level header, the texture on the sector's ceiling or floor should still be specified as
F_SKY1, and not the corresponding
SKYnn texture: it is the game's responsibility to determine exactly which sky should be rendered. This allows skies to be changed dynamically in the course of a level by means of linedef type 423.
F_SKY1 on their ceilings or floors also cause slightly different rendering behavior for upper or lower textures on adjacent sidedefs, respectively. Since the sky appears to extend infinitely upwards or downwards, upper and lower textures would look out of place. Because of this, they are not rendered even if the sector heights would cause them to be in normal circumstances.
Versions of SRB2 earlier than v2.0 lacked this lump entirely; because of this, many map editors would report that
F_SKY1 was an unknown flat, although it would still behave correctly. v2.0 and later versions include a flat with this name, much like the original Doom games did, effectively ending this error.
Weather is an additional type of special effect that occurs where the sky is applied to the ceiling of a sector, i.e in "outdoor" areas of a map. Weather may involve lighting effects or "precipitation" items that fall from the sky (these are not considered Objects; despite this, however, their attributes are defined in the same way as them).
Weather is applied to a level similarly to skies; the type of weather a level uses initially is determined by the
Weather parameter in a level header. The weather can also be changed dynamically in-game with use of linedef type 424 (Change Weather), the Lua function
P_SwitchWeather, or otherwise by use of the development mode console command
weather. As with skies, weather is applied to players either locally or globally – in Lua local and global weather is represented by the global variables
The full list of weather types in SRB2 is shown below:
||Storm (thunder, lightning and rain)|
||Preloaded precipitation 1|
||Storm (no rain)|
||Storm (no lightning)|
1 Preloaded precipitation is used for keeping the precipitation data in memory without actually displaying any rain or snowflakes. In all versions of the game up to version 2.0, a noticeable pause—around two seconds in length—would occur if the weather is changed directly between "None" and any other option. After version 2.1, this pause no longer occurs, but the option remains for backwards compatibility.
Skyboxes are an alternative form of sky that can be displayed for a map, where instead of just a single texture wrapped around the map, a full 3D environment (including any Objects located within) is visible in areas where sky would normally be seen. The console variable
skybox controls whether or not skyboxes will be displayed in-game. Skyboxes are typically projections of parts of a level inaccessible to the player, shown from the view of a Skybox View Point placed in the desired area to display as the map's skybox. Following from this setup, two types of skybox may be created:
- A static skybox is one that does not move in any horizontal direction regardless of the player's position in the map. This requires only a view point, the Skybox View Point used to display the view of the skybox at all. However, the skybox will still rotate correspondingly with the player's current viewing angle, as well as move the view from the view point vertically relative to its starting Z position and the player's own Z position in the map.
- A moving skybox moves the view point's view with the player horizontally relative to the player's distance from a fixed point in the map. For this to happen, the skybox requires an additional center point or reference point Object – this is simply a second Skybox View Point with the Special flag checked.
The scale of the skybox view's movement speed with the player in any applicable direction is determined by the level header parameter
SkyboxScale; to modify movement speed along a particular axis rather than all,
SkyboxScaleZ are to be used for the X, Y and Z axes respectively. Note that the view point Object itself does not actually move with the player's movement, but rather the view of the skybox relative to its position is moved.
Lua is also capable of switching the view point and/or center point Objects used for displaying the map's skybox with other Objects located in the map, through use of the function
P_SetSkyboxMobj. This function is also capable of applying skybox view/center points to players either locally or globally, as with skies and weather.
Note that only one skybox can be displayed at a time in a map; if the skybox itself uses
F_SKY1 within it, it will simply display the map's assigned sky texture in the normal fashion as the skybox's own "sky".