Saving and Loading Binary Data

There are many ways to save and load player data.
In this article we'll explore the binary format.
First, let's take a look at some example code.

Example Code




A few notes:

Enums are very powerful, they essentially map a string to any primitive data type,
such as byte, short, int, uint, etc. This can save a ton of space in savefiles,
compared to using strings to represent value types. Note that you will need to
cast values that are read to their proper enum type, and casting them when writing
also makes their type (and size) clear to the reader.