Game Development Reference
In-Depth Information
the AI of a very smart NPC. The earlier section “Functions of the Core Mechanics
in Operation” gave a list of the kinds of things mechanics do in a game.
Some mechanics operate throughout the game, while others apply only in particu-
lar gameplay modes and not in others. A mechanic that operates throughout the
game is called a global mechanic. Any game with more than one gameplay mode
needs at least one global mechanic that governs when the game changes from
mode to mode, and an entity that records what mode it is in.
RELATIONSHIPS AMONG ENTITIES
If the value of one entity depends upon the value or state of one or more other enti-
ties, you need to specify the relationship between the entities involved . In the case
of numeric entities, you express the relationship mathematically. Many role-playing
games, for example, define character levels in terms of experience points earned; when
a character earns a certain amount of experience, his level goes up. The formula may
be given by a simple equation, such as character level = experience points × 1,000 ,
or a more complicated equation, or it may require looking the value up in a table.
If the nature of this relationship remains constant throughout the game, you need
not worry about specifying when it should actually be computed; let the program-
mers decide that. Just specify the relationship itself.
EVENTS AND PROCESSES
When you describe an event or a process, you state that something happens:
A change occurs among, or to, the entities specified in the mechanics.
An event is a specific change that happens once when triggered by a condition
(defined in the next section) and doesn't happen again until triggered again.
“When the player picks up a golden egg” specifies a trigger condition, and “he
gets two points” defines an event.
A process refers to a sequence of activities that, once initiated, continues until
stopped. A player action or other game event starts a process that runs until some-
thing stops it.
NOTE Designing
the core mechanics
requires the greatest
clarity and precision of
language. Ambiguous
mechanics turn into
buggy code.
Both events and processes may consist of whole sequences of actions that the com-
puter must take. When you document such a sequence, be clear about the order in
which things should happen. Part of the sequence getting dressed might be, “First
put on socks, then put on shoes.” If you leave the language ambiguous and the pro-
grammer misinterprets your meaning, you will introduce a bug into the game.
Search WWH ::




Custom Search