Step 8 - Adding Multimedia Content
Video and audio clips and especially background music can strongly enhance the mood and ambience of a game. GameDev has limited support for multimedia effects. Each map may have background music assigned, and any special function may change that music or play its own media clip. You should note, however, that not all systems have equivalent multimedia support. For instance, some systems can play digital audio at the same time as MIDI, but others cannot (in certain circumstances). Also, some systems may not have (for instance) the MPEG Layer 3 WAV Codec installed, meaning that, if you record your WAV files in a certain format, you should make sure that format will be available on the target system.
Select "Media Clips" from the view menu. Media clips are dealt with from two perspectives. On one side, a media clip is created in the project, assigned playback parameters, given a name and associated with a filename. On the other side, an existing clip in the project can be associated with a special function, assigned as the background music, or the background music clip can be re-associated with a different filename in response to a special function.
As of version 1.2, media clips can also be assigned to sprite collisions and player map interactions (tile interactions with the player). These two features are not, however, included in this tutorial. They are very easy to use. Find them on the Collision Definition Dialog and Player Map Interactions tab in the Edit Maps Dialog
So, we will first create and define the media clips that will be available. Find an arbitrary MID file that you would like to use as the background music. MP3 and WAV files would also be supported, depending on installed media player support (GameDev uses quartz.dll -- Microsoft® ActiveMovie -- for media playback). However in this case a small and simple file is preferred. Since many sound cards support playing MIDI and digital audio simultaneously and seamlessly, this is a good choice for background music. I've seen some difficulties in trying to play multiple MP3 files at the same time. If you don't have a suitable MID file, feel free to reference the MID file included with the completed tutorial project.
When you have decided on background music, type the name "BackgroundMusic" into the "Clip name" field. Click the browse ("...") button for the "Media file" field and locate the file you decided on for background music. The path will be stored relative to the project (GDP) file. For this reason it's a good idea to put all files relavent to a project in the same directory. Maps are referred to in the same way, so it's easy to transfer projects from system to system. Check the "Keep loaded" box and the "Play looping" box. The "Keep loaded" box ensures that, if another clip suspends the music in order to play, the music will continue where it left off when it restarts, instead of starting over. Drag the volume slider to an audible level (the top is the loudest). When ready, click the "Add Clip" button to add the media clip to the project.
Now, for our second media clip, if you have a microphone you can record yourself saying "Open Sesame" (or do whatever you think is appropriate for the opening of the passageway in response to the staff). If not, you can use the WAV file that is included with the tutorial. Type the name "OpenSesame" into clip name and browse for the "Open Sesame" WAV file. For this clip, turn off "Keep loaded" and "Play looping" and turn on "Modal" and "Suspend other media to play". Modal will freeze the game while the clip plays and Suspend will stop the music while it plays. This is the safest option for a generic system where you aren't sure that MIDI and digital audio can be played simultaneously. I do suggest "Modal" for this particular clip, however, because the duration of seeing this particular function is quite short, and if the game proceeds while the clip plays, you will probably hear "Open Sesame" after you have already passed through the un-obstructed passageway. Checking the "Suspend" option is up to you. Adjust the volume appropriately for this clip. Click the "Play Clip" button to hear how loud it will be. When done, click "Add Clip" for a total of two media clips in the project.
Now switch to the "Assign Media" tab. Select "TutorialMap" from the Maps list. All the functions on the map will be listed in the "Special Functions" box. Before jumping to there, though, select "BackgroundMusic" as the background music for this map. Now select "OpenSesame1" from the Special Functions list. Click the "Play clip" option and select "OpenSesame" in the "Function media clip" field. These changes take effect immediately.
Those are all the media settings for this tutorial. Save the project (media settings are stored in the GDP file). Try playing the game with the new media clips added to the project. You should have background music, and "Open Sesame" should play when entering the obstructed passageway with the staff.
This concludes step 8 of the GameDev tutorial - Adding Multimedia Content.
Return to the main tutorial page.
Jump to the next step in the tutorial.