Chapter 14

Level Files and Binary Data

This chapter explores how to load and save JSON-based level files representing the game world. These level files store global properties as well as properties of all the actors and components in the game.

In addition, this chapter explores the trade-offs of using text-based file formats versus binary file formats. As an example, it discusses an implementation of a binary mesh file format.

Level File Loading

To this point, this book hasn’t used a data-driven approach to the placement of objects in the game world. Instead, the Game::LoadData function code dictates the actors and components in the game, as well as global properties, such as the ambient light. The current approach has several disadvantages, ...

Get Game Programming in C++: Creating 3D Games, First Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.