Game Development Reference
In-Depth Information
Chapter 12
by David “Rez” Graham
Scripting with Lua
In the past decade or so, games have started to become much more data driven. For
example, the Actor system lets you create whole classes of different actors by just
mixing and matching different components. You can even add and remove compo-
nents at runtime, making it possible to completely change an actor
'
s definition,
behavior, and properties without having to recompile and relaunch the game. The
days of having hard-coded constants that affect gameplay are coming to a close,
being replaced by tuning hierarchies that are completely in the hands of the designers.
As a programmer, my job is becoming more about enabling the designers, artists, and
musicians to be creative. I spend my days creating tuning hooks for them to play
with the simulation. This is an incredibly powerful concept because it means that
once a system is working, the designers can iterate on it without having to talk to
me at all. On The Sims, a programmer doesn
t need to be involved in creating every
single television, he just needs to figure out the first one. And with a bit of cleverness,
he may not need to be involved in any television objects at all since they can be
defined entirely in data. The available channels, the amount of fun it provides, and
so on can all be set by the designers.
This chapter is much more than just coverage of Lua syntax and how to embed a
scripting language into your game. I want to take you back to the very early days of
computer programming and talk about how languages evolved from machine code
up to the high-level languages we have today. With a little background, I hope to
give you a better context for why you might want to use a scripting language at all
'
329
 
 
 
Search WWH ::




Custom Search