Chapter 4. Procedurally Populating Game Environments

Now that we're comfortable using Random Number Generator (RNG) with core C++ data types, let's have a look at how to create a highly randomized environment. This will include the random generation and positioning of items, enemies, and more. We'll also touch upon random map generation in this chapter before tackling it head-on toward the end of the book.

The way in which objects are spawned will largely depend on the infrastructure of your level data. With most 2D games, you'll be able to take an approach that is similar, if not identical, to the one demonstrated in this chapter. However, a 3D game requires more work because there's an extra dimension to deal with, but the principles are still ...

Get Procedural Content Generation for C++ Game Development 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.