• Advertisement
Sign in to follow this  

Just to share, how to use XNA content in Silverlight

This topic is 3197 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey everyone. I have used XNA for a long time but I have up until now not really played with the possibility of using XNA in a web application. I have been playing with it and I thought I would start a thread and post some of the steps I have done thus far so that if other people wanted to know how to do such a thing they will know :) . To use Silverlight without paying any money you will need to get Visual Web Developer 2008 Express You will also need the Silverlight tools: Silverlight 2 tools Once that is all setup you will need to download a third party library that has wrapped the XNA functionality for use in Silverlight. I have found SilverSprite although I am aware that others exist. SilverSprite can be downloaded from: SilverSprite Once you have that downloaded you make a new project in Visual Web Developer Express. Add the SilverArcade.SilverLight dll as a reference to your project (Not the web project, the one with App.xaml, and Page.xaml). I was then able to follow the instructions on the Silverlight homepage. You need to add all your code to the project (I made a new folder called XNA code) and replace all references to Microsoft.Xna.Framework with SilverArcade.SilverSprite. This is made much easier if you use the handy "Replace in Files" option (Ctrl+Shift+H). One thing that the homepage for SilverSprite does not mention is when adding your xnb files to your project make sure to put them in a folder called "Content". Otherwise the files will not be found. Here is an example of all of this put together: Chaser Web Demo Arrow keys move the player, mouse click makes a new enemy. Get close to the enemy the and the enemy will chase you. If you got any questions feel free to ask. Just thought I would share with you folks :) .

Share this post


Link to post
Share on other sites
Advertisement
Thank you very much for sharing, I will definately give this a try just to see where it ends :)

Share this post


Link to post
Share on other sites
Hey thanks for this, I'm the lead developer on SilverSprite and I just wanted to let you know that now you can use PNG or JPG files directly instead of XNB (you can still use XNB if you want too) and this can significantly reduce the size of the game download.

Bill Reiss

Share this post


Link to post
Share on other sites
That's good to hear :) . It would be kinda neat if there was a C# utility or wizard or something to create a SilverSprite project from an XNA project but maybe I am dreaming heh.

Share this post


Link to post
Share on other sites
That's definitely in our plans, we want to have a project wizard that at least gets you close and does a lot of the heavy lifting for you.

Bill

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement