Procedural Content Generation for C++ Game Development

Get to know techniques and approaches to procedurally generate game content in C++ using Simple and Fast Multimedia Library

Procedural Content Generation for C++ Game Development

This ebook is included in a Mapt subscription
Dale Green

5 customer reviews
Get to know techniques and approaches to procedurally generate game content in C++ using Simple and Fast Multimedia Library
$10.00
$49.99
RRP $39.99
RRP $49.99
eBook
Print + eBook
Preview in Mapt

Book Details

ISBN 139781785886713
Paperback304 pages

Book Description

Procedural generation is a growing trend in game development. It allows developers to create games that are bigger and more dynamic, giving the games a higher level of replayability. Procedural generation isn’t just one technique, it’s a collection of techniques and approaches that are used together to create dynamic systems and objects. C++ is the industry-standard programming language to write computer games. It’s at the heart of most engines, and is incredibly powerful. SFML is an easy-to-use, cross-platform, and open-source multimedia library. Access to computer hardware is broken into succinct modules, making it a great choice if you want to develop cross-platform games with ease.

Using C++ and SFML technologies, this book will guide you through the techniques and approaches used to generate content procedurally within game development.

Throughout the course of this book, we’ll look at examples of these technologies, starting with setting up a roguelike project using the C++ template. We’ll then move on to using RNG with C++ data types and randomly scattering objects within a game map. We will create simple console examples to implement in a real game by creating unique and randomised game items, dynamic sprites, and effects, and procedurally generating game events. Then we will walk you through generating random game maps. At the end, we will have a retrospective look at the project.

By the end of the book, not only will you have a solid understanding of procedural generation, but you’ll also have a working roguelike game that you will have extended using the examples provided.

Table of Contents

Chapter 1: An Introduction to Procedural Generation
Procedural generation versus random generation
Introducing randomness
Seeds
The use of procedural generation in games
Texture creation
Benefits of procedural generation
The drawbacks of procedural generation
A brief history of rogue-like games
How we'll implement procedural generation
Creating unique art
Audio manipulation
Component-based design
The complete game
Exercises
Summary
Chapter 2: Project Setup and Breakdown
Choosing an IDE
Breaking down the game template
Simple and Fast Multimedia Library (SFML)
Polymorphism
The roguelike template setup
Exercises
Summary
Chapter 3: Using RNG with C++ Data Types
Setting the game seed
Setting Boolean values randomly
Random number distribution
Giving the player random stats
Accessing random elements of a collection
Spawning a random item
Generating random characters
Repeating loops
Spawning a random number of items
Exercises
Summary
Chapter 4: Procedurally Populating Game Environments
Potential obstacles
Level tiles
Defining the spawn area
Selecting a suitable game tile
Spawning items at a random location
Spawning random tiles
Exercises
Summary
Chapter 5: Creating Unique and Randomized Game Objects
Creating a random player character
Procedurally generating an enemy class
Procedural items
The random potion class
Exercises
Summary
Chapter 6: Procedurally Generating Art
How procedural generation is used with art
The benefits of procedurally generated art
The drawbacks of procedurally generated art
Using SFML sprite modifiers
Saving modified sprites
Creating enemy sprites procedurally
Editing the game tiles
Exercises
Summary
Chapter 7: Procedurally Modifying Audio
An introduction to SFML audio
Selecting a random main track
Adding sound effects
Editing sound effects
Playing a sound function
3D sound – spatialization
Exercises
Summary
Chapter 8: Procedural Behavior and Mechanics
An introduction to pathfinding
A breakdown of A*
Coding the A* pathfinding algorithm
Implementing A* in the game
Procedurally generated level goals
Exercises
Summary
Chapter 9: Procedural Dungeon Generation
The benefits of procedural level design
Considerations
An overview of dungeon generation overview
The recursive backtracker
Procedurally generating a dungeon
Choosing the tile textures
Exercises
Summary
Chapter 10: Component-Based Architecture
Understanding component-based architecture
Designing the component system
C++ templates
Function overloading
Creating a base component
Component functions
Creating a transform component
Creating a SpriteComponent
Creating an audio component
Exercises
Summary
Chapter 11: Epilogue
Project breakdown
The pros and cons of procedural generation
Summary

What You Will Learn

  • Discover the systems and ideology that lie at the heart of procedural systems
  • Use Random number generation (RNG) with C++ data types to create random but controlled results
  • Build levels procedurally with randomly located items and events
  • Create dynamic game objects at runtime
  • Construct games using a component-based approach
  • Assemble non-predictable game events and scenarios
  • Operate procedural generation to create dynamic content fast and easily
  • Generate game environments for endless replayability

Authors

Table of Contents

Chapter 1: An Introduction to Procedural Generation
Procedural generation versus random generation
Introducing randomness
Seeds
The use of procedural generation in games
Texture creation
Benefits of procedural generation
The drawbacks of procedural generation
A brief history of rogue-like games
How we'll implement procedural generation
Creating unique art
Audio manipulation
Component-based design
The complete game
Exercises
Summary
Chapter 2: Project Setup and Breakdown
Choosing an IDE
Breaking down the game template
Simple and Fast Multimedia Library (SFML)
Polymorphism
The roguelike template setup
Exercises
Summary
Chapter 3: Using RNG with C++ Data Types
Setting the game seed
Setting Boolean values randomly
Random number distribution
Giving the player random stats
Accessing random elements of a collection
Spawning a random item
Generating random characters
Repeating loops
Spawning a random number of items
Exercises
Summary
Chapter 4: Procedurally Populating Game Environments
Potential obstacles
Level tiles
Defining the spawn area
Selecting a suitable game tile
Spawning items at a random location
Spawning random tiles
Exercises
Summary
Chapter 5: Creating Unique and Randomized Game Objects
Creating a random player character
Procedurally generating an enemy class
Procedural items
The random potion class
Exercises
Summary
Chapter 6: Procedurally Generating Art
How procedural generation is used with art
The benefits of procedurally generated art
The drawbacks of procedurally generated art
Using SFML sprite modifiers
Saving modified sprites
Creating enemy sprites procedurally
Editing the game tiles
Exercises
Summary
Chapter 7: Procedurally Modifying Audio
An introduction to SFML audio
Selecting a random main track
Adding sound effects
Editing sound effects
Playing a sound function
3D sound – spatialization
Exercises
Summary
Chapter 8: Procedural Behavior and Mechanics
An introduction to pathfinding
A breakdown of A*
Coding the A* pathfinding algorithm
Implementing A* in the game
Procedurally generated level goals
Exercises
Summary
Chapter 9: Procedural Dungeon Generation
The benefits of procedural level design
Considerations
An overview of dungeon generation overview
The recursive backtracker
Procedurally generating a dungeon
Choosing the tile textures
Exercises
Summary
Chapter 10: Component-Based Architecture
Understanding component-based architecture
Designing the component system
C++ templates
Function overloading
Creating a base component
Component functions
Creating a transform component
Creating a SpriteComponent
Creating an audio component
Exercises
Summary
Chapter 11: Epilogue
Project breakdown
The pros and cons of procedural generation
Summary

Book Details

ISBN 139781785886713
Paperback304 pages
Read More
From 5 reviews

Read More Reviews

Recommended for You