Affordance, to put it simply, is the quality of an object that communicates a way to use it. It is more accurately called "perceived affordance," as the operation that an object communicates depends entirely on user goals, past experiences, and context. A videogame padlock, for example, has no intrinsic affordance—It may afford lockpicking in Thief, but shooting in Max Payne or Half-Life. Last year Matthew Gallant wrote a post about how the principles of affordance can be used effectively with physical game interfaces, but I'd like to take a quick look at how affordance applies to objects in a game world.
A significant part of game and level design is in fact affordance design. When playtesters react in completely unexpected ways, frustrating observers by not playing the game at all how was designed and expected, it is entirely the fault of ineffective affordance. No amount of theory and instinct will eliminate the need for playtests, but identifying the contexts and varieties of player history/experience required for an intended perceived affordance will make it more likely that players will "get" the game with fewer iterations of reactionary design.
Problem areas can be found by dividing affordance into three categories: Perceptible, hidden, and false.
This padlock near the beginning of Half-Life 2 is an example of false affordance. My perceived affordance for the padlock, having played Half-Life and many other action FPS games, is that it can be shot off and the gate opened. At this point in the game, however, the player has no weapons or even a crowbar with which to perform the action that the object (by its very existence) suggests can be performed. The player never returns to this area, and the gate never opens. Upon encountering a padlock like this later in the game, past experience with this first one may create a mental block where the idea of a gate with a padlock being opened doesn't even enter the player's mind. The possibility of this scenario occurring is perhaps tiny, but good design practice suggests that a first encounter with an object that communicates a perceived affordance should allow that action to be carried out. Even if there were no other padlocks in the game, this would still be a false affordance for a certain portion of players because genre conventions dictate that oversized padlocks can be shot off doors. Ignoring conventions is a tricky business and requires conditioning players over time.
The ability to pick up objects is a hidden affordance until the prompt in the above screenshot appears (or the player reads the manual, or has the past experience to make it immediately perceptible). Hiding an affordance until the appropriate time in a tutorial section is far better than simply disabling functionality expected by an experienced player. But if an affordance is hidden for too long it becomes ridiculous—Assassin's Creed 2 was teaching me ways to interact with the environment hours after I had discovered them on my own.
A hidden affordance from Half-Life 2 that is never explained and made perceptible to all players is pressing E to provoke an extra line or two of dialogue from NPCs. There's really no excuse for that. A simple prompt not unlike the others shown here would have sufficed.
Half-Life 2 does an excellent job at making the affordances associated with physics objects perceptible to all players. Two explicit prompts tell players exactly what they need to do. First, "E Pickup Object" in a room with nothing but large crates. A crate must be picked up and dropped in order to progress. Second, "MOUSE1 Throw Held Object" after a guard tells you "Pick up that can". The player must pick up the can without being reminded which key to press, to make sure the knowledge is retained. A new action must be performed in order to progress and every physics object subsequently encountered may now afford throwing. And perhaps most brilliantly, the large crate and small can used in these tutorial segments perfectly define the upper and lower size limits of loose objects that can be picked up.
The ultimate goal of the designer is to infuse every responsive element of the game with a perceptible affordance that is internally consistent. These affordances must be evaluated against various levels of player "game literacy" and some reasonable effort should be made to reveal through tutorial training any that are determined to be hidden. Finally, the false affordance that is a result of inconsistency within the game should be avoided at all costs. There's nothing wrong with deviations from genre conventions that are internally consistent as long as the new intended affordance is revealed through effective training.