Anatomy of a Cutscene
The screen is dark and all you hear is the crackling static of a radio receiver in its last throes. Slowly the screen brightens in a classic fade-in to reveal a scene of carnage and destruction. Suddenly, a shadow darts across the screen and the camera moves to follow it. Ominous music pipes in, softly at first, but growing to a crescendo as the camera reaches a breach in the wall. A city street stretches out below, buildings along it lying in ruins and utter devastation. The camera slowly drops to street level and pans around. You hear the sound of heavy, belabored breathing, and the camera swings in the direction of the sound. Suddenly a scream rings out, and the camera lens is splattered with drops of crimson as you hear the sound of a body hitting the pavement. The music peaks just in time to show you a vast, indistinct shape shambling away into an adjacent alley. Words and a logo zoom out onto the screen, but you are cringing at the horror of it all, and for a moment you can't make sense of the words. "ATTACK OF THE KILLER FIENDS", they announce. The scene fades to black but the title remains on the screen. You breathe a sigh of relief as you press the 'ESC' button to bring up the menu. All is safe with the world. It's only a game after all.
Anybody who's played a modern computer or console game has seen one - the ubiquitous cutscene. Used for everything, from providing a story's introduction to filling in pieces of the action that cannot be left to the player to control, cutscenes serve a myriad of purposes. As outlined by the fictitious scenario in the paragraph above, it is used as a means to set up the "back story" and to create the appropriate mood. It can be used for mission briefings, where the player can benefit from basic information about the game and its objectives. It can be used to show the player the effect of his/her actions in a distant, remote part of the game. It can be used to advance the plot, provide clues, and promote character development. Finally, it can be used to provide a dramatic conclusion when the player has successfully completed all objectives. Cutscenes are an important tool in a game-developer's kit, and when used skillfully they can create a dynamic environment in the player's sand-box.
There are two key elements in the creation of a cutscene - aesthetics and mechanics. Aesthetics are, largely, subjective and a matter of taste. Therefore, I'll only provide some basic guidelines on what this constitutes. Or, more accurately, I'll provide some guidelines on what I think it constitutes. Mechanics, on the other hand, are more easily established, and I'll provide step-by-step instructions on how to achieve some common cutscene effects.
A. Aesthetics of a Cutscene
The aesthetics aspect of a cutscene revolves around the mood you wish to create, and your desire to hold the player's interest. Here are some pointers, all of which pertain more to cinematography than map-building:
There are seven common tools you can use in a cutscene, and each of these is already built into ZDooM. As such, you won't need to insert your own resources into your game if you so choose. These tools are:
There are four steps to developing your cutscene [which I have cheesily named the "4P Method"]: Planning, Placement, Programming, Playing. Let me first outline what these steps are and their importance in creating the right effect. After that I'll illustrate with some examples.
2. Placement: Once you've planned out your scene you'll need to begin putting your "pieces on the board". The four main types of pieces are actors, cameras, interpolation points, and patrol points. Use your plan to place your various pieces into the appropriate positions. Keep in mind that you have three dimensions to work with, so make sure you take advantage of height variations, especially for your cameras. For example, during a mission briefing you can start your camera near the ceiling as it faces the principal actor. As the briefing begins the camera could slide down to a few feet above the ground before moving forward to zoom in on the actor. If there are actors that need to be moving (e.g., an enemy or a model) you'll need to position your Patrol Points and Actor Movers.
3. Programming (scripting & specials): If your "pieces" are the automobile, your scripting is the driver of the automobile. It tells the pieces when to start, when and where to move, when to turn, and when to stop. The specific lines of code you use will depend on the nature of the cutscene. In most instances you'll need to "freeze" the player so that s/he is unable to move independently and interfere with the action. Accordingly, you'll need the SetPlayerProperty function. You can "unfreeze" the player later, as appropriate. But until then you will need to begin the process of letting the dominoes fall. The first step in that process is "changing" your camera and activating it using the Thing Activate function. [Optionally, you can fade into the scene using the FadeTo function before you activate the camera.] Finally, you fade back into the scene.
So far, all you've done is changed the scene to a remote camera and activated it. Now you need to trigger the events of your cutscene. If you've set up your first camera to be a moving camera, you'll have also set up your sequence of interpolation points. This, then, becomes a "fire-and-forget" device that proceeds automatically, and does not require further manipulation. Keep in mind that setting up your interpolation points is not a trivial task; distance between points, height of points, angle the point faces, and speed between points [travel time] will all determine how smooth and dynamic your camera movement will be. If you're doing a mission briefing you'll begin displaying the heads up display (HUD) text or begin a sound recording, or both. [You can use ThingSound to start the audio portion of the briefing.] If all you're doing is a "static" mission briefing, where the briefer is stationary, beyond this point you'll simply need to change cameras as appropriate, fade out when the briefing is complete, change cameras back to the player, and unfreeze her/him.
If you are doing a more complex cutscene, such as a battle scene or a fly-by, you'll need to activate your actors in addition to your cameras. Much of the actor behavior will already have been determined in the Planning, and Placement stages of setting up your scene. To move and animate actors, you'll need to use patrol points to designate the path your actors will take. This method is ideal for enemies, non-combatant actors (e.g., scientists), and other things that have animated frames and behavior. If you just want to move an actor without animating it (e.g., a model of a tram that runs on an electrified rails and without wheels) use an actor mover. You can use this method for any type of actor, but if it's not a model the actor will be moved without any of the inherent animation that is part of its normal behavior; use the patrol point method if you need the sprite animations. If it's a model, the actor mover will move it along the path and all the associated animations will work. For example, if your actor is a model of a helicopter, and the model definition includes turning rotor blades, the helicopter will appear to move forward (or backward/upward/downward as you define) while its blades rotate. Finally, if you want events to happen after the cutscene begins, you can script them using ACS. If you want these events to be triggered when the camera reaches a specific point, use Interpolation Specials. For example, you may want music to begin when the camera has reached a specific point. Set up an interpolation special at that point, then use it to trigger a script that starts the music.
4. Playing (testing): Once you've implemented the first three of the 4P steps, you'll need to test your work. In reality, however, you'll probably test the various pieces of your cutscene more-or-less continuously during the development phase. The key things you'll want to make sure of are the following:
Whenever possible, especially whenever the viewing of the the cut-scene is not necessary for the player's advancement within the game, provide the player a means to skip the cut-scene. Watching a cut-scene may be enjoyable the first time, but if a player goes back and plays the map again s/he may not be interested in sitting through it again. There are several ways by which you can allow a player to skip a cutscene. [However, keep in mind that some cutscenes may be required in order to move the action or story along, and it may not be desirable (or even possible) to make these portions skippable.] The method you use to allow players to skip cutscenes will, to some extent, depend on the type of cutscene:
2. Mission Briefings: Mission briefings pose a problem of being (generally) required the first time a game is played, but not necessary after that. One way to give the player the option of accepting the briefing or skipping it, is to create two "paths" before that point. The first path will go to the briefing, while the second path will by-pass it. If the briefing is at the beginning of the game, you can simply present the player with two switches - one for the briefing, one to skip it. If you wanted to make the choice more "realistic", you could have a corridor at the game start that leads to the briefing room (and a sign that says "Briefing Room" could be posted outside). The corridor could branch off at the door, continuing to the rest of the game, thereby not requiring the player to enter the briefing room.
Alternatively, if you wanted the mission briefing to begin automatically, you can silently teleport the player to a remote 64x64 sector after the camera has been activated. The wall that the player faces has an ACS trigger that, when "used", ends the briefing, teleports the player back to her/his original location, and changes the camera back to the players point of view (POV). In this way, the player can exit the briefing at will. [This same effect can be achieved by having the ACS trigger at the player's original location, but the risk is that the player may not activate the trigger during the briefing, but may inadvertently do so afterwards, resulting in unintended consequences. It is possible to nullify the trigger using ACS, and if you are comfortable enough with the use of variables, this method will work just as well for you.]
3. Other Cutscenes: The same method that works for skipping mission briefings after they have started will also work for other types of cutscenes. Simply provide the player with an ACS trigger that will terminate the cutscene and return the player to the game. (G)ZDooM allows even a totally frozen player to "use" switches, etc.
Mission briefings are generally the simplest types of cutscenes to develop. Let's look at the key blocks of code in an example. [Incidentally, this example is from Paranoid, a Half-Life mod for GZDooM.] The first picture below is the scene where the mission briefing occurs. You see the model of the briefer, the desk and other office accoutrements, and the two cameras. The second picture is from the map editor, and it shows the layout of the scene; the notes indicate what each thing is.
Now let's look at the scripting that went into creating the mission briefing:
// Script 11: Mission Briefing & begin game
script 11 (void)
Meanwhile, camera with thing identification (TID) of 255 has been set up as a moving camera at zheight = 152, is bilinear (camera will adjust its angle to match those of the points it passes), and will move to interpolation point with TID = 254. Interpolation point (IP) with TID = 254 has the same x, y, and z coordinates as the camera, is pointing to IP with TID = 253, and has a travel time of 64 tics to that IP, which is at zheight = 128 and slightly forward of the camera start point. This means that, upon being activated, the camera will slowly float down towards the floor before moving forward to the next IP.
SetHUDSize (640, 480, 1);
HUDMessage (s:"Dr. Bellmer, this mission briefing will serve to instruct you\non your primary and secondary objectives.";
HUDMSG_TYPEON | HUDMSG_LOG, 2, CR_GOLD, 30.1, 200.1, 0.5, 0.07, 1.0);
[Remainder of script, see below]
Meanwhile, the camera has moved to its "destination" IP. In this example, the IP is positioned at an actual camera model that the player can see as the POV approaches it. Again, this is simply a device to provide some realism, and is not required.
Admittedly, this is a rather involved mission briefing, and you can achieve the same result without the manipulations described here. However, this example illustrates the richness and diversity of effects that you can employ to create an attractive cutscene. The principles used in this example are virtually the same as those for other, more complex cutscenes. Even though you may use more actors, have more frequent camera changes, or implement more sound & light effects, the toolbox defined in the discussion above will allow you to execute a slick and professional-looking cutscene.