16.8CaseStudies 273
name = "Fission Battery"
value = +2
effect = chargeRate
Listing 16.2. Sample tuned data stored with explicit naming. The order of data appearance is
irrelevant in this format.
WritingData
One final aspect of data storage is considering what it is that actually writes the
data. Depending on all the possibilities mentioned above, a game might have a
dedicated PC-side tool communicating with it. In this case, storage can be initiat-
ed by the PC tool, requesting values for all tunable parameters and writing them
down in the project’s directory on the PC. The developer can then submit this
updated file to the source control system to be shared with the rest of the team.
This actually might be the sole possible option for some console systems.
Alternatively, for systems lacking interprocess communication but still run-
ning on console platforms, the game itself can write the values to its local folder,
and then the developer can manually copy the generated files by hand from the
console’s file system to the project’s directory.
16.8CaseStudies
Here, we present two case studies. The first is a simple one suitable as a guide for
smaller teams, and the second is more sophisticated and suitable for larger teams.
Quraish
Quraish is a 3D real-time strategy game, shown in Figure 16.3, developed in
from 2003 to 2006 for the PC platform by a small team made up of one game
designer, one level designer, three core programmers, and about eight artists and
animators. The game engine offers a separate world editor application for build-
ing maps, as well as for editing all entity properties and defining new races.
Both the game and the world editor share the core rendering and animation
engine code base. Thus, the editor provides an exact instantaneous view of the
game world when building maps. Since the core code is shared, data exchange is
very easy because the same C++ structures had to be written only once and then
used in both the game and the editor verbatim. The editor was written in C++
using the MFC framework.
274
Figure 1
6
The
loaded i
n
game u
s
needed
f
A
m
way. T
h
written
e
This wa
s
ageable.
types gr
e
In-g
a
the gam
e
fined to
b
Tun
a
Listing
1
using a
t
players
t
not to b
e
open in
t
6
.3. Image fro
m
editor stores
n
sections b
y
s
e ahead of t
i
f
or the data t
o
m
ajor amount
h
at is, there i
e
xplicitly for
s
feasible be
c
However, t
h
e
w to someth
i
a
me tuning
w
e
(see Figur
e
b
e
t
unable m
a
a
ble values c
o
1
6.3. The ga
m
t
ex
t
-parsing s
t
o tweak and
e
exposed to
t
ext format.
m
the game Q
u
all of its da
t
y
the game,
a
i
me. A poin
t
o
become usa
b
of tuning co
d
s no general
i
each entity
t
c
ause the nu
m
h
is could ha
v
i
ng above se
v
w
as possible
t
e
16.1) and it
a
nually in co
d
o
uld be writt
e
m
e can exec
u
ystem like t
h
modify the
g
the players
w
u
raish. (
I
mage
t
a in a singl
e
a
nd those sec
t
t
er fix-up pa
s
b
le (maps we
r
d
e was writt
e
i
ty towards
c
t
ype (e.g., u
n
m
ber of entit
y
v
e become a
v
en or eigh
t
.
t
hrough the
u
connected t
o
d
e through a
r
e
n to a C-scr
i
u
te both com
p
h
at described
b
g
ame in a fl
e
w
ere compil
e
16.
G
courtesy of D
a
e
custom dat
a
t
ions are pac
s
s is the onl
y
re also store
d
e
n in the edit
o
c
ode st
r
uctur
e
n
its, weapons
y
types was q
u
problem if
t
u
se of a con
s
o
C++ functi
o
r
egistration
p
i
pt file, like
t
p
iled and int
e
b
y Boe
r
[20
0
e
xible manne
r
e
d, and the r
e
G
ameTuning
a
r Al-
F
ikr Pub
a
base file th
a
ked and pre
p
y
pos
t
-load
o
d
similarly).
or in a game
e
s. Editors h
a
, buildings,
a
u
ite limited
a
t
he number
o
s
ole system
b
o
ns and vari
a
p
rocess.
t
he example
s
e
rpreted C-sc
r
0
1]. This was
r
. The files t
h
e
st of them
w
Infrastructu
r
lishing.)
a
t can be
p
ared for
o
peration
-specific
ad to be
a
nimals).
a
nd man-
o
f entity
b
uilt into
a
bles de-
s
hown in
r
ipt files
to allow
h
at were
w
ere left
r
e
16.8CaseStudies 275
#include "DataBase\QurHighAIDif.c"
ApplyWaterTax(SecondsToAITime(25), 1);
DayTimeScale = 0.1;
// Calling frequency of each need.
// Decreasing this makes the CPU more aware, not smarter!
BuildFrequency = SecondsToAITime(10000);
GenerateFrequency = SecondsToAITime(10000);
WorkFrequency = SecondsToAITime(50);
KillFrequency = SecondsToAITime(100000);
PolicyWith(2, AI_POLICY_ENEMIES); // Friend to the player.
PolicyWith(0, AI_POLICY_ALLIES);
CompleteUpgrade(AI_UPGRADEID_MONEYPRINT);
CompleteUpgrade(AI_UPGRADEID_ANAGLYPH);
SetMilitaryDistribution(0, 0, 50, 30, 40);
SetResourcesImportance(20, 60, 0, 20);
SetCaravansCount(0);
Listing 16.3. Code listing of a C-script file containing tuned values.
Unreal3/UnrealDevelopmentKit
At the heart of the Unreal 3 engine is UnrealScript, an object-oriented C++-like
language that is used to express all engine classes in need of reflection and gar-
bage collection services. The engine’s editor, UnrealEd, relies heavily on Unre-
alScript’s reflection information and annotations to provide convenient editing
capabilities.
Interestingly, UnrealScript is a compiled language, and the compiler is the
game executable itself. This can create situations with a circular dependency if
not handled with care since the game executable also relies on C++ header files
generated during script compilation.
Both the game and the editor are compiled in one executable that can launch
either of them through command line options. This allows the editor to inherit all
game features easily and instantly (e.g., rendering features) and to exchange tun-
ing data seamlessly. The disadvantage is that the editor can become very vulner-
276 16.GameTuningInfrastructure
able to bugs and crashes due to continuous development work occurring in the
game’s code.
The engine uses binary package files to store its information, which is neces-
sary for geometry and texture data, but it suffers from the binary data issues men-
tioned earlier in Section 16.7. Still, although the data is stored in binary format,
the engine is capable of handling data structure changes conveniently. For exam-
ple, variable order changes do not corrupt the data, and removing existing varia-
bles or adding new ones works just fine, without any additional effort needed to
patch existing package files.
The engine also allows in-game tuning outside of the editor through a con-
sole window that can access virtually any UnrealScript property or function. Val-
ues tuned this way are not meant to be persistent, though; they exist only for
temporary experimentation. Additionally, the engine uses
.INI files to read set-
tings across all areas of the game and the editor. The intention seems to be that
.INI files are used for global settings, and UnrealScript and UnrealEd are used
for per-object data.
16.9FinalWords
Provided with all of the possibilities and combinations in this chapter, a game
engine architect has to wisely choose the approach most suitable to the case at
hand, away from external influences that have no relevance to the project’s bene-
fit. At such a level, decisions must be based on sound reasoning. It is easy nowa-
days to get carried away by industry trends, but such trends will not work for all
studios and game projects. Deciding what level of tuning is needed for the game
is one requirement for shaping up a game’s engine architecture. Be wise!
Acknowledgements
I would like to thank Homam Bahnassi, Abdul Rahman Lahham, and Eric Lengyel for
proofreading this article and helping me out with its ideas.
References
[Bahnassi 2005] Homam Bahnassi and Wessam Bahnassi, “Shader Visualization Sys-
tems for the Art Pipeline.” ShaderX3, edited by Wolfgang Engel. Boston: Charles
River Media, 2005.
[Bahnassi 2008] Wessam Bahnassi. “3D Engine Tools with C++/CLI.” ShaderX6, edited
by Wolfgang Engel. Boston: Cengage Learning, 2008.
References 277
[Boer 2001] James Boer, “A Flexible Text Parsing System.” Game Programming Gems
2, edited by Mark DeLoura. Hingham, MA: Charles River Media, 2001.
[Jensen 2001] Lasse Staff Jensen. “A Generic Tweaker.” Game Programming Gems 2,
edited by Mark DeLoura. Hingham, MA: Charles River Media, 2001.
[Sweeny 1998] Tim Sweeny. UnrealScript Language Reference. Available at http://
unreal.epicgames.com/UnrealScript.htm.
[Woo 2007] Kim Hyoun Woo. “Shader System Integration: Nebula2 and 3ds Max.”
ShaderX5, edited by Wolfgang Engel. Boston: Charles River Media, 2007.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.142.40.32