Chapter    19

Storing and Recalling Game Data

Many games consist of different levels. Casual games such as puzzles and maze games may have several hundreds of levels. Until now, your games have relied on randomness to keep the gameplay interesting. Although randomness is a powerful tool to achieve replayability, in a lot of cases game designers want more control over how a game progresses. This control is generally achieved by designing levels. Each level is its own game world in which the player has to achieve some sort of objective.

With the tools you’ve used until now, for each level in a game you write a specific class in which you fill that specific level with game objects and add the behavior you want. This approach has a few disadvantages. ...

Get Swift Game Programming for Absolute Beginners 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.