3 min read

A game needs sound, music and video. It has to offer the player attractive background music. It must also generate sounds associated with certain game events. When a spaceship shoots a laser beam, a sound must accompany this action. Reproducing videos showing high-quality previously rendered animations is a good idea during transitions between one stage and the next.

Hear the UFOs coming

So far, we have worked with 3D scenes showing 3D models with textures and different kinds of lights. We took advantage of C# object-oriented capabilities and we animated 3D models and moved the cameras. We have read values from many different input devices and we added physics, artificial intelligence, amazing effects, gauges, statistics, skill levels, environments, and stages. However, the game does not use the speakers at all because there is no background music and there are no in-game sounds. Thus, we have to sort this issue out. Modern games use videos to dazzle the player before starting each new stage. They use amazing sound eff ects and music custom prepared for the game by renowned artists. How can we add videos, music, and sounds in Silverlight?

We can do this by taking advantage of the powerful multimedia classes offered by Silverlight 3. However, as a game uses more multimedia resources than other simpler applications, we must be careful to avoid including unnecessary resources in the files that must be downloaded before starting the application.

Time for action – installing tools to manipulate videos

The 3D digital artists used Blender to create an introductory video showing a high quality rendered animation for five seconds. They took advantage of Blender’s animation creation features, as shown in the following screenshot:

Adding Sound, Music, and Video in 3D Game Development with Microsoft Silverlight 3: Part 1

A spaceship flies in a starry universe for a few seconds. Then, the camera navigates through the stars.

Your project manager wants you to add this video as an introduction to the game. However, as the video file is in AVI (Audio Video Interleave) format and Silverlight 3 does not support this format, you have to convert the video to an appropriate format.

The creation of video animations for a game is very complex and requires specialist skills. We are going to simplify this process by using an existing video.

First, we must download and install an additional tool that will help us in converting an existing video to the most appropriate file formats used in Silverlight 3:

The necessary tools will depend on the applications the digital artists use to create the videos. However, we will be using some tools that will work fine with our examples.

Download one of the following files:

parceApplication’s name

Download link

File name


Expression Encoder 2



It is a commercial tool, but the trial offers a free fully functional version for 30 days. This tool will enable us to encode videos to the appropriate format to use in Silverlight 3.

Expression Encoder 3



It is the newest trial version of the aforementioned commercial tool.

  1. Run the installers and follow the steps to complete the installation wizards.
  2. If you installed Expression Encoder 2, download and install its Service Pack 1.
  3. The download link for it is http://www.microsoft.com/expression/tryit/try-it-v2.aspx#encodersp1 file name—EncoderV2SP1_en.exe.
  4. Once you have installed one of the versions of Expression Encoder, you will be able to load and encode many video files in different file formats, as shown in the following screenshot:
  5. Adding Sound, Music, and Video in 3D Game Development with Microsoft Silverlight 3: Part 1


Please enter your comment!
Please enter your name here