Game Engine Architecture

(Ben Green) #1
799

particular machine; all the other machines have a lightweight version of the
object known as a remote proxy. When you mark a data member for replica-
tion, you are telling the engine that you want that data to be replicated from
the master object to all of the remote proxies. This allows a programmer or
designer to easily control which data should be made available across the
network. This indirectly controls the amount of network bandwidth required
by the game.


14.8.3.3. Lua


Lua is a well-known and popular scripting language that is easy to integrate
into an application such as a game engine. The Lua website (htt p://www.lua.
org/about.html) calls the language the “leading scripting language in games.”
According to the Lua website, Lua’s key benefi ts are:
z Robust and mature. Lua has been used on numerous commercial prod-
ucts, including Adobe’s Photoshop Lightroom, and many games, includ-
ing World of Warcraft.
z Good documentation. Lua’s reference manual [21] is complete and
understandable and is available in online and book formats. A number
of books have been writt en about Lua, including [22] and [43].
z Excellent runtime performance. Lua executes its byte code more quickly
and effi ciently than many other scripting languages.
z Portable. Out of the box, Lua runs on all fl avors of Windows and
UNIX, mobile devices, and embedded microprocessors. Lua is writt en
in a portable manner, making it easy to adapt to new hardware plat-
forms.
z Designed for embedded systems. Lua’s memory footprint is very small
(approximately 350 kB for the interpreter and all libraries).
z Simple, powerful, and extensible. The core Lua language is very small and
simple, but it is designed to support meta-mechanisms that extend its
core functionality in virtually limitless ways. For example, Lua itself
is not an object-oriented language, but OOP support can and has been
added via a meta-mechanism.
z Free. Lua is open source and is distributed under the very liberal MIT
license.


Lua is a dynamically typed language, meaning that variables don’t have
types—only values do. (Every value carries its type information along with it.)
Lua’s primary data structure is the table, also known as an associative array. A
table is essentially a list of key-value pairs with an optimized ability to index
into the array by key.


14.8. Scripting

Free download pdf