Game Development Reference
In-Depth Information
12
Pragmatic XML Use in Tools
Amir Ebrahimi
12.1 Introduction
In this chapter, you are going to learn how to parse XML in a structured way,
serialize/deserialize objects to XML, and see how an XML-based toolchain can
assist in the development of an example game, Minimaxima . It is assumed that
you know what XML is, its format, and its general use on the Internet.
12.2 XML Specification
Serialization is an important topic to any game developer, whether he or she be
a tools, engine, or gameplay programmer. As a tools programmer, at some point,
you will need to store data for GUI layouts, user preferences, localization, custom
game editors, and other intermediate formats used for development purposes. As an
engine programmer, you will most likely need to store different model and texture
formats, asset metadata, profiling data, and the like. Gameplay programmers are
not free from serialization either, with the need to store AI state data, player
attributes, and recorded session data. While writing custom binary/text formats
can get the job done, using XML properly can save a developer time, allow for
flexibility, and ensure portability.
The first XML specification was formalized in 1998, although it began two
years earlier among a working group of 11 members [XML 10a]. While coming from
SGML, which had been around since the 1980s, XML was born as an answer to two
problems, both of which were data related. Firstly, the rise of the Internet begged
for a common interchange format that was good for just data and not data and
layout (i.e., HTML). Second, programming languages were needing an alternative
format to serialize objects in a human-readable form, which is commonly referred
to as data binding. Fast-forward ten years to 2008, and you find that most business
software had taken to XML quite well with common document formats being saved
natively in XML. On the Internet, XML would be used almost everywhere under
169
Search WWH ::




Custom Search