February 27, 2009

The Marginal Advantage

Hello Blog Readers!

Here's an article on competitive game design that I wrote. Hope you enjoy!

---------

The Marginal Advantage
By Sean Plott

I recently was involved in a Mancala competition, where the entrants had to code an artificial intelligence program that could play Mancala. It taught me an important lesson about competitive game design.

Mancala is a game in which the winner is the player who “captures” more stones than his opponent. Thus the winner of the competition was the entrant whose AI program bested all others in stone capture. One of the coders devised a computer program that would maximize the number of stones captured in a given turn. Throughout the tournament, he steamrolled his opponents, repeatedly winning by fifteen stone margins and instilling fear and despair in the hearts of other coders. However, his program ultimately lost in the finals by 0-2, and lost each of those games by exactly one stone. In fact, I was shocked to hear that the winning program had consistently won every game it played by exactly one stone. How could the first program, which seemed to terrorize opponents, lose to another program that could only barely squeak out a victory each time?

The results were explained by subtle differences in their approaches to game play. The first player wrote a greedy program, one that would gobble up as many stones as possible. The coder reasonably theorized that maximizing the number of stones would maximize his chances of winning. However, the winning coder displayed even greater insight into the game: his goal was to have more stones after both players had taken a turn. In a sense, after taking the lead, he chose to maintain that lead, rather than extend it. For example, instead of capturing ten stones in a turn, he would capture four, knowing all the while that his opponent could only capture three, and that his lead would thus be extended by one. In a sense, the first programmer’s AI was successful in maximizing the number of stones captured in each turn, it just happened that this was always one less than the winner.

I found this incident to be particularly intriguing, as it reflects the nature of successful competitive game design. I’ve been involved in the competitive gaming community since 2001. Although my primary game is StarCraft, I have considerable experience with WarCraft 3, CounterStrike, Marvel vs Capcom 2, and a variety of other games. Despite the fact that these games function in drastically different ways and demand completely different skill sets, the expert players, the players who consistently win, always share a single commonality: they play comfortably with a marginal advantage.

The marginal advantage embodies the notion that one cannot, and should not, try to “win big.” In a competitive setting, the strong player knows that his best opponents are unlikely to make many exploitable mistakes. As a result, the strong player knows that he must be content to play with just the slightest edge, an edge which is the equivalent to the marginal advantage. More importantly, a one-sided match ultimately carries as much weight as an epic struggle. After all, the match results only in a win or a loss; there are no “degrees” of winning. Therefore, at any given point in a game, the player must focus on making decisions that minimize his probability of losing the advantage, rather than on decisions that maximize his probability of gaining a greater advantage. In short, it is much more important to the expert player to not lose than it is to win big. Consequently, a regular winner plays to extend his lead in a very gradual, but very consistent manner.

Amateur players, on the other hand, try risky, greedy strategies. In CounterStrike, for example, it is not unusual for amateurs to dash out into crowds of enemies trying to pull off a miraculous string of headshots in order to eliminate the opposing team. The majority of the time, this kind of amateur is fragged in a nanosecond. Expert Counterstrike players, on the other hand, patiently and carefully pick off enemies, knowing that such caution and precision virtually guarantee a win.

Moreover, amateurs often have no idea what to do with a marginal advantage once they gain one. I have personally watched countless games of StarCraft in which a player gained a massive lead but later lost the game. An opponent moves out a large force, and the amateur annihilates it with ease. At this point, the amateur has a marginal advantage: he has not yet won, but his opponent has lost his military and cannot apply any pressure for some time. The amateur in this situation will immediately try to win by launching a counterattack and will then crumble to a strong defense. Alternatively, the amateur will expand excessively, overextending his bases to the point where his defenses are too thinly spread. Such decisions violate the law of the marginal advantage, as they allow the opponent to get back into the game. They erroneously attempt to extend the lead, as opposed to maintaining it.

So, what’s so special about the marginal advantage? It might seem that all I’ve done is imply that newbie players take unnecessary risks and experts do not. However, just as playing for a marginal advantage is the hallmark of the expert player, the presence of a potential marginal advantage in a game is the hallmark of excellent competitive game design. The Mancala tournament brought this sharply into focus for me. Building in and allowing for a marginal advantage leads to exciting and dynamic play.

Not that providing for a marginal advantage is the only critical element in competitive game design. I will concede that all reasonably designed competitive games share three basic traits: ambiguity of optimal play, diversity of play, and allowance for skill.

First, there is no such thing as a good competitive game that has an obvious optimal strategy. For example, there is no competitive tic-tac-toe gaming, as two logical players would tie every time. I remember playing an old real-time strategy game called KKND, where one of the units was clearly the strongest unit in the game. Playing against my brother degenerated into a fray where we hurled masses of the same unit at each other until one of us got bored and stopped playing. On the other hand, a superior game like StarCraft presents a completely intractable problem. There is no best race, no best strategy, and certainly no best way to win.

Second, a quality competitive game should have a variety of techniques that can be employed in order to win. That is, if a player performs strategy A, the opponent should have more than one reasonable response as an option. Games frequently have a system of built-in counters. Theoretically, game creators insert such counters to avoid the danger of an optimal strategy. However, these kinds of systems often cause games to be nothing more than a fancy multimedia version of rock-paper-scissors: Unit A counters Unit B counters Unit C counters Unit A. On the other hand, excellent competitive games, such as Marvel vs Capcom 2, allow for huge diversity in response. In Marvel vs Capcom 2, players can elect three characters to form a fighting team. With fifty-six characters from which to choose, Marvel vs Capcom 2 offers over 25,000 combinations of possible teams, presenting the player with virtually unlimited options. At the highest level of play, strong competitive players can be seen using drastically different teams and styles.

Third, a good competitive game should test a player’s skills and minimize the element of chance or luck. Ideally, the probability of a weak player defeating a good player should be as close to zero as possible. For example, in a well-designed game like WarCraft 3, it is highly unlikely that an amateur will be able to control his units or respond to his opponent’s tech patterns as well as an experienced player. In fact, the best way to test a player’s skill in a game is to present the player with more decisions. In WarCraft 3, a player not only has to make major decisions, such as which buildings to make or what hero to choose, but also has to make innumerable small decisions, such as how to precisely control each unit or time an attack. By presenting a player with more decisions, the game offers amateurs more opportunities to make mistakes and experts more opportunities to shine.

However, against this framework of competitive game design, we can understand why the marginal advantage gives a game flavor and excitement for both the player and observer. The marginal advantage not only provides the player with the joy of overcoming obstacles, of finding new and more effective methods of winning, but also allows a player to express himself, to have his own unique style. By exploiting the marginal advantage, the expert player is both a problem solver and an artist. In WarCraft 3, StarCraft, Marvel vs Capcom2, and CounterStrike alike, we see the individuality of the players shine through: some play aggressively, some play defensively; some are renowned for their solid, steady play, others for their unorthodox tactics. We respect the brilliance of their expert skills; we admire their ability to win. Yet, at the same time, we appreciate the aesthetic of each player’s technique, that each player finds a solution that is so different from the next player. If too many decisions are clear cut, the player has no need to discover his own marginal advantage over the field, and the competitive game collapses into redundant, unexciting play, unappealing to master and unappealing to watch. The brilliance of a competitive game is that the designer must limit his role to be the creator and balancer, to allow for the potential of innovation. In this way, each player can uncover his own marginal advantage and become the true pioneer of the game.

Download file

February 19, 2009

Processing: Virus killing

This week's processing homework was to create a piece that related to some story or commented on some aspect of storytelling. My initial goal was to create a growing tree where the mouse cursor would "infect" certain branches if the cursor was too close. Similar to the game Life, adjacent branches would influence eachother, causing some to grow or fall off. The result would be an abstract representation of struggle, life, and death, a common theme in virtually all stories.

However, the library I used (traer physics), has certain painful limitations that prevented me from effectively creating what I wanted. That said, the result was still fairly cool. The final piece is a constantly growing virus that can be killed using the mouse cursor. The goal is to kill them all! (but they grow crazy fast).

Enjoy!

Download file

February 12, 2009

Processing: Commentary on the Economy

Hi blog readers! Here's a piece about the economy I wrote in processing:

Download file

Simply unzip and run in processing! : ]

-Sean

January 29, 2009

Processing: Sandy Paths

Here's another processing project created by myself and Jim Taylor, another first year MFA. You drag the mouse around the screen and it paints a sandy landscape colored by the sounds of the music.

Download file

To run this file, you need two libraries, the Minim audio library:

http://code.compartmental.net/tools/minim/

and the physics library:

http://www.cs.princeton.edu/%7Etraer/physics/

Also, you'll need to put an mp3 file in the same directory as the processing project and replace "missyou.mp3" with the appropriate song filename. I can't upload missyou.mp3 due to copyright purposes : ].

Enjoy!

-Sean

Processing: Pulsing Circles!

I created an extension of my last pulsing circles piece which incorporates "Minim," a sound library for processing. If you download the link below, you must change the input song name. In the code, search for "intotrees" and replace it with "<>.mp3". It's pretty fun to play with!

Download file

January 26, 2009

Processing: Ghosting Circles

I recently wrote a neat little program in processing that allows a user to place circles (by clicking the screen) and move them around by dragging the mouse. Each circle leaves a ghostly trail behind it as it moves. Paste the code into processing to experience it yourself!!!

-------

/* Sean's circle tracking extravaganza! it's the winningest!
* In this program, the user can click anywhere on
* screen and a ball of random color and size will
* appear on the screen! when the user moves the
* mouse around, the balls will move with some
* random correlation to the mouse movement
*
*/

//number of circles
int numCircs = 30;

circle[] circArray = new circle[numCircs];

void setup() {
//initialize all the circles
for(int i = 0; i < numCircs; i++) {
circArray[i] = new circle();
}


size(1024,768);
background(0);
fill(random(255),random(255),random(255));
noStroke();


//you can adjust the frame rate if you want O_O_O_O
//frameRate(100);

}

void draw() {
translate(1024/2, 768/2);
background(0);
for (int i = 0; i circArray[i].update();
}
}

void mousePressed() {
//draw an ellipse with a random size
for (int i = numCircs-1; i>0 ; i--) {
circArray[i]=circArray[i-1];
}
circArray[0] = new circle(mouseX-1024/2, mouseY-768/2, random(10,45), random(-2,2), random(-2,2), int(random(10,80)));
}


class circle {
float[] xPos;
float[] yPos;
float radius;
float factorX;
float factorY;
int numTrail;
int trackme = 0;

float c1 = random(255);
float c2 = random(255);
float c3 = random(255);

circle() {
numTrail = 1;
xPos = new float[numTrail];
yPos = new float[numTrail];
for(int i = 0; i xPos[i] = 0;
yPos[i] = 0;
}
radius = 0;
factorX = 0;
factorY = 0;
}

circle(float x,float y,float r,float fx, float fy, int Trails) {
numTrail = Trails;
xPos = new float[numTrail];
yPos = new float[numTrail];

for(int i = 0; i xPos[i] = x;
yPos[i] = y;
}
radius = r;
factorX = fx;
factorY = fy;
}

void update() {
trackme++;
rotate(PI*trackme*factorX*.5/4000);

float mouseChangeX = mouseX-pmouseX;
float mouseChangeY = mouseY-pmouseY;

// Reads throught the entire array
// and shifts the values to the left
for(int i=1; i xPos[i-1] = xPos[i];
yPos[i-1] = yPos[i];
}
// Add the new values to the end of the array
xPos[numTrail-1] += mouseChangeX*factorX;
yPos[numTrail-1] += mouseChangeY*factorY;

fill(c1,c2,c3, 28);
for(int i=0; i float divisor = (radius/numTrail)*i;
ellipse(xPos[i], yPos[i], divisor, divisor);
}

}

}

October 24, 2008

Turn any window into a speaker

With this simple, cute device, any window can be turned into a speaker.

September 20, 2008

Tangible Sequencing

This week, we've taken a look at some innovative interfaces for the manipulation and creation of sounds. However, suppose you're not interested in making sounds so much as making an actual piece of music. As mentioned, much of the software for sequencing music can be daunting and uninviting. So, we examine some more user friendly interfaces that emphasize tangibility.

A simple example is called the "BeatBearing." Placing ball bearings at specific locations generates a sound within the rhythm. Though the BeatBearing is fairly unsophisticated, its tangibility and creative approach to sequencing provides for a user-friendly experience. Moreover, it opens the door for consideration of other sequencing techniques. Consider the highly inventive "Phlock" in which music is created by the behavior of digital creatures.

September 17, 2008

DNA - Direct Note Access

Many technologies exist to manipulate audio waveforms. With virtually any audio software, a sound can be increased in pitch, stretched in duration, or filtered to change the timbre altogether. However, audio software has always been subject to certain technological limitations. For example, all the previously mentioned techniques can only be applied to a sound as a whole. If you played a piano chord, a manipulation would affect the entire chord, rather than a specific note. However, to address this exact problem, a German software company called Celemony has developed DNA - Digital Note Access

With Digital Note Access, an audio waveform can be broken down into components, each of which can be adjusted individually. As a result, a producer can change one note in a chord, or even one instrument in a recording. Moreover, the visual interface provides a simple, intuitive functionality to the entire system.

September 16, 2008

The Reactable

With the rise in digital technology, we gain the ability to easily sculpt interesting sounds and analyze noise at a fundamental level. However, though many enjoy fiddling with instruments, digital sound programs are oftentimes intimidating or difficult to learn. Consequently, the Music Technology Group at the Universitat Pompeu Fabra in Barcelona, Spain developed a tangible tabletop musical interface called "The Reactable"

The Reactable allows the user to create noises using physical objects and visual connections. As a result, the study and creation of noise becomes an interactive experience analogous to musical legos. Even somewhat confusing audio signal concepts such as low frequency oscillators, sequencers, or filters become straightforward visual blocks that can be easily used to construct complex sound structures.