Sep 01 2009

The Knight’s Tour

The knight’s tour is an ancient puzzle, the object of which is to visit every square on a chessboard exactly once with a knight. It’s a somewhat famous puzzle because it was performed by the Mechanical Turk, and is used as an example in various computer science courses. There are two types of tour, Open and Closed. In a Closed tour, the knight returns to the first square it started from. In an Open tour it does not. The game calculates a score based on how long you took, and a multiplier based on the type of tour you complete.

You may play here or on Whirled. (The Whirled version will give you a trophy for completing either type of tour.) Depending on how much chess you may have played, you may find this puzzle difficult or extremely easy.

Read more »

Jul 26 2009

Barnstormer– Whirled edition

Actually, I like the implementation as it plays on Whirled, but this wrapper doesn’t do it justice. :(

Anyways, you can play this version (which has no ads, but will bug you to sign up for whirled) if you want to see the achievements and trophies as implemented there.
Read more »

Jul 23 2009

Whirled API: Keyboard Focus

One of the most vexing issues with implementing the Whirled API in your single player game is keyboard input. With a standalone .swf deployment (such as a normal game), resetting the focus to the stage periodically is sufficient to keep keyboard inputs going to your handlers. However, due to Whirled’s security model, you are not allowed to add handlers to the stage directly, and instead must add your handlers to _control.local. (Assuming you named your GameControl object _control!) stage.addEventListener(KeyboardEvent.KEY_DOWN, KeyDownListener) will through security errors.

Unfortunately, stage’s focus can only be set to an InteractiveObject. Therefore stage.focus = _control.local does not work to regain focus when it is lost.
This is because _control does not inherit from InteractiveObject.

There are at least two situations where your game is going to lose focus when running in the Whirled platform.

  1. The player clicks outside your game. (ie: to type in the chat window)
  2. The player clicks a button which you then remove from the stage. (ie: Start New Game)

Read more »

Jul 23 2009

Whirled API: Setting Game Dimensions

Whirled is a somewhat interesting gaming platform backed by Three Rings, the makers of Puzzle Pirates. Games played on Whirled are Flash (.swf) files, which are played inside the platform’s wrapper which is itself a large swf file. Unfortunately, Whirled’s dev forums are located inside Whirled and have poor search functionality. Additionally, because Whirled itself is similar to an open MMO and every in game object is coded by someone in flash, many of the people on their forums are not focused on building games– they’re building toys and avatars and furniture.

That’s not a problem, but sometimes it is very difficult to find information about fixing simple problems. Particularly when the technique you need is one you haven’t run into before at all. Read more »