Chapter 5
Magic as Programming,
Programming as Magic
  ,  programming is magic. is cen-
tral idea shapes the entire structure and content of this book. e
process of programming magic systems in videogames is itself a magi-
cal act. Such an analogy does not have to doom designers to a maze of
innite regression and meta-level self-reexivity. Rather, we as designers
who program will be better able to create rich, intricate magic systems if
we recognize the underlying technological framework of these systems as
based on codes that themselves resemble magic. Recognizing the magic
of programming can help keep our motivation and morale high when
the daily routine of design becomes dicult. inking of magic as pro-
gramming can also assure that our designs are rigorous and susceptible to
implementation through the mathematically-based logic of programming
is book is a grimoire in the classic sense of sorcerer’s manual or spell-
book. Abelson and Sussman, in their classic programming textbook e
Structure and Interpretation of Computer Programs, express this idea as
a compelling and subtle metaphor. eir book is commonly referred to
as “e Wizard Book” because of the picture of a wizard on the cover.
Abelson and Sussman write:
People create programs to direct processes. In eect, we conjure the
spirits of the computer with our spells.
180 Game Magic
A computational process is indeed much like a sorcerer’s idea of a
spirit. It cannot be seen or touched. It is not composed of matter
at all. However, it is very real. [] e programs we use to conjure
processes are like sorcerers’ spells. ey are carefully composed
from symbolic expressions in arcane and esoteric program-
ming languages that prescribe the tasks we want our processes to
Abelson and Sussman create a powerful analogy between spirits and
computational processes, both of which are disembodied, potentially
powerful, and dicult to control. e authors also note a powerful resem-
blance between spells and programs, both of which are comprised of com-
binations of symbols that give instructions to ethereal entities. Abelson
and Sussman also note the demanding rigor of the symbolic languages
associated with both spells and programs, which can produce unexpected
and dangerous results if the magician or programmer is not careful. As
they wryly note, “like the sorcerer’s apprentice, novice programmers must
learn to understand and to anticipate the consequences of their conjur-
ing” (1). e unintended consequences of spells are legendary in works
of fantasy and occultism, as Mickey Mouse’s struggles with hundreds of
rebellious buckets and brooms suggest.
Yet, as Frederick P. Brooks explains in e Mythical Man Month, the
exacting requirements of technical perfection are actually part of what
makes programming magical. Under the heading “the joys of the cra,
Brooks argues, “e magic of myth and legend has come true in our time.
One types the correct incantation on a keyboard, and a display screen
comes to life, showing things that never were nor could be” (78). Like
Abelson and Sussman, Brooks believes that the magic of programming
is the ability to use symbolic utterances to cause powerful eects in the
real world, as well as conjuring “things that never were” out of the human
imagination and into representation or simulation. It is not a far jump
from Brooks’ axiom about the magic of programming computers gen-
erally to the magic of programming computer games specically, since
computer games are entirely dedicated to representing and simulating
imaginary situations. Yet in order to make these miraculous eects occur,
Brooks recognizes that programming itself is highly demanding and
dicult. Heexplains, “First, one must perform perfectly. e computer
resembles the magic of legend in this respect, too. If one character, one
pause, of the incantation is not strictly in proper form, the magic doesnt

Get Game Magic now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.