Saturday, September 25, 2010

Inform7 Interactive Fiction

I made this interactive fiction project almost a month ago, but I wanted to post about it before I forgot entirely. It was written in Inform7 and it starts off like this:
"Birthday" by Kathleen Tuite
A top hat is worn.
I wanted to make a game for Adam's birthday. One without any art assets. The thought of having to design and build a game, and draw stuff for it, was kind of overwhelming, especially given that I didn't start until after his birthday and kind of wanted to finish within a day or two.

Once upon a time, Adam took this computer science class at UC Santa Cruz: Interactive Storytelling. I wasn't in the class, but I saw him write a crazy text adventure (Play it here! Troy) using something called Inform7. It might be cool to learn!, I thought, so I did.

What is Inform7? It is a free program that lets you compose interactive fiction/text adventures by writing English. Just a whole long list of natural language sentences describing the world or actions in the world. (The sentences don't even have to be organized particularly well... my story starts of rambling about cats and top hats before it even gets into describing the room layout of the world.) Then you hit 'play' and you get a cool little text-based world where you can walk around, interact with things, explore, solve mysteries, etc.

Screenshot of Inform7

The great thing about making a game this way is that you get all this rich, descriptive power for the low cost of writing out a few sentences. This book, written very recently by someone at UCSC, has a more descriptive and awe-inspiring chapter on the descriptive power of interactive fiction. I am no great IF artist (yet?) but here's how I described my couch:

A couch is an enterable supporter in the Living Room. "There is a couch in here, which looks perfectly sittable."


The description is "The couch is dark green leather with a few cat hairs stuck to it."


After entering the couch: say "The couch cusions give way with a little floof and you make yourself comfortable.".

I also added some cats to my game, because Inform7 already knows about things like people and animals:
A cat is a kind of animal.
A cat is either playful, hungry, bored, sleepy or sneezy.

To make the cats more catlike, I found a feline-behavior rulebook in the documentation and adapted it to fit the behavior of my own cats and to try to get them to follow the player around between different rooms.

The end result in my case, which took me about a day and a half to put together, including the time it took to learn Inform7, is playable here: http://superfiretruck.com/if4adam/. (Bonus, there's a 'for release' sentence you can add that spits out a pretty webpage for your game!)

Click here to check it out online!



The goal of the game is to find and eat the birthday cake. The catch is that you have to be in the presence of cats (have them in the same room with you) to enjoy the cake, so you have to find the cats also and have them follow you to the location of the cake. Play it and let me know what you think! I know it's not perfect and there are was to do unrealistic things or get stuck. Feel free to cheat by reading the source code.

Tuesday, September 21, 2010

ImageMagick

This post is dedicated to the 10-years-younger version of myself when I was trying to put a photo album on my website and didn't have an efficient way to resize all my images and make thumbnails. I think I opened them all up in photoshop and developed a fairly quick and repeatable sequence of clicks and key presses to manually resize each image. Basically, I'd go into mechanical robot mode, even though I was using a computer capable of automating all that for me.

These days, if you search 'batch image resize', you'll find a bunch of pointy-clicky software that will do the job. But I'm going to talk about the command line approach, since most of those programs are just awkward GUIs wrapped around this library anyway.

Behold: ImageMagick! (http://www.imagemagick.org/)
Perfect for the teen with the website photo album, perfect for the grad student who deals with a ton of images and photos.

First: Get it installed. This part is probably the trickiest, and other places on the internet can tell you how it's done. Essentially, you can download an installer for any operating system, though you might have to figure out how to change a 'path' or two so your computer knows where to find imagemagick. I believe imagemagick is sexiest when used on linux or mac. I might have tried to get it through cygwin back in my windows days. If you get it through cygwin, you can just check the cygwin install box that says you want imagemagick included. Once it's installed, it's not a program that you launch so much as a COMMAND LINE TOOL that you run with a few sensible arguments that super-easily gets what you want done.


Try typing 'convert'.

You don't actually type or run imagemagick anymore, that's just what's responsible for making the 'convert' command available. If it spews a bunch of text about which version, how to use, etc, that's great! That's the documentation that you can look through later to find all the magical things that imagemagick is actually capable of.

Now for some examples of what I often use the 'convert' command for:

Resizing a single image:
convert -resize 200 boycat.jpg small_boycat.jpg
(this makes the new image 200 pixels wide.)

convert -resize x200 boycat.jpg taller_boycat.jpg
(notice the x before the 200. this makes the new image 200 pixels TALL instead.)

Here's an image of the 3 different sizes of the photo of my cat!

Resizing multiple images:
I have 3 images now of my cats. I want to make thumbnails of each of them. I COULD type out:
convert -resize 200 boycat.jpg small_boycat.jpg
convert -resize 200 boycat2.jpg small_boycat2.jpg
convert -resize 200 girlcat.jpg small_girlcat.jpg

OR I could type this magical bash for-loop:
for i in *.jpg; do convert -resize 200 $i small_$i; done



You can see that there are now 2 versions of each image and that the "small_" ones are much smaller in filesize!

Converting between image types:
This is so ridiculously easy. You want to make one of your .jpg photos into a .png?
convert small_boycat.jpg small_boycat.png

Combining several images into a single image:
Sometimes I need to stick a few images together for whatever reason.
There are 6 images in my folder of cat images right now (3 original-sized and 3 smaller ones from the multiple resize command), and I only want to use the 3 small ones. To do so, I use this command:
convert -append small_*.jpg catstrip.jpg



That makes the image form a tall column, like from a photo booth. It turns out that to make a horizontal montage, change -append to +append!
convert +append small_*.jpg catstrip2.jpg



There! Cute cats and some useful image-manipulation tidbits. Find out all the other cool stuff you can do with 'convert' here: http://www.imagemagick.org/script/convert.php

Friday, September 10, 2010

PhotoCity Summer

PhotoCity doesn't have its own blog, but I do! (As of very recently...) So let me tell you all about what happened with the game this summer.

The epic competition between University of Washington and Cornell that brought in over 100,000 photos (wow!!) wrapped up in late May. From then until mid-June was a mad rush to get everything ready for the Foundations of Digital Games conference, followed immediately by taking PhotoCity the Smithsonian Folklife Festival.

Here's a shot of the Arts Quad at Cornell reconstructed by PhotoCity players:

(see full size)

FDG
We presented on PhotoCity at FDG. You can find the paper, presentation, videos, etc. on my home page: http://www.cs.washington.edu/homes/ktuite/. The paper discusses the design challenges of designing a hybrid alternate reality game with a purpose (or "ARGWAP"). In other words, a GWAP played out in meatspace. This was the first thing we ever published on PhotoCity, and my first conference talk! And oh boy, what an exciting talk! Conference attendees may remember it as being in the session where the projector was totally busted and we had to give our talks with 50% of our slides missing. I still think I gave a pretty good talk, though.

During the conference, I took some photos around Asilomar Conference Center, and added them to the game. The textured wood and cloudy skies made the seeds look really nice.




Also, there was a tiny pony:
FDG pony

This photo would probably fit into the 3D model. A 3D pony would not magically appear, though. Maybe he's textured enough, but he's in a different position in the other photos I have of him.

Smithsonian Folklife Festival
Right after FDG, I flew from California out to DC. The guys from the Smithsonian 3D digitization team contacted us and proposed having attendees of the Foklife Festival, the annual 2 week, million-people multi-cultural festival, play PhotoCity and reconstruct the Smithsonian buildings all around the National Mall.

Visiting DC was really cool. Having a presence at Folklife was cool. We had a booth with a computer set up and we'd show people the models and tell them that they could contribute just by taking photos with their own cameras.

photocity booth


Some people played. Some people submitted a few hundred photos each. One person submitted over 1,000 photos! The problem was that people at Folklife (the visitors) didn't really understand the game. "Me? My camera? You mean I have to remember to upload my photos when I get home? Whaaaat?" The lesson: In it's current incarnation at least, PhotoCity totally fails as a casual game. It's too involved, too complex, also too awesome for mere mortals to comprehend.

The rest of the summer
Nothing really happened with PhotoCity the rest of the summer. I took a hiatus, and therefore the game took a hiatus. I went to a workshop on Human Computation and talked to some people about PhotoCity and their own crowd sourcing methods. I traveled and took photos in exotic places. (Like Massachusetts... and Barcelona...) If only the game worked well enough for me to upload my photos!

Now
Right now, I am working on a second PhotoCity paper.

It is also important to me to fix up PhotoCity so that it's stable and usable and fun again. The main things I want to fix are:
- making it super easy (and fast) for anyone to add seeds anywhere
- figuring out a better solution to the problem of occasionally running out of disk space
- reprocess the models that are sort of gnarly (sometimes when a model grows, it gets kind of unruly and extra walls or other weird growths appear)

So, Internet, I am open to suggestions about the most important things to improve about PhotoCity!