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
Preview in Mapt

Procedural Content Generation for C++ Game Development

Dale Green

2 customer reviews
Get to know techniques and approaches to procedurally generate game content in C++ using Simple and Fast Multimedia Library
Mapt Subscription
FREE
$29.99/m after trial
eBook
$28.00
RRP $39.99
Save 29%
Print + eBook
$49.99
RRP $49.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$28.00
$49.99
$29.99p/m after trial
RRP $39.99
RRP $49.99
Subscription
eBook
Print + eBook
Start 30 Day Trial

Frequently bought together


Procedural Content Generation for C++ Game Development Book Cover
Procedural Content Generation for C++ Game Development
$ 39.99
$ 28.00
Procedural Content Generation for Unity Game Development Book Cover
Procedural Content Generation for Unity Game Development
$ 39.99
$ 28.00
Buy 2 for $35.00
Save $44.98
Add to Cart
Subscribe and access every Packt eBook & Video.
 
  • 5,000+ eBooks & Videos
  • 50+ New titles a month
  • 1 Free eBook/Video to keep every month
Start Free Trial
 

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 2 reviews

Read More Reviews

Recommended for You

SFML Game Development By Example Book Cover
SFML Game Development By Example
$ 39.99
$ 28.00
Beginning C++ Game Programming Book Cover
Beginning C++ Game Programming
$ 39.99
$ 28.00
Learning C++ by Creating Games with UE4 Book Cover
Learning C++ by Creating Games with UE4
$ 26.99
$ 18.90
Mastering C++ Game Development Book Cover
Mastering C++ Game Development
$ 39.99
$ 28.00
C++ Game Development Cookbook Book Cover
C++ Game Development Cookbook
$ 35.99
$ 25.20
Procedural Content Generation for Unity Game Development Book Cover
Procedural Content Generation for Unity Game Development
$ 39.99
$ 28.00