If you write a game in Flash, you will have to accept some performance limitations and make some compromises in terms of available technology (eg. no Ageia PhysX or hardware shaders for you). But nearly everybody can play the game right in his browser, dramatically expanding the number of people that see your game.
Now Microsoft is hurling a competitor to Flash at the market: Microsoft Silverlight. It is based on the .NET Compact Framework 3.5 and WPF, which makes it about 1000 times more powerful than Flash. WPF also includes 3D graphics and is way faster than flash, allowing for full-screen animations where flash would slow down to a crawl. It’s being ported to Mono/Linux as well, with the help if none other than Microsoft!
This got me thinking about doing a comparison of the new contenders versus traditional C or C++ development. Here it is:
Size
Indie developers generally consider the size of their games as being important. The assumption is that a greater number of customers will try a game of around 3-5 MB than a game sized hundreds of megabytes.
Once | Per Game | |
---|---|---|
Visual C++ 2005 (statically linked) |
–
with DirectX
9.0c End-User Runtime 4.0 MB1 |
+ 1.1 MB large binaries |
Visual C++ 2005 (dynamically linked) |
Visual
C++ 2005 SP1 Redistributable Package (x86) 2.6 MB
with DirectX
9.0c End-User Runtime 4.0 MB1 |
– large binaries |
.NET / XNA |
.NET
Framework Version 2.0 Redistributable Package (x86) 22.4 MB XNA Framework Redistributable 1.0 Refresh 1.9 MB DirectX 9.0c End-User Runtime 4.0 MB1 + 24.3 MB |
– small binaries |
.NET / Silverlight |
Silverlight
1.0 Runtime 1.4 MB2 + 1.4 MB |
– small binaries |
1 You can add and remove specific versions from the DirectX installer in any way you want. By removing all but the version required for the XNA framework, you can cut down the DirectX End-User Runtime to just 4 MB. Such a cut-down version is actually included in the redist folder of XNA Game Studio
2 Silverlight includes a special version of the .NET Compact Framework 3.5 and does not require the normal framework to be installed. It is the goal of the Silverlight team to keep the whole package below 5 MB.
Update: As the Zman pointed out, if you’re actually making an indie game which uses DirectX (a lot of indies still would go for Win32/GDI), you’ll need to include the DirectX 9.0c Redistributables as well. I’ve added the new size below the original estimate.
From this perspective, XNA doesn’t look very attractive. Users need to install the .NET Framework 2.0, the XNA Framework and a more or less recent DirectX runtime. However, you can subtract 22.4 MB from the installer size once Windows Vista has settled. XNA also is the only platform that can be deployed to the Xbox 360.
Speed
Comparing the speed of .NET versus C++ has always been a matter of debate. One group will insist that you have to implement all optimizations you can think of in each language, another group will insist that the code needs to perform the exact same steps in both languages.
Something you might find interesting then are the are the investigations of Washu. Instead of comparing some benchmarking programs, she has compared the actual machine code generated by the .NET compiler with hand-optimized SSE2 code:
Playing With The .NET JIT
Playing With The .NET JIT Part 2
Playing With The .NET JIT Part 3
Playing With The .NET JIT Part 4
The results are that the native image generator produces code that is nearly on par with hand-optimized assembler code. The native image generator is an offline compiler .NET that produces optimized machine code. It ships with .NET and some installers (for example, the one from Paint.NET use it to precompile applications when they are installed.