Cutscene

From SRB2 Wiki
(Redirected from Cutscenes)
Jump to: navigation, search
Warning icon.png
This article or section should contain one or more images. Please spruce up the article by adding an image.

SRB2 supports cutscenes that consist of images with overlaid text. SRB2 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 an 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 is the number that belongs to the specific scene. This line, conversely, starts a scene block.
  • NumberOfPics sets the number of pictures that exist in the scene. Note that this doesn't actually mean the amount of pictures displayed at one time, as in composites. When multiple pictures are defined, what the game does is cycle through them one by one, like a slideshow. Once Pic1's duration is up, then Pic2 is displayed for its duration. When Pic2's duration is up, Pic3 is displayed, and so on. Below this line exist individual "Picture" blocks, where for each picture exists a set of variables, described below. Each variable works for each picture that is defined; for example, the variable for Pic1's name would be "Pic1Name", Pic2's would be "Pic2Name", Pic3's would be "Pic3Name", and so on.
    • Pic1Name is the lump name of the specific picture used in the scene. The lump referenced must be in either one of two supported graphic formats: XWE calls them "GFX" and "Image". If the lump referenced is not in one of those two formats, the game will crash.
    • Pic1Hires defines whether the picture is of high resolution or not; "0" stands for not hi-res, and "1" stands for hi-res. Cutscene placement is based on a 320×200 screen. A high resolution picture is basically double the resolution it would otherwise be. For example, if a normal picture were to cover up the entire screen, its size would be 320×200. A hi-res 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. The durations of each picture add up together to make up the length of time the scene is on the screen. There is an exception to this rule, however. The game automatically ends a scene a few seconds after the text block is finished displaying text. If the total duration of pictures exceeds that of the time after the text block finishes, the scene will end regardless of the duration. However, if the duration is shorter than the time after the text block finishes, the scene will end with respect to the duration.
    • Pic1XCoord is the X-axis, or horizontal, placement that the picture is 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 left of a 320×200 screen. The appropriate sizes and positions are adjusted for each larger resolution to be proportionate. 640×400, for example, is a double of 320×200, so all sizes and positions are doubled to accommodate the bigger resolution.
    • Pic1YCoord is the Y-axis, or vertical, placement that the picture is on the screen, measured in pixels.
  • TextXPos is the X-axis, or horizontal, placement that the text block is on the screen, measured in pixels.
  • TextYPos is the Y-axis, or vertical, placement that the text block is 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.
  • MusicLoop determines if the music will loop when changing between scenes. "0" means it won't loop, "1" means it will loop.
  • 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 = 1
Pic1Duration = 35
Pic1XCoord = 0
Pic1YCoord = 0
TextXPos = 8
TextYPos = 48
Music = MAPA1M
MusicLoop = 1
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 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. Do 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 =
      #
File:Cutscene example1.png

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! 
      #
File:Example cutscene-text singlepicture.png

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 qucik 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 = 1
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!
      #
File:Example cutscene-text multipicture.gif
(Note: Due to a bug in SRB2, displaying this cutscene in Windowed mode will cause Pic3 to be clipped, being Hi-res. Therefore, the third frame of this image was captured from 640×400 fullscreen and resized.)

Multi-scene cutscene

A typical cutscene will have multiple scenes defined. This is what you might find in a cutscene section.

Cutscene 1
NumScenes 3
Scene 1
NumberOfPics = 1
Pic1Name = MAP01P
Pic1Duration = 512
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 = 512
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! Watch
out for the machines inside the
factory, and the chemical dumping
which is taking place outside.
      #
Scene 3
NumberOfPics = 1
Pic1Name = MAP07P
Pic1Duration = 512
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!
      #
File:Example cutscene-multiscene.gif
  Sonic Object Configuration [view]
General ClearMainCfg
Objects ObjectStateSoundFreeslot
Unlockable content EmblemExtraEmblemUnlockableConditionSet
Miscellaneous WipesCharacterLevelCutscene / SceneHudItem
Related links ActionsConstantsObject creation tutorial