21st Century Smalltalk

June 21, 2007

JSON Serialization in Silverlight

Filed under: Games, Silverlight — pfisk @ 9:18 pm

smalltalk25

Above is Smalltalk/DLR running in a browser with Silverlight 1.1.

Two more buttons have been added to the Designer menu:

  • Save - serializes the designer contents to a JSON formatted string, stores the string internally, and writes it to the Transcript window.
  • Load – recreates the designer contents from an internally stored JSON string.

You can test this by using the Designer to create a drawing and then clicking the “Save” button. Delete the drawing (or open another Designer window) and click “Load” to restore the drawing.

For the moment, this is set up as an internal test. Tomorrow, I will add the server components as well and, by next week, there should be a test library of pre-built diagrams that can be loaded from the main site at http://vistascript.net.

Silverlight contains a XamlReader class but not XamlWriter; so, while you can read Xaml (produced by Expression or Visual Studio), you cannot create Xaml.

However, Silverlight does have a good JSON serializer (JavaScriptSerializer) which can both serialize and deserialize to JSON format. I have built JSON support into all Smalltalk/DLR graphical objects.

An advantage of using JSON format is that other data can easily be stored along with the graphical object. For example, a game avatar could store lists of powers, friends, or strategies.

Silverlight is going to be an excellent gaming platform.

Silverlight on Linux

Filed under: Mono, Silverlight — pfisk @ 2:18 pm

mono

A sample screenshot from the Mono project.

Miguel de Icaza and the Mono team are doing a fantastic job of implementing Silverlight on Linux and will be showing their latest work today at ReMix07 in Paris.

Here is how Miguel describes their “Moonlight” project:

The past 21 days have been some of the most intense hacking days that I have ever had and the same goes for my team that worked 12 to 16 hours per day every single day –including weekends– to implement Silverlight for Linux in record time. We call this effort Moonlight.

Needless to say, we believe that Silverlight is a fantastic development platform, and its .NET-based version is incredibly interesting and as Linux/Unix users we wanted to both get access to content produced with it and to use Linux as our developer platform for Silverlight-powered web sites.

It is less than eight weeks since Silverlight was released. The fact that it has already been (mostly) implemented on Linux is incredible.

Blog at WordPress.com.