Over at Emily Short's blog, she has an interesting post on whether interactive fiction games really need parsers.
One of the things that makes command-lines powerful in computer interfaces is the ability to chain together commands in novel ways (e.g. in Unix, listing files, and piping the results through a filter).
Guess-the-verb still exists (because nobody knows every possible command), but the user can (theoretically, at least) develop facility with all of them independently – anything can be filtered. There aren’t any special cases where the commands suddenly behave differently. All of the possible outcomes emerge naturally from combinations of commands.
The game-world analogue for this is a physical simulation – given a number of universally available options (walking, lifting things, letting things go, throwing things), and all outcomes emerge from combinations of these, in the context of the universal world rules (e.g. mass, gravity, the rigidity of objects, friction).
A given puzzle (e.g. press a button high up on a wall) might have many solutions – stack some boxes, throw a ball at it, etc., and perhaps only one or two of them were anticipated by the scenario author.
Once you get to a certain level of facility (e.g. you’re no longer trying to pick up the air, or ‘throw’ when you’re not holding anything), every sequence of actions does at least have an outcome. (Though you might not like it!)
In CDLIB (MUD software – I’m not sure how this compares with Inform), the situation is quite different.
While there are global verbs, like ‘north’ – many verbs are made available to the player by relevant objects. I can’t ‘smoke’ anything except a cigarette – I can’t ‘smoke twig’. (Unless I’m carrying a cigarette, in which case I might be told ‘You can’t smoke that.’) I can load my sling with pebbles, but not a stick of chalk.
Successful smoking and sling-loading are special cases, outcomes that were pre-planned. Many attempts to invoke these concepts result in no outcome at all.
Pocket interactive fiction occupies a very awkward position, to my mind. Immersion requires the promise that you could do anything, but specifying the flammability of every object in the game world is a crazy investment when all you want to do is let the player enjoy a post-coital toke in scene six.
One complicating factor is that a lot of the actions we wish to support in IF are very high-level. Smoking consists of numerous small actions (open packet, get cigarette from packet, put cigarette in lips (not mouth!), get match from matchbox, rub match on matchbox, touch cigarette with match, shake match).
Another complicating factor is the highly idiomatic nature of language – it only makes sense to ‘smoke’ a handful of things, but it’s immersion-breaking if we simplified and forced users to type ‘consume cigarette’.
So we resort to writing special cases needed to make the game go… but then we’re left repairing the immersion by writing endless witty no-outcome responses to unsupported actions like ‘smoke chalk’.
Thursday, 10 June 2010
Thursday, 3 June 2010
Three Year-Old Magic
This morning at breakfast, my three year-old, Leah, performed an incomprehensible magic trick. She's holding her hands behind her back, waving them around, then she's shouting "Ta-Da"! I have no idea what was going on in her mind, but she seems pretty pleased.
"Honey, you need to explain what you're doing so people can understand your trick."
To demonstrate, I make a fist and hold it up. "There's a penny in my hand, and I'm going to make it disappear!" I hadn't anything in my jeans pockets, so I'm just pretending - my fist is empty. Maybe I'll get a laugh out of it.
Morgan, my six-year old, perks up.
"Show me the penny! There's no penny in there."
After years of my lame daddy-magic tricks with pennies, Morgan now questions every step of the way. There's no way she's going to believe there's a penny in there unless she sees it first.
"You're right, Morgan," I say, "there's no penny in my hand. See, Leah, people need to understand what you're doing and believe it, otherwise the trick doesn't work."
I'm not going to fool anyone, but now I'm in the mood so I continue with my impromptu routine.
"Look, Leah, I'll make it disappear!" I say, holding up my still unopened fist. "I'm going to squeeze it down to nothing!" Loosening my grip, I poke my finger in one side, then in the other, ostensibly pressing the penny down to dust-speck size.
"Now that it's too tiny to see, I'm going to blow it out like dust!" I hold my fist to my mouth, blow through it, then theatrically fan open my fingers, showing my empty hand.
"Where's the penny?" I ask.
Leah thinks for a second. She wasn't born yesterday. She's turning four in a week, she's been around the block a few times now. She's seen this sort of thing before.
"It's in your ear!" she exclaims!
"Honey, you need to explain what you're doing so people can understand your trick."
To demonstrate, I make a fist and hold it up. "There's a penny in my hand, and I'm going to make it disappear!" I hadn't anything in my jeans pockets, so I'm just pretending - my fist is empty. Maybe I'll get a laugh out of it.
Morgan, my six-year old, perks up.
"Show me the penny! There's no penny in there."
After years of my lame daddy-magic tricks with pennies, Morgan now questions every step of the way. There's no way she's going to believe there's a penny in there unless she sees it first.
"You're right, Morgan," I say, "there's no penny in my hand. See, Leah, people need to understand what you're doing and believe it, otherwise the trick doesn't work."
I'm not going to fool anyone, but now I'm in the mood so I continue with my impromptu routine.
"Look, Leah, I'll make it disappear!" I say, holding up my still unopened fist. "I'm going to squeeze it down to nothing!" Loosening my grip, I poke my finger in one side, then in the other, ostensibly pressing the penny down to dust-speck size.
"Now that it's too tiny to see, I'm going to blow it out like dust!" I hold my fist to my mouth, blow through it, then theatrically fan open my fingers, showing my empty hand.
"Where's the penny?" I ask.
Leah thinks for a second. She wasn't born yesterday. She's turning four in a week, she's been around the block a few times now. She's seen this sort of thing before.
"It's in your ear!" she exclaims!
Wednesday, 19 May 2010
Spring: Inject My Bean
A few weeks ago I was wondering how you get Spring to inject an existing bean that I'd instantiated myself.
I'm trying to integrate our JUnit concurrent test runner with Spring's SpringJUnit4ClassRunner, and while plumbing the depths of the relevant spring code, I came across this:
public void inject(ApplicationContext context, String beanName, Object bean, int autowiringMode) {
AutowireCapableBeanFactory factory = context.getAutowireCapableBeanFactory();
factory.autowireBeanProperties(bean, autowiringMode, false);
factory.initializeBean(bean, "bean name");
}
inject(bean, "myBean", appContext, AutowireCapableBeanFactory.AUTOWIRE_BY_NAME);
Simple!
I'm trying to integrate our JUnit concurrent test runner with Spring's SpringJUnit4ClassRunner, and while plumbing the depths of the relevant spring code, I came across this:
public void inject(ApplicationContext context, String beanName, Object bean, int autowiringMode) {
AutowireCapableBeanFactory factory = context.getAutowireCapableBeanFactory();
factory.autowireBeanProperties(bean, autowiringMode, false);
factory.initializeBean(bean, "bean name");
}
inject(bean, "myBean", appContext, AutowireCapableBeanFactory.AUTOWIRE_BY_NAME);
Simple!
Tuesday, 13 April 2010
Ill-Advised Hibernate Mapping Quandary
I'm wondering if this is possible:
class Idea {
Collection primaryTags;
Collection secondaryTags;
}
class Proposal {
Collection primaryTags;
Collection secondaryTags;
}
Mapped to:
CREATE TABLE (
IDEA_ID VARCHAR(36), /* Foreign key */
PROPOSAL_ID VARCHAR(36), /* Alternate key */
TAG VARCHAR(100), /* Whatever was in the String */
TAG_TYPE VARCHAR(9) /* 'PRIMARY' or 'SECONDARY' */
);
I'm thinking.. no. My problem is that I can't see a way to get Hibernate to take care of the TAG_TYPE column - a value that exists in the database, and must be inserted whenever new rows are inserted, but has a value specific to the domain collection whence it came.
Hibernate supports computed properties, but those exist on the domain side, and not in the database. I want the opposite! :-)
class Idea {
Collection
Collection
}
class Proposal {
Collection
Collection
}
Mapped to:
CREATE TABLE (
IDEA_ID VARCHAR(36), /* Foreign key */
PROPOSAL_ID VARCHAR(36), /* Alternate key */
TAG VARCHAR(100), /* Whatever was in the String */
TAG_TYPE VARCHAR(9) /* 'PRIMARY' or 'SECONDARY' */
);
I'm thinking.. no. My problem is that I can't see a way to get Hibernate to take care of the TAG_TYPE column - a value that exists in the database, and must be inserted whenever new rows are inserted, but has a value specific to the domain collection whence it came.
Hibernate supports computed properties, but those exist on the domain side, and not in the database. I want the opposite! :-)
Monday, 12 April 2010
This blog has moved
This blog is now located at http://blog.trilemma.com/.
You will be automatically redirected in 30 seconds, or you may click here.
For feed subscribers, please update your feed subscriptions to
http://blog.trilemma.com/feeds/posts/default.
Monday, 2 November 2009
Giant Spider Costume
Each Hallowe'en, I get the urge to do something more interesting than just giving out candy and taking our kids around the block - wouldn't it be neat to have some scary street theatre going on? Imagine a ghastly wagon drawn by a team of drooling quasimodos in straight jackets, clanging an iron bell, wailing in agony and despair!
I wasn't quite that ambitious this year, but the spirit of Hallowe'en did move me to make a giant spider costume!
The main thing I wanted was the sense of independently moving legs. Not dangling legs, but legs that actually walk. I wondered if I built ski-like structures attached to my feet, I could use my legs to control four of the spider legs, and my arms to control the remaining four.
After testing a prototype using two paint-roller handles I had at home, I was very encouraged. I went to Home Depot and bought myself sixteen 48" of them (which cleaned out Home Depot!). Paint-roller handles are thin metal tubes, coated with a laminate that takes paint nicely. Tou can saw and drill through them easily, but they're strong, and most importantly they're light enough that they don't stress the home-made hinges I was relying on.
I then bought a second-hand set of hockey shoulder pads - a set with nice, large plastic shoulders I could screw into.
Actually, making the holes in the hockey pads was the most dangerous part! The synthetic fabric inside the shoulder pads can wind around the drill bit once you punch through the hard exterior. SNAP! Off to to the hardware store again to replace the drill bit.

The front and back legs were attached using hinges, to keep them in a vertical plane. The main problem with bent-knee designs is keeping the knees from falling sideways - which works okay for the "pile of spaghetti" costume, but not so well for a functioning spider.

The middle pair of legs on each side would be controlled by my arms, so I made universal hinges out of a loop of clothesline wire. Clothesline wire is fantastic, but definitely wear gloves. I duct-taped an old pair of sneakers to the bottom skis, and made a few wobbly laps around the basement.

The clothesline wire came in handy in several other places - creating the connection between the skis and the front/back leg pairs, and as flexible connectors for the handles to control the side-leg pairs.

To decorate the legs, I bought two thicknesses of pipe-insulating foam, and duct taped the heck out of it, then spray painted it in a mottled pattern.
Everyone was surprised that the spider wasn't going to be black, but I wanted as much contrast between the spider's legs and my own body as possible.

The head/body and abdomen were made out of inexpensive chicken wire, wrapped in plaster cloth. Chicken wire is a bitch to work with, especially if your shears are rusty, but it bonds to itself nicely and lets you make great volumes.

I'd planned to do three coats, but I settled for two in most places, with special reinforcement around the neck and other weight-bearing areas.

As soon as I got the eyes on the head, my six year-old refused to be in the same room as it. Since I was going to be lurching after her all night on Hallowe'en, I figured she ought to give it a cute name to help her not be afraid of it. She suggested, 'Bloodie'.

Walking around the house with my mask on, it became apparent that there wasn't nearly enough air flow. The neck seal was nice and tight, and the mask has a tendency to fill up with warm exhaled air. After getting a bit dizzy, I realized I could manage it by deliberately blowing out of the mouth-hole, which would cause fresh air to come in around the edges.
The pedipalps are are dollar-store plastic gourds!
As late as Saturday afternoon, I had yet to try all three pieces together. I could just about get the legs on by myself, but I needed help for the other pieces. As the clocked ticked down to trick-or-treating time, my construction got more and more improvised.
The abdomen was held on by a garrotte-like loop of clothesline wire, which I kept off my neck by passing it through a luggage strap that I fastened around my chest.

The head was then fastened on using a combination of clothesline and bungee cords. One problem was that the abdomen hung down limply like a backpack, instead of sticking straight out - we tried some last-minute engineering but we couldn't make it work in the twilight, so I went out droopy!
As I was sealed in, I got a brief spell of claustrophobia. The abdomen pushed the head far forward, so all I could see was a patch of ground directly in front of me - only a foot or so past my forelegs.
I would need a spider-herder! Fortunately I had a couple of volunteers, my wife (who seems to have escaped the evening without being in a photo) and my sister-in-law, Julain:

Looking at this photo now, I realize her make-up job was way more hideous than my spider! She looks like she's possessed by the ghost of Quentin Crisp. *shiver*

I laugh when I see this photo, the caption ought to be, "Middle-aged weirdo dresses up to hiss at your children." I guess the effect was much better in person because Hallowe'en night itself was a blast.
People kept stopping us to take photos of us, or have their friends take one of them with us, and a couple of cars were nearly rear-ended.
That made up for the fact that walking around like this is like trying to manage two sets of ski equipment at the same time while working out in a sensory deprivation tank. Just crossing the road was an act of faith in my handlers. I could see my legs light up in the car headlights, but very little else!
I tripped several times on the sidewalk, but fortunately the only fall was during the test run in the afternoon. (Avoid grass. And curbs.)
Fortunately I could hear the shrieks and laughs of the other passers by, which was a lot of fun. All in all a great success!
I wasn't quite that ambitious this year, but the spirit of Hallowe'en did move me to make a giant spider costume!
The main thing I wanted was the sense of independently moving legs. Not dangling legs, but legs that actually walk. I wondered if I built ski-like structures attached to my feet, I could use my legs to control four of the spider legs, and my arms to control the remaining four.
After testing a prototype using two paint-roller handles I had at home, I was very encouraged. I went to Home Depot and bought myself sixteen 48" of them (which cleaned out Home Depot!). Paint-roller handles are thin metal tubes, coated with a laminate that takes paint nicely. Tou can saw and drill through them easily, but they're strong, and most importantly they're light enough that they don't stress the home-made hinges I was relying on.
I then bought a second-hand set of hockey shoulder pads - a set with nice, large plastic shoulders I could screw into.
The front and back legs were attached using hinges, to keep them in a vertical plane. The main problem with bent-knee designs is keeping the knees from falling sideways - which works okay for the "pile of spaghetti" costume, but not so well for a functioning spider.
The middle pair of legs on each side would be controlled by my arms, so I made universal hinges out of a loop of clothesline wire. Clothesline wire is fantastic, but definitely wear gloves. I duct-taped an old pair of sneakers to the bottom skis, and made a few wobbly laps around the basement.
The clothesline wire came in handy in several other places - creating the connection between the skis and the front/back leg pairs, and as flexible connectors for the handles to control the side-leg pairs.
To decorate the legs, I bought two thicknesses of pipe-insulating foam, and duct taped the heck out of it, then spray painted it in a mottled pattern.
Everyone was surprised that the spider wasn't going to be black, but I wanted as much contrast between the spider's legs and my own body as possible.
The head/body and abdomen were made out of inexpensive chicken wire, wrapped in plaster cloth. Chicken wire is a bitch to work with, especially if your shears are rusty, but it bonds to itself nicely and lets you make great volumes.
I'd planned to do three coats, but I settled for two in most places, with special reinforcement around the neck and other weight-bearing areas.
As soon as I got the eyes on the head, my six year-old refused to be in the same room as it. Since I was going to be lurching after her all night on Hallowe'en, I figured she ought to give it a cute name to help her not be afraid of it. She suggested, 'Bloodie'.
Walking around the house with my mask on, it became apparent that there wasn't nearly enough air flow. The neck seal was nice and tight, and the mask has a tendency to fill up with warm exhaled air. After getting a bit dizzy, I realized I could manage it by deliberately blowing out of the mouth-hole, which would cause fresh air to come in around the edges.
As late as Saturday afternoon, I had yet to try all three pieces together. I could just about get the legs on by myself, but I needed help for the other pieces. As the clocked ticked down to trick-or-treating time, my construction got more and more improvised.
The abdomen was held on by a garrotte-like loop of clothesline wire, which I kept off my neck by passing it through a luggage strap that I fastened around my chest.
The head was then fastened on using a combination of clothesline and bungee cords. One problem was that the abdomen hung down limply like a backpack, instead of sticking straight out - we tried some last-minute engineering but we couldn't make it work in the twilight, so I went out droopy!
As I was sealed in, I got a brief spell of claustrophobia. The abdomen pushed the head far forward, so all I could see was a patch of ground directly in front of me - only a foot or so past my forelegs.
I would need a spider-herder! Fortunately I had a couple of volunteers, my wife (who seems to have escaped the evening without being in a photo) and my sister-in-law, Julain:
Looking at this photo now, I realize her make-up job was way more hideous than my spider! She looks like she's possessed by the ghost of Quentin Crisp. *shiver*
I laugh when I see this photo, the caption ought to be, "Middle-aged weirdo dresses up to hiss at your children." I guess the effect was much better in person because Hallowe'en night itself was a blast.
People kept stopping us to take photos of us, or have their friends take one of them with us, and a couple of cars were nearly rear-ended.
That made up for the fact that walking around like this is like trying to manage two sets of ski equipment at the same time while working out in a sensory deprivation tank. Just crossing the road was an act of faith in my handlers. I could see my legs light up in the car headlights, but very little else!
I tripped several times on the sidewalk, but fortunately the only fall was during the test run in the afternoon. (Avoid grass. And curbs.)
Fortunately I could hear the shrieks and laughs of the other passers by, which was a lot of fun. All in all a great success!
Tuesday, 16 June 2009
Unbelievably Good Banana Curry
I ad-libbed a curry yesterday, and the leftovers were so good today I nearly ate my wife's portion. It's a sweet, very mild curry - which was great for our kids. Adding the banana is something my father does!
Here's the recipe as best I can remember it:
For a vegetarian version, I usually replace the meat with chick peas (man, I love chick peas) and immediately after adding the tomato I take a wand blender and blend the chick peas, zucchini, onion and tomato until some of it is pureed (makes it nice and thick) but there are still identifiable bits in it.
Here's the recipe as best I can remember it:
- Fry 1lbs ground chicken or turkey until cooked, set aside;
- In a pot, fry 2 medium onions, 1 zucchini until cooked;
- Add spices, allow them to roast for a minute or two:
1.5 tsp curry powder
1 tsp turmeric
a pinch of cinnamon - Add the remaining ingredients:
796mL can of diced tomatoes
the cooked meat
2/3 of a medium banana, chopped
1/4 cup dried currants - Bring to gentle boil, then reduce heat to simmer a bit;
- Add salt, cayenne pepper to taste.
For a vegetarian version, I usually replace the meat with chick peas (man, I love chick peas) and immediately after adding the tomato I take a wand blender and blend the chick peas, zucchini, onion and tomato until some of it is pureed (makes it nice and thick) but there are still identifiable bits in it.
Subscribe to:
Posts (Atom)