Game Development Reference
In-Depth Information
20
YAML for C++ :
Applied Data-Driven Design
Sebastien Noury and Samuel Boivin
20.1 Introduction
Data-driven design (DDD) is a way of organizing software so that the logic code is
completely independent from the data structures on which it acts [Wilson 02]. This
kind of design greatly reduces integration time in game projects where developers
frequently iterate over the engine's code while artists and other content providers
integrate their assets and finely tune the gameplay. When the code/data separation
is not clear, incorporating these changes can be a daunting and time-consuming task
for developers, especially when using a statically typed language like C++.
Many solutions exist to implement DDD principles, relying on various data
formats, but most fail to address all of the following requirements at the same
time:
human legibility of the data;
ease of integration into the code;
support for structured data containers.
While data description languages are plentiful, ranging from the simple comma-
separated values (CSV) format to the full-fledged XML format, very few of them
address the aforementioned requirements needed for adoption on both sides of the
equation: developers and content providers.
In this chapter, we first introduce YAML, a human-readable, structured data
serialization language. Then, we present the yaml-cpp library for parsing YAML
and provide a thin wrapper to seamlessly integrate it into C++ projects. Finally, we
solve three real-world scenarios with our DDD solution to demonstrate its strengths
and ease of use.
279
Search WWH ::




Custom Search