Cutscene

From SRB2 Wiki
(Redirected from Cutscenes)
Jump to navigation Jump to search

SRB2 supports cutscenes that consist of images with overlaid text. SRB2's own intro sequence is such a cutscene, for example. Via SOC, users can create their own cutscenes. They can be used as custom intro or credits sequences, or between levels.

Format

A cutscene section in a SOC consists of two elements: a header and scene blocks. The header defines the number of the cutscene, so it can be easily referenced, as well as the number of scenes it contains. Then, as many scene blocks as were defined in the header will follow. In the scene block itself, the variables for each scene, such as the picture and text to display, are set.

Header

  • Cutscene defines the number of the cutscene. This is the number that you need to reference when implementing the cutscene. There cannot be more than 128 custom cutscenes.
  • NumScenes defines the number of scenes that the cutscene will have. This number should match the number of scene blocks that will follow afterwards. There cannot be more than 128 scenes in a cutscene.
Cutscene 1
NumScenes 1

Scene blocks

  • Scene defines the number of the scene. This line starts a scene block.
  • NumberOfPics sets the number of pictures that exist in the scene. Up to 8 pictures per scene are supported. If a scene consists of multiple pictures, the game will cycle through them one by one, like a slideshow. Each picture is shown for a specific duration before moving on to the next one, until all pictures have been shown.
  • The next section of the scene block defines the parameters for each picture defined in NumberOfPics. The names of the parameters depend on the picture number – for each picture number i, there are five parameters: PiciName, PiciHires, PiciDuration, PiciXCoord and PiciYCord. Below the parameters are explained using picture 1 as an example.
    • Pic1Name is the lump name of the picture used in the scene. The lump referenced must be in Doom Graphics Format; otherwise the game will crash.
    • Pic1Hires defines whether the picture is in high resolution (if set to true or 1) or not (if set to false or 0). Picture placement is based on a 320×200 resolution base screen. A high resolution picture has double the width and height of a normal resolution picture. For example, if a normal resolution picture were to cover up the entire screen, its size would be 320×200. A high resolution version of the picture would be 640×400.
    • Pic1Duration is the amount of time the individual picture will stay on the screen, measured in tics. Remember that 35 tics = 1 second. After the duration is over, either the next picture will be displayed, or the scene ends if there is none. Note that the total length of the scene is based not just on the sum of the individual picture durations, but also on the time it takes to display the scene's text. The scene will end either after all pictures have been displayed or a few seconds after the text has finished displaying, whatever comes first.
    • Pic1XCoord is the X-axis, or horizontal, position of the picture on the screen, measured in pixels. Note that positioning is based on a 320×200 resolution base screen. If the picture's X coordinate is 10, it will be placed 10 pixels to the right of the left border on a 320×200 screen. For higher screen resolutions, the sizes and positions are scaled proportionally, e.g., on a 640×400 screen a picture with an X coordinate of 10 will be placed 20 pixels to the right.
    • Pic1YCoord is the Y-axis, or vertical, position of the picture on the screen, measured in pixels.
  • TextXPos is the X-axis, or horizontal, position of the text block on the screen, measured in pixels.
  • TextYPos is the Y-axis, or vertical, position of the text block on the screen, measured in pixels.
  • Music specifies the name of the music track that is played during the scene. Music tracks are identified by a name consisting of at most six characters, which is the same as name of the lump that stores the music, but without the O_ or D_ prefix. For example, if you want the music stored in the lump O_EXAMPL to be played, set this parameter to EXAMPL. You can either use the music supplied in SRB2 itself or supply a custom music lump. See Sound and music tutorial for an explanation of how to supply custom music, and List of music for a list of music tracks available in SRB2. If this parameter is left out (or set to 0), the music from the previous scene will continue to play – if this scene is the first scene in the cutscene, any music playing will be stopped upon starting the cutscene.
    • MusicSlot is a deprecated version of the Music parameter. It exists only for backwards compatibility and should not be used.
  • MusicPos specifies the position in the scene's music track, given as a time in milliseconds, that the scene will begin playing the track from. If set to 0, the music track will be played from the beginning. Note: This feature only works for music tracks in a format supported by the Game Music Emu library.
  • MusicLoop determines whether the music will loop when changing between scenes (if set to true or 1) or not (if set to false or 0).
  • FadeInID determines the ID of the screen fade to use at the start of the scene. Defaults to 0 if not defined.
  • FadeOutID determines the ID of the screen fade to use at the end of the scene. Defaults to 0 if not defined.
  • FadeColor determines the palette color number to fade from at the start of the scene. Defaults to 0 if not defined.
  • SceneText sets the text that is displayed when the scene is playing. Note that the amount of characters that can be on an individual line are limited by the 320×200 base screen. For large amounts of text, such as an entire paragraph, use line breaks at the appropriate places to simulate text wrapping. To end a block of text, the # character should be used. Custom colors can be freely used in the text, and special characters can be used to control the way it is displayed to the player (see below).
Scene 1
NumberOfPics = 1
Pic1Name = INTRO3
Pic1Hires = true
Pic1Duration = 35
Pic1XCoord = 0
Pic1YCoord = 0
TextXPos = 8
TextYPos = 48
Music = MAPA1M
MusicLoop = true
SceneText = Two months had passed since Dr. Eggman
tried to take over the world using his
ring satellite.
      #

Cutscene text codes

Special characters, usually placed in the text by the hex input codes, can be used to control how the text is displayed. These include:

  • \A0 through \AF control the speed of the text displayed at any point within it.
Code Characters per frame Display per second
\A0 8 : 1 280 characters per second (fastest, default speed when Spin key is held)
\A1 7 : 1 245 characters per second
\A2 6 : 1 210 characters per second
\A3 5 : 1 175 characters per second
\A4 4 : 1 140 characters per second
\A5 3 : 1 105 characters per second
\A6 2 : 1 70 characters per second
\A7 1 : 1 35 characters per second
\A8 1 : 2 ~17 characters per second
\A9 1 : 3 ~11 characters per second (default speed)
\AA 1 : 4 ~8 characters per second
\AB 1 : 5 7 characters per second
\AC 1 : 6 ~6 characters per second
\AD 1 : 7 5 characters per second
\AE 1 : 8 ~4 characters per second
\AF 1 : 9 ~3 characters per second (slowest speed)
  • \B0 through \D2 insert a pause into the text. When a pause character is reached, the game will immediately stop displaying new characters until the specified amount of time has passed. The length of time is defined by the character code, where \B0 is a 1 frame pause, and every following code makes the pause longer (e.g.: \B8 is a 9 frame pause, or about a quarter of a second). The last code allowed is \D2, which inserts a full second (35 frame) pause. Longer pauses can be achieved by placing multiple of these codes back to back. Note that the Spin key's speedup feature will ignore pauses, however.
  • There is a caveat to using these codes: If you use a text speed that outputs more than one character per frame (e.g. \A0), and switch back to a speed that draws one character per n frames (e.g., \A9), multiple characters may be drawn after the speed control code. To avoid this behavior, place a one frame pause (\B0) directly after the speed code.

Implementation

For the cutscene to be played in the game, it must be implemented in some way to define where it will appear. A cutscene can be implemented in one of four ways: as the intro cutscene, before starting a level, after completing a level, or as the credits cutscene.

  • Intro cutscene: A cutscene can be implemented to replace the intro cutscene that plays when SRB2 starts. This is done with the IntroToPlay parameter in the MainCfg block, which should be set to the cutscene that you want to play.
MainCfg
IntroToPlay = 1
  • Pre-level cutscene: A cutscene can be played before a certain level starts. This is an option in the level header. In the map's level header, set PreCutsceneNum to the cutscene that you want to play.
Level 1
PreCutsceneNum = 1
  • Post-level cutscene: A cutscene can be played after a certain level has ended. This is an option in the level header. In the map's level header, set CutsceneNum to the cutscene that you want to play.
Level 1
CutsceneNum = 1
  • Credits cutscene: A cutscene can be implemented to replace the credits cutscene that plays after the main SRB2 game is completed. This is done with the CreditsCutscene parameter in the MainCfg block, which should be set to the cutscene that you want to play.
MainCfg
CreditsCutscene = 1

Examples

Below are examples for typical cutscene setups, each accompanied with a screenshot showing how the cutscene looks in-game.

Textless cutscene

The key to making textless cutscenes is the positioning of the text block. Set TextYPos = 320 so that the vertical positioning of the textbox is outside of the 320×200 resolution base screen. For SceneText, simply use a line break directly after the equal sign and skip directly to the last line.

Cutscene 1
NumScenes 1
Scene 1
NumberOfPics = 1
Pic1Name = INTRO3
Pic1Duration = 210
Pic1XCoord = 0
Pic1YCoord = 0
TextXPos = 1
TextYPos = 320
Music = READ_M
SceneText =
      #

Cutscene with text, single picture

This is what most cutscenes look like: a single picture with accompanying text.

Cutscene 1
NumScenes 1
Scene 1
NumberOfPics = 1
Pic1Name = INTRO6
Pic1Duration = 490
Pic1XCoord = 0
Pic1YCoord = 0
TextXPos = 187
TextYPos = 60
Music = MAP03M
SceneText = Watch out! The
evil doctor is 
back to wreak
havoc upon the 
planet and make
Sonic & Co.'s
lives miserable! 
      #

Cutscene with text, multiple pictures

Using multiple pictures in a scene is especially useful for making pseudo-animations by letting pictures follow each other in quick succession. This example doesn't cover such a use, but it demonstrates the slideshow-like properties of using multiple pictures.

Cutscene 1
NumScenes 1
Scene 1
NumberOfPics = 3
Pic1Name = MAP09P
Pic1Duration = 66
Pic1XCoord = 80
Pic1YCoord = 20
Pic2Name = BRITEGG2
Pic2Duration = 66
Pic2XCoord = 0
Pic2YCoord = 0
Pic3Name = REVENGE
Pic3Hires = true
Pic3Duration = 140
Pic3XCoord = 0
Pic3YCoord = 0
TextXPos = 62
TextYPos = 144
Music = INVINC
SceneText = I'll get you, Eggman,
if it's the last thing I do!
      #

Multi-scene cutscene

A typical cutscene will have multiple scenes defined, such as this one.

Cutscene 1
NumScenes 3
Scene 1
NumberOfPics = 1
Pic1Name = MAP01P
Pic1Duration = 700
Pic1XCoord = 14
Pic1YCoord = 14
TextXPos = 8
TextYPos = 128
Music = RACENT
SceneText = Considering Eggman's invasion has just 
started, the zone is relatively free of
any robots, but that still doesn't mean
you have time to enjoy the lush landscape.
Features waterfalls, hidden caves and
plenty of fauna.
      #
Scene 2
NumberOfPics = 1
Pic1Name = MAP04P
Pic1Duration = 700
Pic1XCoord = 80
Pic1YCoord = 14
TextXPos = 8
TextYPos = 128
SceneText = This was once a beautiful landscape, but
has been mostly tainted by Eggman's
chemical factory, pumping out slime.
The factory was abandoned after his
unsuccessful invasion, but has since
come back to life!
      #
Scene 3
NumberOfPics = 1
Pic1Name = MAP07P
Pic1Duration = 700
Pic1XCoord = 146
Pic1YCoord = 14
TextXPos = 8
TextYPos = 128
SceneText = Sonic, Tails and Knuckles stumble across
some ruins, which have been flooded,
partly by nature and partly by Eggman
digging away for the Chaos Emeralds.
Be wary of water traps which can
threaten to drown you!
      #
  SOC [view]
General ClearMainCfg
Objects ObjectStateSoundSprite2SpriteInfoSprite2InfoFreeslot
Unlockable content EmblemExtraEmblemUnlockableConditionSet
Miscellaneous WipesCharacterLevelCutscene / ScenePromptMenuHudItem
Related links ActionsConstantsCustom Object tutorial