Saturday, July 11, 2009

Silverlight 3 WriteableBitmap is unwriteable

So I downloaded Silverlight 3 RTW(the real one, not Silverlight 3 beta) today getting all excited to try out the new stuff offered by Silverlight 3, and found that WritableBitmap does not exactly work like it does in Silverlight 3 beta. The problem? You can’t directly write the pixels, yeah so it’s basically unwritable. Then why not call it UnwriteableBitmap?

Maybe I’m doing something wrong in my code, or maybe there are ways to really write a WritableBitmap in Silverlight 3. I’ve been searching everywhere on the web but all the examples / codes only work in Silverlight 3 beta, and it seems that Silverlight 3 was released so hastily that there is not much documentation provided for this particular class. Well I hope more information will be available soon by Microsoft.

Microsoft does provide a documentation of breaking changes from Silverlight 3 Beta to Silverlight 3 RTW, but all it says are Lock() and Unlock() have been removed and does not say anything about writing Pixel data into WriteableBitmap.

What does WriteableBitmap (supposedly) do?

WritableBitmap lets you manipulate each pixel in a bitmap to generate customizable images. An example image that is generated through Silverlight 3 Beta WriteableBitmap is shown below.

WritableBitmap Does Not Work

If you know how to make WritableBitmap work, please let me know / post comments below. I’m really eager to try this out and use it for my next project. If the WriteableBitmap does work, it will be really useful for visual effects and game design. Right now the search engine is flooded by Silverligth 3 Beta examples that I can’t find any useful resources for the actual Silverlight 3 release.

What’s new with Silverlight 3

The wait is over. On July 10, 2009 Microsoft officially announced the release of Silverlight 3. So what’s new with Sliverlight 3 and why is it awesome?

Hardware Acceleration

This makes Silverlight applications run much faster because it utilizes your graphics hardware. A few occasions  where hardware acceleration is used are:

  1. Playing video, now supports full screen High Definition (720p).
  2. 3D image rendering – Expect real 3D games available soon on Silverlight 3.
  3. Pixel Sahder effects, create shadows, blurring, explosions and others definitely improves gaming visual effects.
  4. Writable bitmap where you can directly modify each pixel of an image. Great for creating particle effects.
  5. Text rendering and animation.

Example of writable bitmap

Example of pixel shader effect

Video and Audio

In addition to native support for VC-1/WMA, Silverlight 3 now offers native support for MPEG-4-based H.264/AAC Audio. With the new Raw AV pipeline, Silverlight can easily support a wide variety of third-party codecs. Audio and video can be decoded outside the runtime and rendered in Silverlight, extending format support beyond the native codecs. Videos can also be played full screen at 720p high definition.

Out of Browser?

Silverlight 3 applications now pops out of your browser, so you can run your application without those annoying “file, edit, view” and navigation buttons on top… This basically makes Silverlight 3 applications run on your desktop, with or without internet connection. You can make shortcuts / place and item in the start menu that links to your Silverlight 3 application. This opens up a great potential to create large scale full screen games.

Example out of browser application

Improved Data Support

Although less relevant to Silverlight game design, this is nevertheless a great improvement in Silverlight 3. New features include:

  1. Data forms control which provides data validation, better layout controls, and paging through data.
  2. Element to element binding – lets you manage UI element properties to data more effectively.

What to expect for Silveright 3 games?

First off, hardware acceleration definitely helps make Silverlight 3D games much smoother. With custom pixel shader effects and writable bitmaps to create particle effects, we can expect awesome visual effects in Silverligth 3 games.

Also, with out of browser support, games and run on your desktop (and I think this would increase performance as it reduces the overhead of browser processing?) in full screen. As such Silverlight 3 games could extend out of the boundary of online casual games into real serious hardcore games.

Wednesday, July 8, 2009

Featured Game: Silverlight Breakout

This post is about silverlight breakout game. I try to collect all Silverlight breakout applications and post their links here. Some of these games even provide full source codes!

Top pick: Chaos Ball Extreme – Hypnosis

This game is my top pick for Silverlight breakout games because it is made by me lol. Features 3D particle effects. Prototype source code available at Play it fullscreen here.

Second: Chaos Ball Extreme

Also another breakout game made by me. Features parallax effects and elegant graphics. Prototype source code available at Play it here.


Nice music and playable in full screen. Full source code available at

Silver Arcanoid

Very nice graphics with particles and real physics. Also features nice music and sound effects.

Vectorform Breakout

This breakout game is pretty professionally made. With a multiple full levels. Made in Silverlight 1.1. Source code available at

Monday, July 6, 2009

Creating Particle Effects in Silverlight

This is a tutorial about Spectrum particles 3D engine. Spectrum is a Silverlight 2.0 particles system that is in full 3d and is extremely easy to use. The following tutorial shows 10 lines of codes that will allow you to create 3D particles effect using this engine (written in C#).

Official site for Spectrum 3D Particle System is here.


1. To use Spectrum particles 3D engine, first download the assembly (Spectrum.dll file).
2. Next open up your Silverlight project, click Project -> Add Reference.
3. Click "Browse" tab, then find the .dll file to add into the reference.
Now you can use the functions in Spectrum class.


1. First we have to instantiate a camera and a normal particle generator.

Spectrum.Camera3D camera = new Spectrum.Camera3D();
Spectrum.ParticleGeneratorNormal pgNormal;

2. Next we initialize the camera and the particle generator

camera.setView(new Vec3(0,0,0), 1000, new Vec3(0,1,0), new Vec3(1,0,0), new Vec3(0,0,1));
pgNormal = new Spectrum.ParticleGeneratorNormal(camera, null, Spectrum.Globals.ParticleShape.smoke);

Camera.setView has the following arguments:
-focus is where your camera is looking at
-dist is the distance from your view point to the focus
-down is the down vector of your view point
-right is the right vector of your view point
-front is the front vector of your view point

ParticleGeneratorNormal has the following arguments:
-the camera
-a XML file name for particles effect. null for no effect
-particle shape. Only 2 choices available: Star or Smoke

3. Add particles.

for (int i = -3; i <= 3; i++)
for (int j = -3; j <= 3; j++)
for (int k = -3; k <= 3; k++)
pgNormal.createAndAdd(new Spectrum.Vec3(i * 50, j * 50, k * 50), new Spectrum.Vec3(0, 0, 0), new Spectrum.Vec3(0, 0, 0));

3 nested loops to create a 3D array of particles. The arguments for createAndAdd are:
-position of particle, in 3D coordinates.
-velocity of the particle. Here we just use 0,0,0.
-acceleration of the particle. Here we just use 0,0,0.

4. Finally, run the update method inside your game loop.

pgNormal.update(new Spectrum.Vec3(0, 0, 0));

That is all. You will be able to see particles in 3D space. Other functions like moving the camera and zooming in and out are demonstrated in this project available for download with full source code. The preview of this project is shown below.

Friday, July 3, 2009

Spectrum Particles 3D Engine Released

The wait is over. Now you can download and try out the Spectrum Particles 3D Engine at AquoSGameS.

What is Spectrum?

Spectrum Particles 3D is a full 3D particles engine written in C# for Silverlight. Particle effects like fire effects, blurring cloud, exploding stars are built into Spectrum and can be used in less than ten lines of codes.

Spectrum is still in initial testing phase, so some of the customization variables are not released.

Game Design

The main application of Spectrum 3D Particles Engine would be to make games. An example of a game created using Spectrum is Chaos Ball Extreme – Hypnosis. This games features full 3D graphics and tons of special particle effects. A Silverlight visualization application made using Spectrum can be seen here.


You may download the Spectrum Assembly and a Demo Project from here. the compiled and running project is shown below:

Saturday, June 27, 2009

Game Updated

Chaos Ball Extreme – Hypnosis is complete, now with better graphics, a real background, better sound effects and music. This game is created in Silverlight using Spectrum 3D particles engine, which enables the game to be in full 3D and consists tons of pretty particle effects.

This is not a normal breakout game. I try to blend shooting and 3D action into it and as a result, the game can be pretty chaotic at times.

Please play the game Chaos Ball Extreme – Hypnosis and post any comments you may have.

Monday, June 15, 2009

Chaos Ball Extreme - Hypnosis

Finished making the game yesterday but I wasn’t quite happy because this game is so hastily done that I don’t have time to make it look nice. The latest design has actual 3D background and better graphics, but was rejected by Mashooo because I submitted it after the deadline...

Anyway, the game is up on my website so have a look and please give comments.

This game is created using Farseer Physics and Spectrum Particles Engine.

Tuesday, June 9, 2009

Busy Life

No more time to update my blog. I’ve decided to remake Chaos Ball Extreme and submit it to Mashooo’s Silverlight game design contest (Contest deadline is next week). This means I have only 1 week to create this game. Since the base code is copied from Chaos Ball Extreme, i think it is possible to complete this game within 1 week (I might need to sleep less and eat dinner faster). Please please please, if you are reading my blog, please go to Mashooo and vote for my game(s). Games that I’ve submitted are

Chaos Ball Extreme

Kill Billy

The third game is going to be the remake of Chaos Ball Extreme. I’ll call it Chaos Ball Extreme – Hypnosis (Hopefully I’ll complete it before next week’s deadline). More details and website about this game will be available soon.

Tuesday, June 2, 2009

Spectrum 3D Particles Engine featured in

My Spectrum 3D project was added on yesterday as the feature project. This literally boosted the number of visitors to my website by 5 times. Woohoo! Now I feel really energetic and I’m ready to proceed with my next project – Chaos Ball Extreme Remake.

To view all community projects in, click here.

To see the Spectrum 3D project, click here.

If you are interested in Chaos Ball Extreme and what new features will be in the remake version, please visit the official CBX website.

Saturday, May 30, 2009

Where Do I Upload My Silverlight Projects?

If you have created a cool silverlight app and you’d like to show it to the world, here are some websites that you might consider:

Obviously, the official Microsoft Silverlight webpage is the first place you should go to showcase your projects. Every Silverlight developer should visit this page before doing anything else. You can find lots of cool Silverlight Applications on this website. It also contains a tutorial section, a showcase section, forum, and much more.

Silver Arcade

SilverArcade is a relatively new website dedicated to Silverlight Games. You have to submit games through email because there is no automatic game submission form yet. Even so there are already lots of cool games up on the website. The page design and interface is superb. They even pay you for your submissions through paypal. I’m sure this page is going to be very popular very soon.


My favorite Silverlight Games website. Uses ad-revenue sharing model. I like it because the admin always gives very kind and helpful comments. If you put your game up there now you might even qualify for their S-Prize contest which features prizes over $10,000! Whoa!

Silverlight Club

This looks like a more commercialized Silverlight website. Uses ad-revenue sharing model as well – they give you 90% of you share! You can upload not only games, but any types of applications as long as they are cool and they are on Silverlight platform. Also has a contest going on with prizes worth thousands of dollars.


Very nice interface, very well established. This website hosts all kinds of games including Silverlight, Flash, Java Applet, Free downloadable games etc. Lots of good articles about game development. Definitely give it a try.

Friday, May 29, 2009

Silverlight 3D Particles Engine

I’ve spent the past 2 weeks creating a 3D particles engine that runs on Silverlight 2 platform. I name it Spectrum particles 3D engine. A demo of Spectrum 3D particles engine is shown here as visualization to a familiar song. (Really familiar song, but I bet most of you can’t figure out where this song actually comes from.) Since this is my first blog post, I’ve decided to make it short and simply show off my project. Details on how I created this visualization will be added on future posts. Enjoy!

Spectrum 3D particles engine is now available for download here.

remember to turn volume up while running this application.

If you’d like to show this visualization in full screen, visit the official site for Spectrum Particles 3D at