First Silverlight 3 version checked in

Coordinator
Jul 16, 2009 at 2:58 AM
Edited Jul 16, 2009 at 3:16 AM

Please try it out, you'll have to get it from source control. The only changes so far are that I'm now using a pixel shader to draw tinted graphics (aka a Draw call with a non-white color) so you won't incur a texture creation for each tint you draw with. Also the base image for Texture2D is now a WriteableBitmap which simplifies things greatly and should allow me to more fully implement Texture2D going forward.

One known issue is that sometimes text draws in the wrong place, I'm trying to track that down, but besides that things look pretty good but let me know if anything major crops up.

Bill

Coordinator
Jul 17, 2009 at 2:02 AM

I fixed the problem I was seeing with text rendering, it was actually a measurement position problem because the graphics device wasn't being initialized early enough on startup. Now there are no known issues with the latest version in source control so if you find a problem please report it.

Coordinator
Jul 17, 2009 at 2:40 PM
Edited Jul 17, 2009 at 2:42 PM

Here is what I have in mind for my next tasks for taking advantage of Silverlight 3 in order of importance.

1. Rework bitmap text to use WriteableBitmap with one bitmap per piece of bitmap text instead of one image per letter.

2. GPU acceleration

3. Render Targets

4. Update SoundEffect to be in line with XNA 3.1

5. Look into feasibility of providing an XNA style interface to pixel shaders

6. WAV file support

7. Video support (from XNA 3.1)

If you have other pressing needs that are not listed here of if you feel that something should be ranked higher please let me know.

Jul 20, 2009 at 7:11 PM

Hi Bill,

Great work with the improvements.  I've been able to test out the latest build (26105) with XAGE and here are my experiences:

1)  There were a few sound issues (sound.state, sound.pause, sound.isDisposed, MediaState) - overlooked for now as I assumed they were due to the XNA 3.1 sound api updates.

2)  Performance isn't quite on a par with native executable, but has improved considerably.  On previous builds the memory usage would shoot up and would render my engine unplayable after a minute or two.  Now the memory usage fluctuates quite a lot, but still creeps upwards, meaning things slow down quite a bit after 5-10 minutes of play.  You can try it yourself here:  http://www.clarvalon.com/SilverLightTest2/TestPage.html

Note that when I disable to GUI (and therefore all of the Spritebatch.DrawString calls) the memory usage remains constant, and there is no slowdown.

3)  My menu system is based on the xna GameStateManagement sample.  The fading in and out now works, though it appears a little glitchy (white flashes).

4)  GraphicsDevice.SamplerStates isn't yet implemented, meaning point scaling is not yet possible (As per this picture here, the two character sprites are scaled down - native Xna using point scaling and silverlight using blurry).

Overall the progress has been really encouraging.  Looking forward to render targets!

Coordinator
Jul 25, 2009 at 7:41 PM

The latest has some significant performance improvements for bitmap text, it will probably still get slower as it goes right now, I haven't had time to investigate further at this point.

Jul 25, 2009 at 8:45 PM

Thanks.  I tried out build 26187 and you're right in that the slowdown still exists, but the improvements are again noticeable.  My short game is now playable to the end, albeit the ending does trudge along quite slowly. 

One other thing I noticed is that the when a new line of bitmap text is drawn, it occasionally doesn't draw it in the correct frame  e.g.  I have five SpriteBatch.DrawString calls in a row - sometimes the first three or four will appear a split second before the last, creating a slight visual glitch.  This only occurs in the Silversprite build.

Coordinator
Aug 5, 2009 at 9:43 PM

Can you try the latest to see if you still have issues with DrawString?

Thanks,
Bill

Aug 5, 2009 at 11:02 PM

 

Hi Bill,
The memory usage does seem to creep less, though perhaps at the cost of performance (? this might just be my imagination).  I've just done a playthrough with the latest build and, whilst the speed degredation seems better, general performance seems a little worse.  It's as if the Draw and Update methods are not being called nearly as regularly as they are natively, causing the UI and certain scripting to be a little sluggish. 
The only problem I had with the code was at line 79 in BitmapSpriteText.cs - one of the fonts was causing an out of range exception (targetIndex being larger than targetPixels.Length).  I added a simple range check and this seemed to work fine without any noticeable side effects. 

Tried 26601.  The memory usage does seem to creep less, though perhaps at the cost of performance (? this might just be my imagination - I've just done a playthrough with the latest build and, whilst the speed degredation seems better, general performance seems a little worse.  It's as if the Draw and Update methods are not being called nearly as regularly as they are natively, causing the UI and certain scripting to be a little sluggish).

The only problem I had with the code was at line 79 in BitmapSpriteText.cs - one of the fonts was causing an out of range exception (targetIndex being larger than targetPixels.Length).  I added a simple range check and this seemed to work fine without any noticeable side effects. 

 

Nov 24, 2009 at 10:57 PM
Edited Nov 24, 2009 at 10:59 PM

"7. Video support (from XNA 3.1)"

How does video playback work using silversprite? 

I just compiled the change set 35432, but I my XNA 3.1 video lines are not being recognized...

I am following the video playback in xna advice found here: http://klucher.com/blog/video-support-in-xna-game-studio-3-1/ (basically using Video and VideoPlayer classes)

Thanks

 

EDIT: Okay, of course only after I posted, I notice you said that these are upcoming features. Not current features. I look forward to them in that case. Thanks

Mar 25, 2010 at 2:59 PM

Great work. I've got my code working more or less, and your current build is much faster. Great work.

 

If you could bump up .wav support, that would be huge. For all of my sounds I use wav's, and when I try to convert those into mp3's, it gives me errors when I try to play the sound (since mp3's cannot be soundEffects.)

So, if it was up to me, I would move .wav support to place 2 or 3.

Coordinator
Apr 22, 2010 at 4:20 PM

I have included some experimental support for WAV files in the latest source code, please try it out and let me know how it goes. Note that I've upgraded the solution to use Silverlight 4, there was a problem in Silverlight 3 MediaStreamSource which would make it so that short wav files would not play.