Sunday, April 06, 2008

Working Set Prototype in Silverlight

I wanted to implement a simple prototype that implemented the kind of working set that Vyde will probably use. It's available at http://object01.dyndns.org/vyde01/. I implemented it in Silverlight and learned a few things along the way.

After my last post I decided to stick with simple integer coordinate systems. This visual aid really drives home the fact that it would take a long time to reach the world's edges; more than enough time to develop a better coordinate system that pushes that boundary out much farther.

Silverlight is interesting. It has just as many idiosyncrasies as Flash, and some are even less intuitive. I spent most of my time in "Intellisense discovery" mode, hitting that trusty period key and Ctrl+Shift+Space to try and learn what operations made sense in a given context.

So far, the most unintuitive thing I've seen is the pattern of using, say, a Canvas.Top attribute on a rectangle element to position that rectangle's top edge. It doesn't fit with the other patterns they've established in Silverlight, like encapsulating objects inside tags representing operations to be done to those objects, like <Border>, or using a simple attribute (like just "Top") to get the idea across. Why they had to involve another namespace I don't know. It makes me ask all sorts of questions, like what would happen if the Rectangle weren't in a Canvas? Can a Rectangle not be in a Canvas?

Despite the awkwardness that I think stems from a serious lack of documentation, being able to implement this piece of code in C# with full Visual Studio 2008 IDE support was a delight.

Getting it to work in IIS7, however, was a pain. The new IIS7 administration tool is so much different than its IIS6 predecessor. Not only are all the day-to-day operations located in different places, but the whole model for the web server and its applications has changed. It doesn't seem to be as simple as "drop a folder into wwwroot, configure it as an application." Doing that prevented my app from seeing the Silverlight assembly. Very strange.

Anyway, enough about my environment wrestling. This is the first real progress I've made toward a playable Vyde in a long time, and it feels good. This gives me a real jumping-off point for something a little more visually appealing, like maybe a random maze generator. If I could fill these white screens with more interesting tile-based rooms, it'd be a snap to persist them to a server and let people like you push the world outward farther and farther. It'd be interesting then to draw a big overview map after a month or two to see what directions people went in.

And of course, until I get a better coordinate system implemented, I'll have to implement a fence for those clever ones out there who take C-clamps to their arrow keys.