Wednesday, May 27, 2009

Feet wet with WPF

I usually make a major shift in programming technologies when there's a very compelling reason. I remember when I decided to switch from Visual Basic to Delphi because Delphi offered a perfect object oriented framework and component model. Years later, when Delphi began to decline, I made a shift to the .NET Framework and C#. Mainly, I follwed Anders Hejlsberg from Borland to Microsoft - he was the primary architect of Delphi until Microsoft lured him away and he became the primary driver of C#.

With .NET came a layer of abstraction away from Windows, meaning less fine-grained control and power, but a modern development environment with a clear future.

Since the release of the .NET Framework 3.0 in late 2006, the WPF (Windows Presentation Foundation) framework was the cool new API in the Windows world. Windows Forms became old fashioned and quaint.

I'm about 3 years late to the party, but I have finally begun to update myself in WPF. The compelling reason this time is fear that Windows Forms is becoming a dinosaur framework, and I need to keep current. I have mixed feelings about this move, unlike for example the shift from VB to Delphi which I felt had no negative aspects.

First of all, my feeling is that WPF is currently half baked, without a full RAD development experience in Visual Studio. The idea of using two tools (Visual Studio and Expression Blend) to work on an application is not appealing to me. The direction of promoting XAML as a form markup language that a developer needs to code in leaves a very bad taste in my mouth. In my mind, the form markup language should remain in the background without having to be seen, much less edited. Also, much of the WPF API seems to have the flavor of the old Win32 APIs, with function calls with loads of obscure parameters in favor of a cleaner and more well thought out framework.

On the positive side, preliminary conversion of TurboSprite to pure WPF is showing promising results, with an animation frame rate of 3000+ FPS in my basic testing with no sprites added yet to an animated surface. All of my research indicates that GDI+ suffered badly in terms of performance when rendering images. WPF makes better use of graphics accelerators, so in general rendering should be much faster, as my early tests support.

Hopefully this will translate to an eventual SV6 and future games where graphics updates are no longer an issue! This transition also opens the door to create a companion SV6 client in Silverlight that will run in the web browser (in Windows or Macs) and allow multiplayer play through PrismServer. You may not remember, but once upon a time there was a Java applet version of SV that ran in the browser. Having a browser based, full fledged SV client is another compelling reason in favor of shifting development to WPF.


  1. hey Dion, so at the end what techs/IDEs are you using for the develoment?