StringSet Class for Actionscript 3

Storyteller uses String IDs heavily, and I want to store them in collections but don’t want to risk duplicates, which is what the Set data structure is for.

Unfortunately, Actionscript 3 does not feature a set collection. So far, I was using the Dictionary class, but since it is not exactly a set, I tripped up several times because of its odd interface: myset["id1"] to ask for containment, delete myset["id"] for deletion and there’s no built in way to ask for its amount of elements.

I searched Google for collection libraries like AS3Commons and Polygonal, but they had a few shortcomings: the former does not implement builtin iteration (using the nefarious Proxy class) and the second does not support a set of String out of the box nor builtin iteration.

Since I don’t want to worry about sets in my game, I made my own StringSet class that has several features:

  • It is pretty type safe because it uses the String type explicitly everywhere (unlike AS collections, in which the push method traded safety for versatility).
  • Is implemented using Dictionary, which is pretty fast when asking for containment.
  • Can be iterated using for..in and for each…in, and can ask for containment using the in operator (ie if(“mydog” in dogset){}).
  • Provides several convenience methods like joining, intersection, clone, toArray, toVector, etc.
  • Caveat: it does NOT retain the order in which keys were added.
  • Caveat: may have bugs. Report them on the comments so I can fix them!
  • Download StringSet.as

Storyteller: You don’t know what I know

Storyteller might allow characters to lie.

Characters in Storyteller have perfect information about everything that happened in the story. While this allows plenty of interesting situations, I feel I need to take things a step further, and allow characters to have incomplete or downright false information. This means I will have to rewrite the solving algorithm again to have a global, true model of the story and individual models of the world for each character.

I am particularly interested in characters lying to each other, and acting upon false information. This would make some stories trickier as players will have to remember who knows what. Some Shakespeare stories would become possible, as in Othello:

Iago is Othello’s ambitious friend. Othello promotes Michael Cassio and Iago is deadly jealous. Othello elopes with Desdemona but Iago starts to plot against them. Othello becomes jealous and suspicious of Desdemona. Othello returns to the castle to kill his innocent wife. Emilia tells Othello the truth about the scheming Iago. Othello wounds Iago, then kills himself. Iago kills Emilia.

Another kind of deception is “impostoring“, where one character poses as another, surprising the victim with the eventual revelation. The Crying Game comes to mind.

The goal of this feature is for players to be able to play not only with external events like murder and theft, but also with what each character believes:

Storyteller wins Nuovo Award, I go on a game making retreat

Shocked and surprised, I stumbled to get the Nuovo award at this year’s IGF and gave an unusual, improvised acceptance speech.

This means that the game might be able to get more credibility with the press and increase the chances of being published by Steam and Apple. Since I started attending GDC I sort of fantasized with getting an award at some time; and finally achieving it, I have more mindshare to spend on the game itself and in some ways, being more honest with myself.

The other news is that I am staying here at San Francisco for three months at Chris Hecker’s house working solely on Storyteller in a forced march, hanging out with other very smart people like Jonathan Blow and Marc Ten Bosch, so I am extremely happy.

So my main goal now: make a great game out of Storyteller!

Storyteller: Mechanics

Disclaimer: all this might change before release! It has happened before…

Storyteller has a simple interface: you drag actors into panels to give form to a story, but you don’t directly control how each character behaves. Each actor reacts according to his nature, of which there are several: villain, lover, hero, amnesiac, etc. All living characters have a common behavior: they all suffer when someone they care about dies or dumps them, and other common-sense rules.

The challenge of each “story” (or level) is to figure out how to make actors do what you want, how to fit that in 3 or 4 panels AND somehow match what the story goals.

In example above, Tim is missing Lucy because he fell in love with her the first frame. Lucy, however, is playing a villain so she is not only uninterested in Tim but also annoyed at his crush on her. What happens between the first and second panel is that Lucy left for some reason and Tim is still in love with her, thus him missing her. This is called closure, the core of what makes Storyteller work. Another, simpler example:

Adam here dies because the game concludes that since there’s a tomb in the second panel and only Adam is missing, he must have died. That’s the nature of the tomb in Storyteller.

Each one of the stories check if its conditions are met, but often they are not very specific, so you can find multiple solutions to the same story:

Some stories actually detect some interesting variants and hints you of their existence!

Right now, I am trying some new submechanics like flashbacks, that allow out-of-order story arranging:

Storyteller is an IGF 2012 finalist!

IGF 2012 Finalist

Storyteller has been picked as finalist for the Nuovo category by the Independent Games Festival, one of the biggest and well-respected festivals of the world. I’ve been on a trip for the past 20 days so I am dealing with all this just now, but these news are exciting and morale-boosting.

During the next two weeks I will finish the new version of the game, where I have rewritten the whole story-building algorithm, allowing me to write rules that give players more freedom. Now “The Lover”, who can fall in love with anybody can do some new interesting things: