Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Optimize loading an XAP file with an asp.net website

I've been developing a game using Silverlight 4 and silversprite (http://silversprite.codeplex.com/)

This game is HEAVILY content dependent, using a lot of audio and images. My content folder is around 90 mbs worth of stuff. And because of that, my XAP file is around 60 MB, and takes 5 minutes to download from the website before any user can start playing.

I am using Visual Web Developer 2010 to create my site and load the XAP. Is there a way where I can take content out of my XAP and put it in my ASP.net site project? Or perhaps upload my content files to the site's storage? This would make my XAP file much quicker to download.

Anyone have suggestions? Thanks!

like image 960
theoneawaited Avatar asked Jun 10 '10 13:06

theoneawaited


2 Answers

Yes, include in your XAP only content you need for the initial screen. Place other content you need in other XAPs (if you need to and understand the manifest xml) or just plain zip files would do. Perhaps a Zip for each "Level" or whatever.

You can download the Zip with WebClient and then use StreamResourceInfo and Application.GetResourceStream to access content in the zip file.

This blog although aging a little now still carries the basic idea and is still fundementally the current technique to use.

like image 170
AnthonyWJones Avatar answered Sep 20 '22 12:09

AnthonyWJones


Absolutley its called Application Library Caching. Ive used it very successfully its now a standard operating procedure, particularly nice is its application with resource assemblies.

straight from msdn ...

Resource files are typically any non-executable data file used by your application, such as image, audio, and video files. A resource file can also have specific meanings in certain contexts. For example, in the context of application localization, resource files refer to .resx files, which you can deploy in localized satellite assemblies.

it continues with some really useful info

With Silverlight, you can deploy resource files in the following ways:

•As individual files in the application package.

•As individual files that you retrieve on demand.

•As files embedded in an assembly in the application package.

•As files embedded in an assembly in an external library package.

•As files embedded in an assembly that you retrieve on demand.

which is what is suggested in the other answer(s)

like image 43
almog.ori Avatar answered Sep 22 '22 12:09

almog.ori