Read Jesse Ezells blog about the difference between Silverlight and Flash and why you should consider using Silverlight :
I’ve been close to ranting lately about my issues with speed for Silverlight 1.1.. Shame on me, a little bit.. 🙂
I have now refactored my 3D a bit and I’m now experiencing increased speed. The main problem is that if you want to runtime generate the visuals for every frame there is too much marshalling going on between the managed runtime and the core presentation engine of Silverlight. After a couple of days of real frustration I got struck by lightning (Silver ofcourse). I ran in to my livingroom from playing with one of my kids and grabbed my laptop and ran outside again to “play”… The answer is : Generate the XAML and marshal only once! This can be achieved in several ways, I chose to create myself a user control that I dynamically create and add to my Canvas every frame (only one), within this user control I generate the XAML needed and pass it along to the InitializeFromXaml() method found in the base class Control.
This resulted in the engine using around 10 milliseconds per frame on my test object. It used between 30 and 40 milliseconds before. (My machine : Dell Latitude D820 Laptop, running Intel Core Duo 2.33 Mhz)
It is kind of obvious that this is the result. Since the managed environment is decoupled in the manner it is, it will make sense to marshal as little as possible.
I’ve implemented this into the Balder engine, if you want to have a look at how it is done, download the source at Codeplex (http://www.codeplex.com/Balder). PolyControl.cs and Face.cs is in this writing moment the magicians. This will change soon when I clean up it’s act.
Check out the latest version, optimized :
(There is not a lot of added features, just optimizations and behind-the-scenes stuff…)
I posted earlier about Silverlight rendering being very slow. I’ve been digging deep inside the Silverlight runtime to figure out what and why there should be issues. Drawing issues is only half the problem, maybe even not a problem at all. Whenever you change a property that is a DepedencyProperty there is a lot of code involved. For the 3D engine I’m working on this is very critical, we change a lot of dependency-properties all the time. The main problem is that in order for a visual to get updated with any changes you need to actually set the property even though it should be sufficient just modifying a property on the type of the top level property (did that sentence make any sence.:) ) .
A good example of what I’m talking about is the Color property for a polygon. I just need to update the R,G,B properties on the polygon, but in order for the polygon to get the changes I need to set the Color property and that involves a lot of code behind the scenes in Silverlight in order to do that. Looking at architectural overview at Microsoft, it sort of says it all : http://msdn2.microsoft.com/en-us/library/bb404713.aspx. There is marshalling involved between the presentation Core and the .net Runtime that is very costy. It makes sense that it is like this, the presentation core has to be running natively seeing that it is cross platform.
I’ve finally published the source code on CodePlex for the 3D engine posted earlier.
It has been built with Visual Studio “Orcas” Beta 1.
The state of the source code is not 100% yet, but people can download it for now and have a look at how you could do a simple 3D engine. In addition a lot of featuers have not been made yet. During the next couple of weeks there will be additions to it.
For the time being I’ve invited a few friends to join in on the development, after some development time we will invite others to join as well. The project can be found at :
Feel free to come with any suggestions.
I started working at a company called Fjord Media yesterday. I left behind 5.5 years of enterprise application development for a simpler life. 🙂 I will be doing .net, ofcourse (is there anything else?), focusing on Windows and Web (finally I can do silverlight professionally. 🙂 ). In addition I will be doing some .net Micro framework.. Damn, that is some cool stuff. I mean, you got devices the size of a regular wristband-watch running .net. I've already created an application hosting a simple Web server on the Digi Connect ME device (http://www.digi.com/products/embeddedsolutions/digiconnectme.jsp). The hardware is just about the size of a regular ethernet socket you find on any motherboard and it has a .net device onboard.. NICE NICE!
So… I guess my postings will take a new turn.. Maybe.. Who knows.. Time will tell.