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—installing tools to manipulate scalable digital content


Your cell phone rings. An old friend sees your name in the participants' list and calls you because he has some interesting information. He tells you the game has to scale to huge resolutions such as the ones found in exclusive XHD (eXtreme High Definition) displays. These displays can support resolutions as high as 2560X1600 pixels.

Scaling the raster digital assets is a big problem because pixelation becomes easily visible. If you scale the final alien for using it in a higher resolution, it will look really pixelated as shown in the following picture:

You want the game to use the entire screen space, even in the XHD displays. To make this possible, you could prepare another set of raster digital assets for the game optimized for a 2560X1600 pixels screen (4,096,000 pixels). However, the game can also be run using a 1920X1080 pixels screen (2,073,600 pixels). There is another alternative of creating a new set of scalable vector graphics (vector-based illustrations), which are ready to scale to any screen resolution without generating pixelation problems.

This way, you can provide two versions of the same game—one using raster digital assets optimized for a 1680X1050 pixels screen and the other using scalable vector graphics. There is no restriction in the number of games per participant. Therefore, you can submit both versions.

Note

The creation of scalable vector graphics assets for a 2D game is very complex and involves professional skills. We are going to simplify this process by using the existing clipart.

First, we must download and install some additional tools that will help us in converting the existing scalable vector graphics to the most appropriate file formats to use in Silverlight 3:

Note

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

  1. 1. Download the following files:

    Application name

    Download link

    File name

    Description

    Expression Design

    http://www.microsoft.com/expression/products/Overview.aspx?key=design

    Design_Trial_en.exe

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

    Inkscape

    http://inkscape.org/download/?lang=en

    Inkscape-0.46.win32.exe

    It is a very complete free, open source, vector drawing program. This tool will enable us to import many vector assets in different, popular file formats and export them to a format recognized by Expression Design.

  2. 2. Run the installers and follow the steps to complete the installation wizards.

  3. 3. Once Inkscape's installation is finished, you will be able to load and edit many vector assets in different file formats as shown in the following picture:

What just happened?

We installed Expression Design and Inkscape. Now we have the necessary tools to convert the existing vector clipart to the most appropriate formats to use in Silverlight 3.

XAML works fine with Silverlight 3

Why do we need to install so many tools to create a simple vector asset to use in Silverlight 3? It's because Silverlight 3 uses XAML (eXtensible Application Markup Language), and the best way to add scalable vector content is using objects defined in XAML. However, many tools that offer functions to export to XAML do not work as expected and are not compatible with Silverlight 3. Besides, many converters are still in alpha versions and have problems when we need to convert complex vector art.

The game must be finished on or before the due date. Therefore, to avoid problems related to XAML vector assets, we are going to perform additional steps. But we will be sure that the resulting XAML will work fine with Silverlight 3.