Jump to content

  • Log In with Google      Sign In   
  • Create Account






Silverlight 5 brings XNA 3D to the web

  Posted by Shawn Hargreaves, 05 October 2011 · 500 views

XNA
I have been remiss in not mentioning this on my blog before, but if you are an XNA developer who hasn't been paying attention to Silverlight 5, now might be a good time to start!

A quick history:

  • At the MIX11 conference in April, we announced that Silverlight 5 was adding a new 3D API. This is based on XNA, so included familiar types such as GraphicsDevice, VertexBuffer, and Texture2D, but it was not a full port of XNA. In particular it did not include many of the higher level helper features, so there was no BasicEffect, no SpriteBatch, no math library, and no Content Pipeline. It did support custom shaders, but using a low level DX9 style constant register API as opposed to the friendlier Effect system used by XNA. This beta release made it possible to use high performance 3D in a Silverlight web app, but it wasn't exactly easy to do so!
  • In September, the Silverlight 5 RC added new features including the same five built-in effects as XNA 4.0, plus an XNA compatible math library. David Catuhe writes about these changes.
  • Now, the Silverlight Toolkit provides vastly improved XNA compatibility, including ContentManager, Model, SpriteBatch, Mouse, Keyboard, custom effects, and new Visual Studio templates for getting started with Silverlight 3D. Again David has a great intro.
This is still not all of XNA (for instance there is no Game class) but with this new toolkit, enough pieces are the same that porting existing Xbox or Windows Phone games to the web can be quite easy. It took us just a few hours to port several existing XNA samples, which are included in the toolkit (Toolkit/Sep11/Source/Sample source code.zip):

Posted Image

If you want to use the Content Pipeline in a Silverlight 5 app, you will also need to install XNA Game Studio 4.0 on your development PC. But don't worry, this doesn't mean you will have to redistribute XNA to your web clients, or have it installed on every computer that runs the app. Remember this diagram from an old article about the Content Pipeline:

Posted Image

The way this works with Silverlight 5 is that the blue boxes, which run at build time on your development PC, use the original XNA Game Studio 4.0 Content Pipeline assemblies. Only the red boxes, which execute at runtime on the client machine, use the new code from the Silverlight Toolkit. This is similar to when you build an XNA game for Xbox or Windows Phone, but the remote device is now a web browser. If you are extending the Content Pipeline to add new types, you will need to provide both an XNA version of these types for use at build time, and also a Silverlight version for runtime. Check out the Silverlight port of the Skinning sample for an example of how to set this up.

I don't normally name names, as I'm lucky to work with so many talented people and this blog is my chance to take credit for all their hard work :-) But in this case I want to give a shout out to Aaron Oneal and David Catuhe, who went above and beyond to pull all the pieces together and make this happen. Nice job guys!

http://blogs.msdn.com/aggbug.aspx?PostID=10220948

Source




August 2014 »

S M T W T F S
     12
3456789
10111213141516
171819 20 212223
24252627282930
31      
PARTNERS