topical media & game development

talk show tell print

pattern(s) / matrix / model(s) / resource(s)

<a novref=true text=@key href=pattern-producer-consumer.html>Producer-Consumer</a>

Producer-Consumer

Producer-Consumer determines the lifetime of game elements, usually resources, and thus governs the flow of gameplay.

Games usually have several overlapping and interconnected Producer-Consumers governing the flow of available game elements, especially resources. As resources are used to determine the possible player actions, these Producer-Consumer networks also determine the actual flow of the gameplay. Producer-Consumers can operate recursively, i. e., one Producer-Consumer might determine the lifetime of another Producer-Consumer. Producer-Consumers are often chained together to form more complex networks of Resource flows.

Example: In Civilization, the units are produced in cities and consumed in battles against enemy units and cities. This kind of a Producer-Consumer is also used in almost all real-time strategy games.

Example: In Asteroids, the rocks are produced at the start of each level and are consumed by the player shooting at them. The same principle applies to many other games where the level progression is based on eliminating, i. e., consuming, other game elements: the pills in Pac-Man, free space in Qix, and the aliens in Space Invaders.

Using the pattern

As the name implies, Producer-Consumer is a compound pattern of Producer and Consumer and as such, this pattern governs how both are instantiated. The effect of producing and consuming Resources or Units often turns out to be several different pairs of Producer-Consumers, as the produced game element can be consumed in many different ways. For example, the Units in a real-time strategy game such as the Age of Empires series can be eliminated in direct combat with enemy Units, when bombarded by indirect fire, and finally when their supply points are exhausted. The Producer-Consumer in this case consists of the Producer of the Units with three different Consumers.

Producer-Consumers are often, especially in Resource Management games, chained together with Converters and sometimes Containers. These chains can in turn be used to create more complex networks. The Converter is used as the Consumer in the first Producer-Consumer and as the Producer in the second. In other words, the Converter takes the Resources produced by the first Producer and converts them to the Resources produced by the second Producer.

This kind of Producer-Consumer chain sometimes has a Container attached to the Converter to stockpile produced Resources. For example, in the real-time strategy game StarCraft, something is produced and taken to the converter and then converted to something else and stockpiled somewhere. Investments can be seen as Converters that are used to convert Resources into other forms of Resources, possibly abstract ones.

Consequences

As is the case with the main subpatterns Producer and Consumer of Producer-Consumer, the pattern is quite abstract but the effects on the flow of the game are very concrete. The Producer-Consumers simply govern the whole flow of the game from games with a single Producer-Consumer to games with complex and many layered networks of Producer-Consumers.

The feeling of player control is increased if players are able to manipulate either the Producer or Consumer part or both. However, in more complex Producer-Consumer chains, this can lead to situations where players lose Illusion of Influence as the effects of individual actions can become almost impossible to track down and the process no longer has Predictable Consequences. Also, adding new Producer-Consumers that the players have control over gives them opportunities for more Varied Gameplay. Producer-Consumer networks with Converters and Containers are used in Resource Management games to accomplish the Right Level of Complexity. The game usually starts with simple Producer-Consumers and, as the game progresses, new Producer-Consumers are added to the network to increase the complexity.

Relations

Instantiates: Resource Management, Varied Gameplay

Modulates: Right Level of Complexity, Investments, Units, Resources

Instantiated by: Consumers, Converters, Producers

Modulated by: Container

Potentially conflicting with: Predictable Consequences


[] readme course(s) preface I 1 2 II 3 4 III 5 6 7 IV 8 9 10 V 11 12 afterthought(s) appendix reference(s) example(s) resource(s) _

(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.