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.
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.
Cutscenedefines 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.
NumScenesdefines 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
Sceneis the number that belongs to the specific scene. This line, conversely, starts a scene block.
NumberOfPicssets 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.
Pic1Nameis 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.
Pic1Hiresdefines 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.
Pic1Durationis 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.
Pic1XCoordis 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.
Pic1YCoordis the Y-axis, or vertical, placement that the picture is on the screen, measured in pixels.
TextXPosis the X-axis, or horizontal, placement that the text block is on the screen, measured in pixels.
TextYPosis the Y-axis, or vertical, placement that the text block is on the screen, measured in pixels.
Musicspecifies 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
D_prefix. For example, if you want the music stored in the lump
O_EXAMPLto 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.
MusicSlotis a deprecated version of the
Musicparameter. It exists only for backwards compatibility and should not be used.
MusicLoopdetermines if the music will loop when changing between scenes. "0" means it won't loop, "1" means it will loop.
FadeInIDdetermines the ID of the screen fade to use at the start of the scene. Defaults to 0 if not defined.
FadeOutIDdetermines the ID of the screen fade to use at the end of the scene. Defaults to 0 if not defined.
FadeColordetermines the palette color number to fade from at the start of the scene. Defaults to 0 if not defined.
SceneTextsets 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:
\AFcontrol the speed of the text displayed at any point within it.
|Code||Characters per frame||Display per second|
||8 : 1||280 characters per second (fastest, default speed when spin is held)|
||7 : 1||245 characters per second|
||6 : 1||210 characters per second|
||5 : 1||175 characters per second|
||4 : 1||140 characters per second|
||3 : 1||105 characters per second|
||2 : 1||70 characters per second|
||1 : 1||35 characters per second|
||1 : 2||~17 characters per second|
||1 : 3||~11 characters per second (default speed)|
||1 : 4||~8 characters per second|
||1 : 5||7 characters per second|
||1 : 6||~6 characters per second|
||1 : 7||5 characters per second|
||1 : 8||~4 characters per second|
||1 : 9||~3 characters per second (slowest speed)|
\D2insert 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
\B0is a 1 frame pause, and every following code makes the pause longer (e.g.:
\B8is 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.
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
IntroToPlayparameter in the
MainCfgblock, 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
PreCutsceneNumto 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
CutsceneNumto 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
CreditsCutsceneparameter in the
MainCfgblock, which should be set to the cutscene that you want to play.
MainCfg CreditsCutscene = 1
Below are examples for typical cutscene setups, each accompanied with a screenshot showing how the cutscene looks in-game.
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 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.
A typical cutscene will have multiple scenes defined. This is what you might find in a cutscene section.
|Sonic Object Configuration||[view]|
|Unlockable content|| |
|Related links||Actions • Constants • Object creation tutorial|