Blog'A'Little

Just another C# guy

Silverlight 2 - rendering in a Storyboard event

During my "port" from Silverlight 1.1 to 2 of the Balder game engine I started working on last year, I've ran into a couple of gotchas. When I was optimizing the engine I discovered that Silverlight 1.1 had a speed issue when working with any Visual from managed code and adding it to the rendering pipeline of Silverlight. There was a very large interop overhead involved and I changed the rendering strategy to use a singleton Control that all primitives was added to and this would convert them all to Xaml and call the InitializeFromXaml() on itself. This proved to give a serious boost in performance.

This same approach for Silverlight 2 proved to be a killer for the engine all together. It turns out that doing this from the Storybard completed event that the engine was built around to serve as the "rendering thread", is really bad. It's all OK as long as you don't spend more time in the completed event than you've set the duration property to for the storyboard you're using. Default the storyboard is set to 0, but for Balder we set this to 20 milliseconds, which is just the game programmer in me coming to life; 20ms = 50 Hz = the refresh rate of the PAL standard (50 field changes a second, that is).

So, what to do with this..  Well. To be honest, I haven't figured it out yet. I'm still looking into it. Any thoughts on the matter can be emailed me at einar_at_dolittle.com. One of the things I will be looking into is to revert to rendering by creating the visuals programatically and adding them from managed code, I guess this won't solve the entire problem since the Storyboard implementation seems to be the one with a problem here, or at least the usage of it. After all it was not designed for the purpose of doing what I'm trying to do. :)

kick it on DotNetKicks.com kick it on GameDevKicks.com

Comments

Diurce said:

по моему мнению: восхитительно!  а82ч

kick it on DotNetKicks.com kick it on GameDevKicks.com
# februar 21, 2010 7:06

loans said:

Your website is very great. I enjoyed your website a lot. Thank you.

kick it on DotNetKicks.com kick it on GameDevKicks.com
# juli 1, 2010 11:55

pay day loans said:

Your blog page is very useful. Thank you greatly for presenting bunches of beneficial help and advice. I'll bookmark your weblog and will be most certainly returning. Again, I recognize the value of your entire work and in addition sharing lots of powerful related information for the readers.

kick it on DotNetKicks.com kick it on GameDevKicks.com
# august 25, 2010 1:39

bc loans said:

qunusutonvvdiksalgzhmrrdyzxwhfwfrpd

kick it on DotNetKicks.com kick it on GameDevKicks.com
# september 2, 2010 1:22

payday loans no fax said:

Thanks for sharing your thoughts. Take care. qqwlyvahoyh

kick it on DotNetKicks.com kick it on GameDevKicks.com
# september 23, 2010 5:30

bad credit loans toronto said:

This site is a complete internet resource for this. You'll find all you wanted or needed to know, here.

kick it on DotNetKicks.com kick it on GameDevKicks.com
# september 27, 2010 6:47

loans bc said:

The post is really the best on this laudable topic. I concur with your conclusions and will eagerly look forward to your future updates. Just saying thanks will not just be enough, for the exceptional lucidity in your writing. I will at once grab your rss feed to stay privy of any updates. De delightful work and much success in your business dealings!

kick it on DotNetKicks.com kick it on GameDevKicks.com
# september 28, 2010 4:58

payday loans ontario said:

I will publish a link to this blog on my internet site. I'm sure my readers will find this info really very good.

kick it on DotNetKicks.com kick it on GameDevKicks.com
# september 28, 2010 7:27

canada loans for bad credit said:

Superb concepts on this site. It's rare these days to find websites with data you are seeking. I'm happy I chanced on this webpage. I will certainly bookmark it or even register for your rss feeds simply to be updated on your new posts. Maintain up the nice job and I'm sure some other folks researching valued information will actually stop by and benefit from your web site for resources.

kick it on DotNetKicks.com kick it on GameDevKicks.com
# september 29, 2010 6:04

bc loan canada said:

I will submit a link to this blog on my internet site. I'm sure my readers will find this info really great.

kick it on DotNetKicks.com kick it on GameDevKicks.com
# september 30, 2010 7:30

canadian loans said:

I'm happy to have found your highly really good article! I agree with some of your readers and will eagerly look forward to your coming updates. Just saying thanks will not just be adequate, for the amazing lucidity in your writing. I will instantly grab your rss feed to stay privy of any updates. High-quality work and much success in your business efforts.

kick it on DotNetKicks.com kick it on GameDevKicks.com
# oktober 1, 2010 7:35

Caiya said:

That's not just the best aswner. It's the bestest answer!

kick it on DotNetKicks.com kick it on GameDevKicks.com
# juli 1, 2011 12:27
Leave a Comment

(required) 

(required) 

(optional)

(required) 

Design downloaded from Free Templates - your source for free web templates