I have had great fun developing a new Silverlight game (here at Metia) for the Microsoft UK Partner Network Team which has now officially gone live! Please visit the game here to have a go and see if you can beat my personal top score of 443! Be sure to let me know what your top scores are under the comments section

The game is built using Silverlight 3 and features the following:
- Silverlight plug-in detection
- Custom pre-loader animation
- Options for mouse or keyboard controls in game
- Saves your top score using Isolated Storage
- Different AI and traits for each of the 4 bad guys
- Bonus points for collecting prizes faster
- Lots of cool effects like trailing footsteps and 3D score indicators
Tags: Animation, Collision, Designers, Developers, Development, Direction, Effects, Fun, Games, Mouse position, Random, Rotation, Silverlight 3, User Input
When building Silverlight applications, especially ones with multiple animations and storyboards, it is easy to quickly find your processor requirements start spiking. This can reduce your viewers experience through slow frame rates and jumpiness, especially on lower spec machines.
One way to optimize your Silverlight application is to check that it is not having to render objects that are not being used or seen. If a storyboard is animating an object then that object is redrawn each frame even if it is out of view or behind another object. By stopping these animations or collapsing them until we need them will help keep down the processor requirements.
By using the ‘EnableRedrawRegions‘ property we can see every part of the screen that is being redrawn each frame.
Below is an example of an animation and the ability to move an object on top to hide it.
Below is the same example but with the EnableRedrawRegions property switched on. Notice how the animation is still being redrawn even when it is fully hidden by the Black area, but if we press the Collapse button the animation is no longer redrawn.
The ‘how to’ bit
To turn on the EnableRedrawRegions property we need to add the following code in the HTML page hosting the Silverlight:
<param name=“enableRedrawRegions” value=“true” />
Add it after the ‘object‘ tag with the other default ‘param‘ tags created by Visual Studio.
Tags: Animation, Designers, Developers, Development, Expression Blend, Frame rate, HTML, Optimization, Redraw, Silverlight 3, tutorial
This post is part of a string of posts found here: Learn Blend in a Month.
Blend 3 allows you to embed fonts, but unfortunately if you publish your work online you are technically distributing the font. This is illegal and could potentially land you in trouble.
However, there is a way around this, if you encrypt the font so that it is not usable then you are arguably not distributing it any more. This process is known as Obfuscation. It is important, however, to point out that you still need a license or permission to use a non-standard font in your work.
How to Obfuscate a font
First open up Microsoft Word (2007+), create a new document and type every character you will need in the font you require. Save the file as an XPS document and close Microsoft Word.
Locate the saved XPS document on your hardrive and rename the file type from ‘.xps‘ to ‘.zip‘. Now extract the contents of the .zip and find the file called ‘Resources‘, inside this folder should be a document with the file type ‘.odttf‘. Add this file into your Silverlight Solution and set its ‘Build Action‘ to ‘Resource‘.
Now the final part, in the XAML, locate your textBlock and set the ‘FontFamily‘ property to the .odttf file in your solution. Directly after this needs to be a ‘#‘ and then the exact name of how the font was displayed in the selection field in Microsoft Word. This allows you to have multiple fonts in one .odttf file.
The XAML should look similar to the below.
<TextBlock x:Name="textBlock" FontFamily="./Fonts/20FD640A-6B8C-569B-6B08-6F60BA7CC534.odttf#Segoe UI" FontSize="12" Foreground="Black" Text="text content goes here" />
Tags: Designers, Developers, Expression Blend, fonts, Learn-Blend-in-a-Month, Obfuscation, Silverlight 3, TextBlock, tutorial, Work environment, XAML