Chapter 5. Creating Unique and Randomized Game Objects
In this chapter, we're going to make our classes more random. We touched on a similar subject matter in Chapter 3, Using RNG with C++ Data Types, by giving the player random stats, so we'll continue further down that path and build bigger, more versatile procedural classes.
Having game items generated randomly is a great way to bring versatility and replayability to a game. For example, all the weapons in Borderlands are generated randomly; each chest and loot drop will contain a unique item. It brings an element of unknown to the game, and each time you find an item there's no knowing what it could be.
In this chapter, we'll cover the following topics:
- Giving objects random sprites
- Generating random traits for our player
- Assigning stats randomly
- Procedurally generating a range of game items