Cutting through Cutscenes

September 30, 2016

One of the benefits of making several games in a series is the opportunity to revise and improve the gameplay mechanisms within the game engine. When I created the first Sleuthhounds computer adventure game I had a list of technical pieces that I wanted to get in such as walking around, talking to other characters, carrying items, and so on. However, there were a number of pieces that I wasn’t able to get around to or didn’t want to tackle at that point for various reasons. Fast forward to the upcoming fourth game in the series, The Halloween Deception, and I’m still knocking items off that list. Probably the biggest outstanding one is the ability to skip cutscenes.

Cutscenes are those parts of a game where control is temporarily taken away from the player so that some animated sequence can play out to progress story, character, or even just to be entertaining or amusing. Some of them can be short, some of them can be long. In traditional point-n-click adventure games like Sleuthhounds, cutscenes are the result of every action a player does. When a player takes an item, the animated sequence showing the item being taken is a cutscene. When the player talks to another character the exchanged dialog is a cutscene.

Developing a game engine that can skip cutscenes, while not difficult, is also not trivial. There are a number of things to consider and a number of special cases that need to be handled so that the game doesn’t get into any sort of “stuck” situation.

I remember when I first played King’s Quest V by Sierra that I was always reluctant to skip cutscenes. It wasn’t because I didn’t want to miss anything shown in those cutscenes – although that certainly was a consideration – but rather it was because for any lengthy cutscene, the game would pop up a rather ominous message:

[Warning: This cartoon contains material that may be necessary for information or clues to complete this game.  Please be sure to check your inventory if you decide to skip.]

Not only did this message display in the game, but in the “talkie” version it was read aloud. This was clearly an important message that the developers wanted to put across. The line about checking the inventory was what made me really nervous about skipping the game’s cutscenes. I took it to mean that if I skipped a cutscene there was a possibility that I would not be given a needed item to finish the game.

When I started thinking about allowing for cutscenes to be skipped in my games, I always remembered that warning from {King’s Quest. I wanted to get one or two games under my belt first before tackling the issue so that I’d be more aware of all the situations that needed to be handled. For example:

  • If a character is walking, then they need to be positioned in the correct end spot if the cutscene is skipped.
  • If an item is given to the player or taken away, then that needs to be reflected in the player’s inventory.
  • If an important piece of information is learned or an important state in the game is changed, then that needs to be properly recorded.
  • If a special animation runs that updates a character’s position, then the character needs to be placed properly when the animation is skipped.

When thinking through the potential parts that could go into a cutscene, those were the most obvious. It was fairly easy dealing with each of those in turn. When skipping a walk, jump to the end of the walk path. When running a special animation, go through each frame without displaying them or waiting between frames, and update character positions based on those animations. And so on.

I implemented a first take at skipping cutscenes fairly early in development of The Halloween Deception. That was actually part of the plan so that I’d have the full development period of the game to test out cutscene skipping and identify any issues I hadn’t initially thought about. And identify them I did.

The first issue I encountered was the scrolling camera I use in the main location of this game. Ordinarily, as the player moves left and right the camera pans across the scene to keep the player character in view. However, in some cutscenes the camera pans to a specific location to show some other action going on.

The camera positioning operates in a separate thread from a regular cutscene run. An awkard analogy is that you have a director directing the actors and a cameraman moving the camera. The director tells the cameraman to move the camera to a certain place and then waits until the cameraman has done so before continuing the rest of the direction.

All well and good as long as were not skipping the cutscene the director is directing. I had forgotten to account for the camera position in my first skipping implementation. So the director decides to skip the scene but he didn’t have any way of telling the cameraman that. The result was that the cutscene would skip up until the camera needed to move. Then the camera would take time to move to the appropriate place before the rest of the cutscene was skipped. Once I found the problem, it was a quick fix to allow for scrolling cameras to be skipped as well.

The second issue I encountered had to do with background characters. In the game, there are a number of characters bobbing for apples or carving pumpkins in the background (remember, it’s a Halloween game). These actions are going on continuously while the player is playing. Just like with the camera moving, each of these background actions is happening in its own thread independent of everything else that’s going on.

A problem arises when a cutscene being skipped involves one of these background characters. The way that cutscenes work in this situation, without considering skipping for the moment, is that the cutscene thread will run until it needs to use a given background character. It then signals to the thread of the background character “when you get to a good stopping point do so, so I can continue on with my cutscene”.

The background characters are set on looping animations. Every time they get to the end of a loop, they check to see if any other thread is waiting for them. So again the cutscene thread is left waiting while it’s trying to skip its cutscene.

This issue required a little more thinking than the camera. After all, there’s only one camera to deal with, but here there are multiple background characters. It was important to be able to have one background character stop immediately for a cutscene being skipped but still allow the other characters not involved in the cutscene to keep going.

It’s taken a little bit of work, and a couple of unforeseen items have come up along the way; however, the ability to skip cutscenes is pretty solid now. I’ll still be doing testing on this right up to the end of development but everything seems fine at the moment. When the new game rolls out, you’ll be able to skip cutscenes. But maybe keep an eye on your inventory afterwards. Just in case. ;-)