Book Image

3D Game Development with Microsoft Silverlight 3: Beginner's Guide

By : Gaston C. Hillar
Book Image

3D Game Development with Microsoft Silverlight 3: Beginner's Guide

By: Gaston C. Hillar

Overview of this book

Microsoft Silverlight is a programmable web browser plug-in that enables the animation, vector graphics, and audio-video playback features that characterize Rich Internet Applications. Silverlight is a great (and growing) RIA platform and games are the next level to exploit in it. But it doesn't offer 3D capabilities out of the box and integrating a 3D engine can involve lot of complex mathematics and matrix algebra. This book will help C# developers to get their fingers on the pulse of 3D in Silverlight. This book uses Balder, an open source 3D engine offering 3D capabilities for Silverlight 3. It leaves out boring matrix algebra and complex 3D mathematics. By the end of the book you will have explored the entire engine, and will be able to design and program your own 3D games with ease! The book begins by introducing you to the fundamental concepts of 2D games and then drives you into the 3D world, using easy-to-follow, step-by-step examples. The book employs amazing graphics and impressive performance, and increasingly adds more features to a 3D game giving you a rich interactive experience. By following the practical examples in this book, you will learn the important concepts, from the creation of the initial models, up to the addition of physics and artificial intelligence. The book helps you to provide realistic behaviors for 3D characters by enveloping models with different textures, using lights to create effects, animating multiple 3D characters using a physics engine (Farseer Physics Engine), and simulating real-life physics. Videos, music, and sounds associated with specific events offer the final touches to the 3D game development learning experience.
Table of Contents (21 chapters)
3D Game Development with Microsoft Silverlight 3
Credits
About the Author
Acknowledgement
About the Reviewer
Preface
Pop quiz—Answers

Time for action—testing the scalable digital content using XamlPad


Now, we are going to test how an XAML vector graphic scales using XamlPad:

  1. 1. Open one of the XAML vector graphics exported by Expression Design using Windows Notepad.

  2. 2. Select all of the text and copy it to the clipboard.

  3. 3. Run XamlPad.

  4. 4. Paste the clipboard's content (the XAML definition) in the XAML area. You will see the illustration appearing in the top panel, as shown in the following picture:

  5. 5. Change the zoom many times, taking into account that you can enter manual values. You will see the illustration appearing with different sizes without pixelation problems.

  6. 6. Click on Show/Hide the visual tree. The Visual Tree Explorer and Property Tree Explorer will allow you to navigate through the different components of this scalable XAML vector illustration, as shown in the following picture:

What just happened?

We used a very simple yet handy tool called XamlPad to preview XAML-scalable vector illustrations. Now, we are sure that the scalable clipart for the game is going to work fine in different resolutions. We can include these vector illustrations in Silverlight 3 applications.

Editing vector illustrations using Expression Design

Expression Design is a very useful tool if we need to create special effects with 2D XAML vector graphics. Using this tool, a digital artist can create and manipulate vector graphics. Also, this tool can define a name for each shape. Thus, we can later add some code to change some of the properties of these shapes by using the names to identify them.

For example, we can change an eye's color. However, we need 2D XAML vector graphics that use nice names to identify each shape. The following picture shows Expression Design editing our well-known Halloween monster to provide nice names for the shapes that define the eye's background and background border:

Using expression design, we can also add effects to many shapes and layers. Hence, if we are going to work hard with Silverlight 3, it is a very important tool for the digital artists involved in the project.

Note

Our main goal is to develop games using Silverlight 3. However, it is very important to understand the preparation of digital art assets.

Have a go hero—preparing scalable digital content for a new remake

You have to win the game contest. As you know, there is no restriction on the number of games per participant. What about preparing another completely different game to participate in this contest?

Take a classic game that is based one screen and does not have scrolling capabilities, similar to the Invaders game. Prepare scalable vector graphics in an XAML format to represent its characters. However, this time, prepare some additional animation frames for each character. We will use them in the following chapter to prepare that game using a new framework.

You can do it. If you are not a good artist, you can download free clipart from the Web and then use the techniques and tools previously explained to create vector graphics in XAML format that are ready for use in Silverlight 3 games.