Dec 4 2009

Blitter and direct access to Silverlight frame buffer

silverlight

Can Silverlight be used for serious game development?

Some time ago I found interesting project, C# port of Quake engine optimized for Silverlight. Demo published by authors currently doesn’t work (dunno why), but videos show that they achieved fair 60fps with it.

I started wondering how was it done. Quake uses it’s own 100% software renderer. No hardware acceleration was supported at that time. So, to port it to C# and Silverlight developers needed just very fast blitter and/or access to frame buffer (window pixel table or memory pointer equivalent).

One of Silverlight MVPs, Bill Reiss , actually has developed a library that solves all of these problems. Library is called: SilverSprite and you can check its sources on Codeplex. It’s really interesting project, because its API is very close to Xna API developed by Microsoft. Bill gives several examples how to easily port Xna game to Silverlight. He also spoke for Channel 9 on this topic. Whole that coverage is really awesome.

I checked above resources by myself and Silverlight triggered my curiosity as for serious game development. I wanted to investigate and find answer to that original question on blitter/frame buffer. I’ve written a simple implementation of WriteableBitmap based routines to build some benchmark.

You can run this benchmark by yourself too:
* Silverlight 4.0 compatible
* Silverlight 3.0 compatible

I used direct pixel table access to clear the screen and it does not slow down Silverlight a bit. I added also a Blit method that is able to render any UIElement that Silverlight supports (or you create). This is first bottleneck I found. Rendering UIElements can slow down Silverlight heavily. Mixing these two techniques (Pixel Table and UIElements) is definitely an area for further analysis and optimization, but WriteableBitmap looks like a direction, where you can go and check if you can make software renderer (real-time ray-tracer) by yourself. Another interesting aspect of this simple test is performance comparison between SL3 and SL4. Silverligh 4.0 seems to work faster so I assume that SL team might have actually optimized WritableBitmap.Render() routine between these two versions.


Nov 26 2009

Infamous “Hello world”

Yeah,

Another “Hello world” in the blogosphere. I feel like I had already done that before. I’ve been blogging since 2004 or 2005 if I remember correctly. Many initiatives with different scope and content maturity. Once in Polish (my native), once testing international reader. Language proficiency in this history has taken also a very crucial part.

I remember very well that first post on MSDN Blogs in English. I tried to make my first professional blog on that platform, sharing my thoughts on Microsoft technologies with local and international readers.

For the moment, idea was not bad, but I quickly realized that with every post written, I’d been more and more interested in local only reader. Reasons were many. In Poland, I was presenting at conferences, trainings and other events for local developers. Language itself was not the problem, but if two Poles do talk, why use English in the background when I referred to something online.

So my English Posts category is long dead there. Quite recently I stopped marking Polish posts with [PL] prefix in the title. I realized that I’m not going to post any more English posts on that site. Not since that blog is cross posted on http://www.msdn.pl pages. [PL] prefix was nice, because I noticed that many other Polish bloggers used that prefix style to highlight their rare English postings (with [EN] for a change). Really interesting observation in social context and unspoken netiquette growth.

With growing popularity of that blog (as for my own acceptable scale), I realized that those pages are more official, regardless of my own statement.

Redesigning my private pages is the reaction. More and more I needed something rather private, something not so strongly branded with “MS only” label. Some place where I could start discussing and examining different topics. Some place where I could tell my international friends and colleagues that this is the place where they can follow my progress.

So I started with this entry. There will be more soon, that’s the blogging idea, right?

To give you short introduction what you can find here in the future, I’m going to explain basic content categories:

  • Home – this page obviously gets everything
  • Game Industry- My thoughts in this area from tools to design, from trends in business models to simple demands on the market. Definitely an industry worth watching.
  • Labs – I’m a creative soul. So I want to share with you some news with my current developments and investigations.
  • Microsoft – I work there, so I presume I’ll sneak in some MS-related information too.
  • Polish Software Industry – I’m paid to know well what’s going on in my local software market. I’m proud Polish by the way, so why not to promote my country and software from it? Regardless if MS or not, Polish brilliant minds are worth international awareness.  
  • Programming – Yeah I know.. I’m addicted. From time to time I presume I’ll paste here some source code too.
  • Various Rants – Isn’t it what are you reading just right now?

Cheers,
Daniel Biesiada

PS. As it’s fresh, greetings to all of you guys, whom I met in Los Angeles, CA at PDC 09 this month. It was great time, and Carl Franklin was my best surprise.