Monday, April 26, 2010

Nature Of Code Final: Game Of Lifetris

As I originally outlined in my proposal, for my Nature Of Code final I decided to create an implementation of Conway's game of life, and combine it with the classic computer game Tetris.  The result was one that, while not terribly fun to play, actually does go a long way in demonstrating that the game of life is more complex than it appears, and despite its simple rules, offers of a large degree of randomness.

I started by trying to discern the basics of the game, and came to the conclusion that I would need to start with some pieces/organisms already on the board.  The game of life tends towards decimating populations, so having no starting population lends itself to a quickly emptied (and boring) board.  Moreover, given the game's natural tendencies, I decided that I would make the aim of the game to allow pieces to live, rather than to destroy them (as was true in the original tetris).

I took this implementation and coded a simple version that was in black and white and played out a generation of the game of life after each tetris piece was dropped.  Once this was complete, I noticed a major problem:  Despite my hopes for the contrary, there's little way to discern what will happen in the next round of the game.

To work my way around this, I next tried implementing a "future" system, where the game would calculate the results of your current piece placement ahead of time, and attempt to show them to you in a translucent clear projection on top of the current board.  The problem with this is that, while interesting, it's still extremely difficult to tell whether you're creating or destroying pieces.

Continuing on my quest for at least some level of usability, I reached for one final implementation.  This time I maintained the "future" board concept, but also colored the tiles more strategically.  This time I made tiles that stayed alive black, tiles that died red, and tiles that were born green.  In this way, it's easy to try and maximize green and minimize red as you place your piece.

Once the interface was intuitive, I added a scoring system based on how many organisms were alive after each turn, and played the game a bit.  The unfortunate result is that it's not very fun.  While tetris allows you to create strategies and begin to intuit moves, the game of life is simply too random to be able to do anything but try and pick correct placement on a turn by turn basis.

Despite this fact, I think there could still be room for using the game of life mechanism to make for a fun game implementation.  Some cases that still seem to hold water did come to mind:  a game where there was a desire to finish with a very specific number of organisms, a game where all the organisms needed to be eliminated in a certain number of turns, or basically any game where the strategy was less about time and movement, and more about specific placement.

In short, the game of life is too random of an algorithm to function desirably in a time and movement based game.  I believe it would hold up far better under slower, ore strategic circumstances, and that tetris is certainly not.

Thursday, April 1, 2010

Sound And The City: Grid Music And Notation

Over the past few weeks, I've taken the idea put forth with orchestraSeating, and modified it significantly.  The modifications have been an effort to reduce the deployment overhead, increase the quality of musical delivery, and make for a musical system that was less spatially specific.  The result is a new version of the installation that I call, for reasons that will become obvious, Grid Music.

orchestraSeating was built around the premise of physical sensors, in a specific site, playing back multi-tracked versions of classical orchestra music.  While this premise is interesting, it is lacking on a number of fronts.  For one, it begs for a site-specific, resource-heavy installation (for example, the cafe at Alice Tully hall, above).  For another, it constrains the piece to the domain of classical music, and therefore requires that the installation and the piece has some level of synchronicity.

A grid overlaid on the Alice Tully seating plan

By contrast, gridMusic uses a grid overlaid on a public space to fuel a generative music engine.  The engine uses an overhead camera in concert with the grid to monitor activity, and then follow a set of rules related to that activity.  The rules are "activated" by movement within the space, and once activated, they cause playback of recorded clips, which yields the generative composition.

Much like Terry Riley's "In C", there are a set of clips (in this case, 20) that the algorithm has to choose from.  Also similar to Riley, the parts must be played in order.  However, the manner in which they are selected is based not on the personal preferences of the players, but by movement within the grid.  When movement is detected in a square of the grid, that square begins playback of Part 1 will continue looping until movement ceases in that square of the grid, and then begins again.  When movement restarts in a given square of the grid, that square is advanced to the next part.

This set of rules allows for easy visualization and state of the piece.  In other words: notation.  The squares that are active are colored, and indicate which clips are currently playing.  Every time any square on the grid changes, a new file representing the grid is saved, complete with a timestamp.  With the traversal of the various grids and their associated time stamps, one can easily discern the composition that was played back at the site for a given performance.

Because of the visually pleasing nature of the grid, it would not be unheard of to involve the grid in some way at the site.  This could be done as a projection or display on a monitor, and would perhaps help to invite the participation of individuals as they acted in the space.

As activity increased, the grid would become progressively more active, with colors varying and changing as per the algorithm's specification.  This would create a lively, interactive visual that would compliment the audio portion of the installation.  Moreover, if the composition were broadcast live to the web, it could be similarly accompanied by the progression of the grids.

As each square reached it's final "switch" from the black "part", it would return to it's original white, inactive state.  It would remain this way until all the squares came to rest, at which point after a duration of 5 minutes down time, the piece would begin again.