Posts Tagged Programming

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: , ,

Duplo LEGO Star Wars — A Modest Proposal for the Wii

This is a guest post from my son, Thomas, who has a game proposal he’d like to submit to any interested developers.  So if there are any LucasArts folks trolling the blogosphere who are looking for a creative idea for a new game by a very enthusiastic Lego Star Wars fan, read on:

Dear LucasArts,

My name is Thomas Wigdahl and I want to work with you to publish a Wii game called Duplo LEGO Star Wars.  Can you help me create it?

The reason this game uses Duplos is that it’s a new idea that no one has used before.

The best part of my idea is that it has adventure in it and cool bosses that have a variety of vehicles, ships and droids.

My game would be fun to play because you can build your own vehicles and weapons.

Something new in this game is it only has five levels that are longer than Lego Star Wars levels.

Thanks!

Sincerely,

Thomas

Concept art is below:

Tags: , , ,

“Good Eats”

alton_brown_geek_motivator[1]OK, this will be a special early post so I can get the link out there.  This month we’re hosting Dinner Club, and rather than our usual Iron Chef-style theme ingredient, we decided to go with an Alton Brown theme.

Part of the reason is that we’ve been watching a lot of Good Eats lately in the evenings after the two older kids are in bed but while Jonathan is still active.  Usually the choice is between Star Trek TNG and Good Eats as to decent shows to watch, and Alton has more… general appeal, shall we say.

So we came up with a comfort-food menu based on Alton Brown’s recipes, but I had a brainstorm after finishing the menu:  I’ve been working on interactive fiction lately — why not make an interactive menu?

I didn’t have enough time for that, but I did put together a short, themed interactive fiction work, loaded with Alton Brown quotes and quote-look-alikes, to serve as a companion piece — an appetizer if you will — to this month’s dinner club.

I used a couple of 3rd-party extensions and the core of one of my own proto-extensions to speed development, and after about 3-4 hours of work I ended up with “Good Eats”, an interactive menu.  Click on the link to run it directly in your web browser through Parchment, a Javascript interpreter.  The reason you can do this with this game and not with my competition game is because this one is small enough to fit in the old Infocom Z-machine format, which is the only one currently supported by Parchment.  You can, of course, also download the file directly and play it on your favorite standalone interpreter.

I hope you enjoy “Good Eats” as much as I enjoyed making it!  It was a nice break from longer, more involved projects; I now see the appeal Speed-IF has for participants where I didn’t before.

Tags: , , ,

IFComp 2009 Overview — Grounded in Space Postmortem

pcm_trophy_lrg[1]The Rule 5-induced cone of silence has lifted, and the results are in!  Grounded in Space did reasonably well, placing 10th out of the 24 entries, very close to where I expected it would be (I had mentally blocked out 8th to 14th as the range I was expecting, based on reviews and my own experience playing the competition games).  I learned a lot and met a lot of cool people participating in this year’s competition.  Here are some of the major lessons I took away:

1.  I probably wasn’t ready to release Grounded in Space.  I vastly underestimated the amount of work required to make the game release-quality, especially post-beta work.  And I definitely did not know Inform 7 well enough to accomplish everything I wanted to; the triage required on the design to get the game playable was pretty severe.  Many of the cool parts of the original design ended up on the cutting-room floor, due to either lack of facility with the language or a self-inflicted lack of time.  I slacked a bit in the middle where if I’d put in more effort I might have accomplished quite a bit more.

2.  I’m glad I did release.  The experience of competing in IFComp ‘09 was invaluable; there are things I learned from the process, from the other games in the Comp, and from the discussions on the authors’ forums, that I probably couldn’t have learned in any other way.  In particular, I believe that I could not have learned the final process of making a game releasable — the testing and tradeoffs required in the end stages of development — had I not forced myself through it, even with a game that ended up deficient in some ways.

3.  Reviewers are all over the map in terms of what they like or don’t like.  I was pretty unlucky in that the first few reviews all either said or implied “I don’t like Heinlein.”  Well, that pretty much meant those reviews were going to be bad, since Grounded in Space is directly patterned on Heinlein juveniles to the best of my ability.  Later reviewers were more kind in that respect; there are some Heinlein fans out there after all!  Similarly, some folks liked complicated puzzles and some probably would have punched me if I’d been to hand when they got to the engine console.

4.  Notwithstanding #3, there were a number of valid criticisms of my game that were widely given:

  • The premise was really off the wall, and a lot of reviewers bounced off of it.  Sam Kabo Ashwell was very insightful here — it really was the result of me taking the shortest distance between two plot points.  Even a little more thought and effort here would have lowered the suspension of disbelief bar substantially, I think.
  • The introduction lacked interactivity — some objected to this and some didn’t, but there were certainly ways I could have improved interactivity in this section, and I simply didn’t have time to do so.  That was the first section I coded, so it was the one with the least language facility backing it.  I wanted to rewrite it, but bugs with the engine puzzle kept me busy right down to the wire, and I didn’t get the chance.
  • I got criticism that the engine puzzle was not suitable for the text format.  I disagree with this somewhat; I think that with a better text interface I could have made this more palatable for a lot of people.  But a subset of players was never going to be happy with a puzzle that required you to SET THETA DIAL TO -1575, and I didn’t realize quite how large that subset was.

5.  The game is likely unsalvageable.  At this point there are enough flaws baked into the design that trying to improve the game experience would require gutting and rewriting large sections of it, and I’m not going to do that.  I started on another work the day I submitted this one, and I’m planning to move forward with that instead.  There will, however, be a sequel to Grounded in Space at some point in the future.

6.  Inform 7 is awesome.  The learning curve is… interesting — you can get off the ground quickly, but getting really good with it requires you to cross the natural-language equivalent of the “uncanny valley”.  But the expressive power of the language is amazing, and I’m sure the pleasure (and it is, truly, a pleasure) of developing in Inform 7 is one of the main reasons — along with the great people in the community — that I’m so excited about continuing to write IF.

7.  Develop like you were developing any other kind of software.  I didn’t do this at first, treating it as if I were typing up an email.  Oh, I designed up front, of course, and had plenty of design documentation.  But I didn’t have source code control, nor any kind of issue tracking/prioritization system, and so I found myself wasting time on trivial issues or, worse, fearing to make changes in complex code (the reflectors, anyone?) for fear of breaking more things than I was trying to fix.  For my next project, I’ve addressed this; I’m now using Perforce for source code control and I already feel more fearless, comfortable, and productive as a result.

8.  Some of your beta testers should be from the IF community.  I used exclusively non-IF friends for testers, and although they found staggering amounts of bugs, helped me with aspects of the story, gave me a great insight into how newbies might interact with the game, and really got me to widen my net of synonyms, a few IF vets in the mix would probably have latched on to the more structural shortcomings of my work and made suggestions early on that might have helped me avoid some of the big design/architecture pitfalls I stumbled into.

9.  The whole experience was great, and an encouragement to proceed.  Even the negative reviews usually had something nice for me to take away.  The good ones (and there were more of these towards the end of the Comp, for some reason) were extremely encouraging.  Knowing my work clicked in a good way for some people, no matter how few, is a very powerful motivator to continue, and I will certainly be writing more IF and entering the Comp again.

So thanks to everyone who played the games this year, particularly to those who took the time to write reviews and let us know what you thought of our works.  I enjoyed writing for you and hearing both what you considered good about Grounded in Space and what you considered bad.  Next year I hope to improve quality on all fronts and produce something that will knock your socks off!

Tags: , ,

IF Development Tools

Christopher2[1]

Chris Doesn't Use Source Code Control...

Although Rule 5 is still in effect, so I can’t discuss my IFComp-submitted work, I’m still working on IF.  I’ve started two new projects which will share a bit of infrastructural code.

This time around, I’m improving my processes.  As a professional software developer, I wouldn’t dream of doing a project at work that didn’t use a source code control system.  In my previous IF work at home, however, I didn’t bother to set one up in the beginning.  While I was just dinking around, it wasn’t a problem.  However, once I got serious about a project, the closer I got to completion the more nerve-wracking it was making changes, for fear I’d blast something and have to laboriously reconstruct it.

Source code control protects you from this single-point-of-failure problem.  With an SCC tool, you check out and check in versions of the source code, so losing your current copy only loses you the changes since your last checkin.  In addition, a centralized SCC gives you a repository, so there are multiple copies of your file in the event of a catastrophic disk failure (of course, you should have a backup strategy as well; that’s orthogonal to the SCC issue).

I resolved that I wasn’t going to walk the tightrope without a net again.  The question then became which SCC system to get.  There are several good choices:  Subversion; Mercurial; Git; and Perforce, to name the top contenders.

I didn’t want to spend any money, but I’m not particularly ideologically wedded to an open source project.  I also use Windows, which affects the types of UIs available for OSS systems like Git, where the primary focus is on Unix-based systems.  What cinched it for me in the end was that Perforce, the system we use at work, apparently offers a free, non-expiring download of a 2-person maximum server, which is full-featured and supports all of their client apps.

I downloaded it and fired it up, and it was perhaps the easiest setup and configuration of a software package I’ve had to date.  No more than 5 minutes and the server was up and running, configured as a service.  3 more minutes and I had P4V running on my development machine and was importing my files.

Everyone has their own taste in SCC, but if you haven’t tried one yet, and if you’re working in a Windows environment, you could do far worse than to use Perforce.

Tags: , , ,

IFComp 2009 Final Pre-Submission Update

The “last” bugs have been squashed.  The walkthrough is written.  BB1162-002The beta testers have been credited.  The file is uploaded.

Grounded in Space is finished.

You won’t hear much from me on the subject until November 15th, when the judging is complete.  As per Rule 5 of the Interactive Fiction Competition, I cannot comment on my game or respond to reviews at any time during the judging period.  I do hope to have an extensive postmortem after that point, where I go into detail about what I learned and what I’ll do differently next time.

I will say that I’m already planning at least one new project; this one was so fun, challenging, and rewarding that I’m sure I’ll be motivated to try again at least one more time.

I’ve put a lot of time and effort into this, but it’s absolutely been time and effort well spent, no matter how I do in the competition.  It’s helped me to learn a new programming language and practice my writing, exposed me to some excellent interactive fiction in a community that I had no idea even existed before, and motivated me to follow through and finish a fairly large project purely on my own, with my own willpower and resources, giving me confidence that I can handle a project of this scale outside of the confines of work.

This last week was a doozy.  At the very last minute, one of my testers found a couple of issues that exposed a whole class of bugs that neither me nor my testers had found previously.  I spent Saturday evening frantically rooting them out, prior to bringing my wife home from the hospital with our new son on Sunday.  I’m pretty confident the bugs are cleaned up.  Of course, I’m also fairly confident there are others, and that there are weak spots in my writing that another pass might have addressed.

In the end, though, you have to call it a day sometime, and I choose now.  Play it and enjoy it; it’s yours now.

Tags: , ,

IFComp Update #15

3039522605_72b86b1e2e[1]Depending on how things go, this might be my final pre-submission update.  I’m up to Beta Release 7 at this point — my testers have been finding bugs at a truly staggering rate, which is testament both to their persistence and my questionable implementation decisions.

Beyond bugs, the testers also identified a lot of areas where the flow of the game was bad, or where I was dumping an unreasonably large amount of text onto the user at once.  Also, several of the testers are completely new to IF, so reading their transcripts is really helping me to identify alternate command formulations that I should support, as well as extraneous wacky actions, synonyms, and the like.  One tester in particular has been excellent at triggering almost every conceivable state machine misfire, and thanks to his work the game is much more solid and stable now.

The testers seem to enjoy the plot and writing so far, although not all have made it past The Big Puzzle yet, so we’ll see when they get to the end.  I’m definitely paying the price for some of my ignorance of the proper way of doing things in the early days.  I made some mistakes early on that are not feasible to fix at this point, and that cause some really wacky behavior.  Next time around I will definitely have a much better idea of what things are fairly straightforward to implement and which are error-prone.

I’m also disappointed (as I suspect almost everyone is at one time or another) with how conversation works in my game.  I use the standard “ASK X ABOUT Y” syntax, which is fine as far as it goes, but feels limiting even as it fails to provide any sort of ongoing conversational flow.  The next time I need to implement NPC conversation, I’m definitely reading Emily Short and Mike Roberts before starting.

The competition starts in just over one week, so I will likely be uploading my submission before Wednesday of next week.  What that means is that the next update will probably be a quick post-submission report before the comp kicks in, after which I will have to maintain radio silence as per Rule 5 until the judging period is over, which will be November 15th.  To fill the time, I should have a new son in the next week or so, so I don’t think it will be a tremendous hardship to wait.

Wish me luck!

Tags: , ,

The Saga of the New Keyboard

keyboards-709573[1]I program.  A lot.  I type in a lot of code at work and at home as well, and I’ve had numerous flirtations with carpal tunnel syndrome in the past.  What finally cured the problem for me — and it was a dramatic cure — was moving to the Microsoft Natural Keyboard around 13 years ago.

Programmers get attached to their keyboards, and it’s no wonder; we type tens, possibly hundreds of millions of keystrokes on the things.  Switching keyboards is a big, big deal — nothing to approach lightly.  As an example of how particular we can get, note that the keyboards pictured to the right are recognizable instantly as examples of the Microsoft Natural Keyboard Elite model, which are inferior to the original models in key feel, function key size, and the layout of the insert/delete and cursor arrow key blocks.

Don’t mess with our keyboards.

The original Microsoft Natural Keyboard is, in my opinion, the pinnacle of keyboard design.  Nothing before or since matches its ergonomics, key feel, or spare layout and design.  I bought one for work and one for home way back in the day, and have used them for well over a decade now — they’ve outlasted at least 3 computers with never a problem.  I’m typing this post on one right now.  I have an Elite as a spare, but I try not to have to use it.

There’s only one problem; the original Microsoft Natural Keyboard is a PS/2-only device.  That’s not been a fatal problem even in the age of USB, as there are PS/2-to-USB converters.  However, either the converter or the new Dell I got recently (or both) are not fully compatible with the keyboard, as I get dropped keys when typing at speed, and it can’t handle interleaving multiple simultaneous keypresses very well, which affects ALT- or CTRL-key combinations and games.

So it was time to look for a new keyboard.

Of course, the first place I went was to Microsoft’s offerings.  After over a decade of complete satisfaction, I knew they understood what a programmer needs in a keyboard.  I also knew they had a suite of new keyboards, all of which natively supported USB.  After reading some reviews I went with the Microsoft Natural Keyboard 4000, which seemed to be the intended successor to the original Microsoft Natural Keyboards.  I ordered it from Newegg, got it, and plugged it in.

With one exception, it’s really quite a good keyboard overall.  The key feel is OK, the layout is good (read:  familiar) — everything about it was acceptable, except for the spacebar.

The spacebar.  How could they screw up the spacebar?  When you type on an ergonomic keyboard, especially  a split one like the Natural series, the spacebar has to be wide to bridge the gap between the two sides of the keyboard.  For comfortable hand positioning, you have to have your thumbs on the very ends of the spacebar — it’s required by the very concept of a split keyboard.  So why would Microsoft make a keyboard with a single contact for the spacebar, and a cheap swaybar to try to balance the forces?  It presses OK in the exact center, but when you press on the ends, it sticks.  Badly.  On either side.

It’s a dealbreaker.  It may be news to Microsoft, but the spacebar is a commonly used key.  I’ve used it several hundred times in this blog post already, which is more than I can say for the ‘x’ or ‘q’.  So back the Natural 4000 went to Newegg, and I looked for another answer.

What I came up with in the end was a used Microsoft Natural Keyboard Pro.  This model supports USB natively, has the same key layout as the original Natural, a good spacebar, and a bunch of extraneous buttons at the top that I just ignore.  Key action is OK; not as good as the Natural, but acceptable.  The function keys are the small Elite size, but I can live with that; I don’t use the function keys nearly as much as the spacebar.  And since older Natural keyboards are almost indestructible, it still works great.

I wish I’d found this one originally, as it was cheaper than the 4000 and I wouldn’t have lost the $18 on return postage and restocking fee when returning the 4000 to Newegg.  But even so I consider it a cheap lesson to learn.  The important thing is that I have an acceptable keyboard to use now; one that works well enough that it seems to blend into the background, and becomes something I can just ignore while I work.

Tags: , , ,

IFComp Update #14

running_pigs[1]I took the first feedback I got from the beta on Monday and sat down last night to polish up the game.  I finished cover art, entered the competition data on the website, and then added a slew of new actions, synonyms, and objects.  In addition, I cleaned up some of the descriptions and added some cluing for something that was tripping up the beta testers.

The game plays much more cleanly now, and so I wrapped up the evening with a Beta 2 release, which I’ve posted for my testers this morning.  I’m hoping for at least one more round of feedback and improvement before I submit, and while I wait for that I’m planning on just working on the writing.

Getting close!

Tags: , ,

The Quern is Digg proof thanks to caching by WP Super Cache