Archive for category C++/C#/SQL/Web Programming

Interactive Fiction WIP Progress Report

I’m working on a project for this year’s Interactive Fiction Competition (IFComp 2010).  It’s one that I started as kind of a small palate-cleanser after last year’s Comp, intended to be a quickie adventure for my son.  As I worked through the idea and setting, however, I realized that there was more there than I was planning on implementing, and I reevaluated the scale of the project.

The result is my current work in progress (still nameless for now).  I’ve been working on it almost since I submitted last year’s entry, aside from a couple of breaks, and I’m happy to report that I’ve completed implementation of the last puzzles and the ending sequence, at least in skeletal form.  Much of the early game is more completely implemented, but getting the “bones” of the rest of the game laid down means that I don’t have to worry too much about infrastructural issues any more, and can concentrate on finishing the writing and improving the polish.

I’m very relieved to be at this stage; I pushed hard to get here over the past month and am happy that I achieved this.  I can hear you saying “But Matt, it’s the middle of July!  Why are you worked up about completing your game when you have two and a half months left until the Comp submission deadline?!?”

Well, there are several reasons.  First, with a baby in the house that’s almost exactly as old as my WIP, plus two other young kids and a wife I enjoy spending time with, getting time to work on the project is not easy.  I’ve used almost the entire amount of my free time since the last Comp (except for a Dragon Age break) to get here, and I’ve needed it.  I know that finishing the rest of the game in time is still going to require focused effort, especially when school starts back up in the fall.

Second, I have a much better idea of what goes into creating a finished, polished game than I did last year.  For Grounded in Space, I didn’t give myself enough time for development, for learning the tools, or (most importantly) for testing.  This year, even with the game scaffolding implemented end-to-end, I still have the following left to do (in roughly the order they need to be accomplished):

  • Enhancing the in-game tutorial
  • Fixing some known game-derailing bugs
  • Write out the ending sequences in full
  • Test and enhance the default message modifications
  • Implement some additional short scenes and interactive dialogue
  • Review my keyword implementation to ensure it’s consistent and useful
  • Perform object testing a la Juhana’s Object Response Tests
  • Alpha testing
  • Revise my writing
  • Test compatibility on various interpreters and platforms
  • Set up Quixe-specific modifications required for proper keywording and exit-lister display
  • Do cover art and a blurb
  • Beta testing and bug fixing

So no, I’m not resting on my laurels having gotten to this point.  If anything, getting this far has only permitted me to lift my head up and see how far away the finish line still is.

Wish me luck — I’m going to need it!  And for all the other authors this year – both returnees and first-timers — I wish you the best of success with your stories!

Tags: , , ,

Upgrading to Inform 7 6E72

With the recent releases of both the in-browser Glulx interpreter Quixe, and the newest Inform 7 Build 6E72, it was pretty obvious that I’d have to upgrade.  Sure, theoretically it would be possible to stick with the last version of Inform and manually roll out a playable website for my WIP.  But why turn down all the labor-saving power of the new “release along with an interpreter” option?  It automatically builds you a nice website, converts the Glulx file to Javascript for you, and packages it neatly up for release.  I’d also modified my source to remove the very few procedural rules I’d previously used, since I’d heard I7 is deprecating them, so I figured getting my WIP up and running wouldn’t be too arduous.

Happily, I was right!  I did run into about a dozen errors, which fell into two broad categories:

  1. Errors due to more strict syntax checking in the new build.  These were easy to find and fix — I spent maybe 5 minutes on these.
  2. Errors due to changes in the extensions I use.  My WIP uses a lot of extensions, and I hack some of them up a bit as well with overrides.  So pulling down the newest versions of all these extensions caused me a bit of worry.  Of them all, however, the only one that gave me any more than the most ephemeral trouble was the new version of Jon Ingold’s Flexible Windows.  Instead of a single drawing rule, it now uses an object-based rulebook, which required a couple of minor changes (as he points out in the changelog, I should note).  Actually making the code changes was easy; finding out exactly what needed to change was the trick.  Even this, though, didn’t take me more than about 15 minutes.

So the first thing I did now that I could get up and running in the new I7 was to set up Quixe and try a test release using it.  I was pleasantly surprised by the nice CSS defaults for the web pages.  The result isn’t quite up to the level of typography you can get with Gargoyle, of course, but for a literally no-effort setup it’s more than serviceable.  The only thing I ended up doing to the generated pages was to modify the User1 and User2 styles so that they reflected the colored text defaults that I start with, and I was off and running.

I have noticed that I7 is a touch slower to compile now than it was before, and generates a larger story file as well.  Before the upgrade I was running at just over 800 KB, and after the upgrade I’m up over 1 MB.  All the changes and improvements in the I7 release probably contribute to this, but I was pretty surprised to see the size of the generated file increase by 20%.  What this really means, I guess, is that it’s a good thing Quixe came out when it did, since the new I7 has pretty well priced itself out of the Z-machine’s range for all but the most trivial stories.

One thing I hope people continue to look at is the performance of Quixe.  The speed difference when running under Gargoyle vs. when running under Quixe is shocking — Quixe is at least an order of magnitude slower than standalone compiled interpreters, and I suspect more can be done to optimize Quixe given how brand-new the implementation is.  My fairly large WIP is certainly playable, but the slow response time is jarring.  Until speed improves I’ll still be playing most games through a standalone interpreter.

Now the only trick remaining is for me to work out how to support the dynamic color shifting for user styles that the standalone interpreters can use.  I have an extra window created below the status line that should be able to display one of four choices of colored text depending on what the user wants.  I’m thinking that with some judicious changes to the standard styles for that window, along with some minor changes to the code that displays the text, that I can support the appropriate choices in Quixe with a single set of CSS.  If I can’t, I guess I can create alternate windows with different color settings in their specific CSS sections and swap them in appropriately.  I’ll just have to ensure that whatever I end up doing for Quixe doesn’t break the solution I’m using for other interpreters.

Tags: , , ,

Here Goes Nothing

WordPress 3.0 has been out long enough that I’m feeling guardedly optimistic that all the major upgrade issues have been found. So I’m going to upgrade immediately after posting this!

With luck, you won’t notice any differences. I’ll edit this post with my impressions of the new upgrade…

… and yeah, no visible differences in the theme (as it should be) and really not that much different on the admin pages either.  The upgrade was clean and fast; another good rollout by the WP team.

Tags: ,

Andrew Plotkin’s Quixe Beta: Glulx Games Directly In-Browser!

In a surge of holiday-weekend coding, Andrew Plotkin (Zarf) has progressed his Quixe project to the beta stage and released it for evaluation.  If you’re very familiar with the excellent Parchment project, you’ll know that Parchment provides a Javascript implementation of the Z-machine, which is one of the major virtual machines used in the interactive fiction community.  When you play a game via Parchment, you don’t need plugins or standalone interpreter software at all — you play directly and natively in the browser.  This has obvious advantages for outreach — many people are leery of downloading unknown executable files at all.  And unless your game runs in Flash, convincing someone to install a browser plugin can be almost as hard a sell.  So Parchment has been a great mechanism to make Z-machine games available to not just a wider audience, but to a wide variety of devices as well.  Almost any device that supports a Javascript-enabled web browser can access interactive fiction through Parchment.

But until now, Glulx games were left in the cold.  Glulx is an alternate virtual machine developed by Andrew Plotkin to address some of the limitations of the Z-machine.  There’s more addressable memory as well as support for multiple windows, graphics, and sound, among other improvements.  Inform 7 gives you a choice of using Glulx or one of the Z-machine formats when you compile a game.

Unfortunately, using Inform 7 for a game of any complexity almost forces you into using Glulx, whether you are making use of its enhanced capabilities or not.  Inform 7 generates large game files that easily push past the Z-machine limits.  Particularly if you make use of the growing extension libraries you are likely to inflate yourself right past even the Z8 format’s cap on size.

So Inform 7 developers have (for the most part) found themselves unable to enjoy the same advantages of accessibility and ubiquity that Parchment gives Z-machine authors.

Enter Quixe.  Quixe provides a native Javascript implementation of the Glulx VM.  When combined with a suitable output layer (in this case I believe Zarf is using his own GlkOte implementation) it enables the same type of direct-in-browser play for Glulx-based games that Parchment enables for the Z-machine.

He’s currently got five games up on his page, but authors are able to convert any existing Glulx games using the zcode2js tool, and run them via his engine.  If you do this, you’ll notice that not everything is functional yet.  In particular, if you play the conversion of Rover’s Day Out you’ll miss much of the text formatting and screen effects that are visible in the game when played via a standalone interpreter.  Also, Internet Explorer does not currently work (!) Presumably these problems will be fixed and capabilities will be added in as development proceeds.  I expect we’ll also see the new style model that Zarf has been discussing over the past few months.

And of course, I had to run a conversion of my own Glulx game, Grounded in Space!  Despite not being very long or complex, I had to use Glulx for this game due the need for fairly high-precision floating-point math for one of the puzzles.  I haven’t gone through it in detail yet, but it seems to have converted correctly.  It doesn’t use any odd tricks that should prevent it from being playable, although the geometry puzzle might be even less comprehensible due to style and font issues.  At any rate, it’s very cool to have this capability, and I hope by the time this year’s Comp rolls around we’ll have a much larger number of games able to be played online due to Quixe!

Tags: , , ,

Service Broker Update

I’m finally finishing up the Service Broker RPC implementation at work.  I’m not 100% done, but I can see the light at the end of the tunnel finally.  As usual, setting up the initial implementation isn’t that bad — it’s linking it into every other aspect of the system where you start to see problems.

The devil is truly in the details.  Now I’m exhausted from two straight weeks of fighting this fire, and I’m sure I’ll be right back at it Monday, trying to finish the last hanging details.

Wish me luck!

Tags: ,

More Service Broker

After a two-day period of intense hacking, I’ve got the basic architecture of a replacement for our messaging engine working in Service Broker.  It’s fast, lock contention isn’t an issue, and I’m very hopeful that we can not only use Service Broker to replace our messaging engine, but also to reduce our dependence on external apps that poll the database for changes.

Service Broker is not particularly difficult to understand, but getting the syntax right can be tricky.  I ran into several minor stumbling blocks, which I was luckily able to get over quickly:

  1. I did not specify the “no encryption” option on the conversations I opened, so initially messages weren’t being sent due to the fact that I didn’t have a master key set up for the database in question.
  2. My first cut at implementation used the “fire and forget” pattern, where the initiator terminates the conversation immediately after sending.  This is a problem because if the far side needs to return error information to the initiator, it can’t, since the initiator has already jumped ship.  The fix for this is to let the target terminate the conversation and to put a little activated stored procedure on the initiator side to handle any error responses.

After getting past these issues, it was smooth sailing.  I expect to be able to implement the routing logic today, after which it will just be a matter of cleaning it up for inclusion in our software.  We could potentially be running with it in about a week, at least in its 1.0 version, particularly if I go with straight text for the RPC messages rather than have to mess around with XML serialization.  If I were using C# it would be a no-brainer to use XML, but the options available under C++/MFC are less than stellar.

Tags: ,

SQL Server Service Broker

Sorry for the late update; I’ve been feverishly working on a new project at work, using SQL Server Service Broker to replace our older interprocess messaging and database notification system.

Service Broker is a very cool piece of technology, and since it leverages the ubiquity of the database (everyone that needs notifications has connections to our server) we can end up eliminating a huge amount of code by implementing it.  We’re also likely to gain speed, as it will eliminate the single-point-of-contention queue table and the manual polling logic that we were using before.

I’m almost ready to roll with my second proof-of-concept exercise — this one demonstrating a stripped down version of my proposed architecture.  If I can get it to work the way I suspect I can, we’ll be ready to forge full speed ahead to implementation, and eliminate a code structure that ‘s been a thorn in my side for almost 10 years!

Tags: , ,


He spells it with two D's, for a double dose of his pimping...

Over the last couple of days I’ve been upgrading my computer system at home.  The impetus is twofold:

  1. I got a version of Windows 7 as a prize in the 2009 Interactive Fiction Competition, and finally decided to use it to do a full reinstall on our primary email machine.  It’s an old Dell XPS, and we’ve had it for 5 or 6 years.  It’ll run Windows 7, and it’s gotten so encrusted with remnants of old software over the years that it isn’t particularly reliable any more, so I backed up all our photos, videos, music, and email, made a list of the apps we absolutely need to reinstall, and took the plunge.
  2. Thomas has been relentlessly hounding me for his own website.  It’s a huge hassle to administer my webserver, though, because I have to reconnect mouse and keyboard and monitor cables.  When I finally got around to it, I discovered the webserver was over 6 months behind on recommended updates, so I spent a good amount of time bringing it up to date.  I also added Mozy remote backup to it, since it handles all my web content and my Perforce source code control depot.  I recommend Mozy very highly; I’ve used it for years and it’s cheap, fast, and reliable.

For good measure, I’m putting Windows Live Mesh on all three of my machines.  This is a very nice, featureful, fire-and-forget RAS package for Windows and Mac computers, published by Microsoft.  It allows easy file sharing and remote access for XP, Vista, and Windows 7 machines.  I found it extremely easy to set up and get started with.

After I got the mesh set up, I was able to quickly install two new websites — one for Thomas, and one for Robin.  Right now they’re just skeletons, but we’ll be fleshing them out soon.  Thomas wants to host Flash video games on his site, which should be an interesting experience, and Robin has long wanted her own blog.  Now she has one!

The Windows 7 upgrade on our main machine is in progress as I type this; I’ll follow up soon and let you know how it worked.

Tags: , ,

Video Hosting Rethought

After seeing the performance of my self-hosted video solution, I rethought the wisdom of trying to host myself.  First of all, performance from anywhere but home was pretty poor; the stream preload could keep up with the video playback, but only if everything went exactly right.  Once a hiccup occurred, it hung up and took an inordinate amount of time to recover.

Also, my upload bandwidth at home is limited.  If several people tried to view a video at the same time (I know I flatter myself, but it could happen), performance would really go down the tubes.

So I decided to host through Vimeo.  They’re free, support the features I’d like, have a nice player interface, and aren’t obnoxious like YouTube.

With luck, offsite-hosted video should be much more performant for viewers.  To test, the Vimeo-hosted Bionicle video is displayed below.  I personally think the quality is better, not to mention the performance.


Bionicle from Matt Wigdahl on Vimeo.

Tags: , ,


I’ve now figured out how to embed home video in the blog in a nice, streaming player.  The WordPress “Stream Video Player” plugin is the core technology; once this is in place it’s a simple matter to extract the video from the digital video camera, format it up with Windows Movie Maker (or equivalent software), convert it to a .flv file (Flash-format video), and inject streaming metadata into it.  Then you just upload and embed it into the post!

The result is a very nice embedded video player that supports random access to the video and doesn’t give you the issues that come with using YouTube.  The video is hosted locally and I can freely remove it or change it if I need to.

So here’s the first video I made — Thomas demonstrating his expertly-constructed Bionicle vehicle, complete with functioning weapon.  The age range on the box is from 9 to 16 years old; he built the whole thing himself (with just a bit of guidance from me) at age 8.  Note the complexity and the sheer number of parts, including a functioning gear train!  Also included is bonus footage of Jonathan fussing.

Edit:  I’ve removed the self-hosted movie.  See the next entry for the Vimeo-hosted version.

The Quern is Stephen Fry proof thanks to caching by WP Super Cache