Many games involve the player collecting items or choosing from a selection of items. Examples include collecting keys to open doors, collecting ammo for weapons, and choosing from a collection of spells to cast.
The recipes in this chapter provide a range of solutions for displaying to the player whether they are carrying an item or not, whether they are allowed more than one of an item, and how many they have.
The two parts of software design for implementing inventories relate to, first, how we choose to represent the data about inventory items (that is, the data types and structures to store the data) and, second, how we choose to display information about inventory items to the player (the UI).
Also, while ...