Game Engine Architecture

(Ben Green) #1
257

Command Line Arguments


The Uncharted engine scans the command line for a predefi ned set of special
options. The name of the level to load can be specifi ed, along with a number
of other commonly-used arguments.


Scheme Data Defi nitions


The vast majority of engine and game confi guration information in Uncharted
is specifi ed using a Lisp -like language called Scheme. Using a proprietary data
compiler, data structures defi ned in the Scheme language are transformed
into binary fi les that can be loaded by the engine. The data compiler also spits
out header fi les containing C struct declarations for every data type defi ned
in Scheme. These header fi les allow the engine to properly interpret the data
contained in the loaded binary fi les. The binary fi les can even be recompiled
and reloaded on the fl y, allowing developers to alter the data in Scheme and
see the eff ects of their changes immediately (as long as data members are not
added or removed, as that would require a recompile of the engine).
The following example illustrates the creation of a data structure specify-
ing the properties of an animation. It then exports three unique animations to
the game. You may have never read Scheme code before, but for this relatively
simple example it should be prett y self-explanatory. One oddity you’ll notice
is that hyphens are permitt ed within Scheme symbols, so simple-animation
is a single symbol (unlike in C/C++ where simple-animation would be the
subtraction of two variables, simple and animation).


simple-animation.scm


;; Define a new data type called simple-animation.
(deftype simple-animation ()
(
(name string)
(speed float :default 1.0)
(fade-in-seconds float :default 0.25)
(fade-out-seconds float :default 0.25)
)
)
;; Now define three instances of this data structure...
(define-exportanim-walk
(new simple-animation
:name “walk”
:speed 1.0
)
)

5.5. Engine Confi guration

Free download pdf