Procedural Content Generation for Unity Game Development
eBook - ePub

Procedural Content Generation for Unity Game Development

  1. 260 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Procedural Content Generation for Unity Game Development

Book details
Book preview
Table of contents
Citations

About This Book

Harness the power of procedural content generation to design unique games with Unity

About This Book

  • Learn the basics of PCG development
  • Develop a 2D game from start to finish
  • Explore all the different ways PCG can be applied in games

Who This Book Is For

This book is for Unity game developers, especially those who work on indie games. You should be familiar with Unity and C# scripting but you'll be able to jump in and start learning PCG straightaway.

What You Will Learn

  • Understand the theory of Procedural Content Generation
  • Learn the uses of Pseudo Random Numbers
  • Create reusable algorithm designs for PCG
  • Evaluate the data structures for PCG
  • Develop smaller games with larger amounts of content
  • Generate content instead of spending time designing every minute detail
  • Learn when and how to add PCG to your game
  • Learn the fundamental techniques of PCG

In Detail

Procedural Content Generation is a process by which game content is developed using computer algorithms, rather than through the manual efforts of game developers. This book teaches readers how to develop algorithms for procedural generation that they can use in their own games. These concepts are put into practice using C# and Unity is used as the game development engine.

This book provides the fundamentals of learning and continued learning using PCG. You'll discover the theory of PCG and the mighty Pseudo Random Number Generator. Random numbers such as die rolls and card drafting provide the chance factor that makes games fun and supplies spontaneity. This book also takes you through the full development of a 2D game.

Starting with level generation, you'll learn how PCG can make the game environment for you. You'll move into item generation and learn the different techniques to procedurally create game items. Thereafter, you'll be guided through the more abstract PCG areas such as scaling difficulty to the player and even generating music! The book helps you set up systems within your games where algorithms create computationally generated levels, art assets, quests, stories, characters, and weapons; these can substantially reduce the burden of manually creating every aspect of the game.

Finally, you'll get to try out your new PCG skills on 3D terrain generation.

Style and approach

An easy-to-follow, project-based guide that will let you build a complete game by the end of the book using PCG.

Frequently asked questions

Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes, you can access Procedural Content Generation for Unity Game Development by Ryan Watkins in PDF and/or ePUB format, as well as other popular books in Computer Science & Computer Science General. We have over one million books available in our catalogue for you to explore.

Information

Year
2016
ISBN
9781785287473
Edition
1

Procedural Content Generation for Unity Game Development


Table of Contents

Procedural Content Generation for Unity Game Development
Credits
Disclaimer
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Pseudo Random Numbers
Introducing PCG
Usage of PCG
Application of PCG
Pseudo random numbers
Random versus pseudo random numbers
PRNs in PCG
Random Hello World
Classic Hello World
PCG Hello World
Challenge
Summary
2. Roguelike Games
An introduction to Roguelike games
Why Roguelike?
Our own Roguelike project
Setting up the project
Importing the base project
File overview
Animation
Fonts
Prefabs
Scenes
Scripts
Summary
3. Generating an Endless World
Data structure choice
Array
Linked list
Dictionary
PCG algorithm overview
Scene setup
Player positioning
Camera following
Layers
Initial Game Board
Connecting code
The PCG Game Board
Summary
4. Generating Random Dungeons
Algorithm design
Algorithm overview
The grid
Essential path
Random path and chambers
Filling in the rest of the gird
Placing the entrance and exit
Algorithm summary
Data structures
Back to the map
Queue
Prefab setup
An exit sign
DungeonManager
BoardManager
Player
GameManager
Back to the Unity Editor
Seeding the dungeon
Challenge
Summary
5. Randomized Items
Generating health items in the game world
Implementing health item generation
Setting up sprites
Generating items in the dungeon
The Chest prefab
Chest implementation
Spawning the chest
The Item prefab
Item code
Adding player to item interaction
Summary
6. Generating Modular Weapons
PCG with modules
Statistics of modular PCG
Creating and configuring new sprites
Creating a multiple image prefab
Modular weapon scripts
Adding a spawn point
Adding a weapon pick up
Adding scripted weapon animation
Adding character facing directions
Summary
7. Adaptive Difficulty
Setting up sprites
Adding enemies to the world board
Adding enemies to the Dungeon Board
Fighting the enemy
Adaptive difficulty
Enemy AI
Finishing up
Summary
8. Generating Music
Concept of music
Tempo
Melody
Repetition
Procedurally generated music algorithm
Measure
Dividing the measure
The base line
Setting up the script
The Sound Manager script
Adding tension
Summary
9. Generating a 3D Planet
Adding a third dimension
3D versus 2D
Know your geometry
Working with the Unity primitive sphere
Generating a sphere
Adding randomization
Bad time and space complexities
Multi mesh planet
Exploring the planet
Summary
10. Generating the Future
Models
Items
Levels
Texture
Terrain
Physics
Animation
AI
Story
The player sandbox
Summary
Index

Procedural Content Generation for Unity Game Development

Copyright © 2016 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: January 2016
Production reference: 1220116
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78528-747-3
www.packtpub.com

Credits

Author
Ryan Watkins
Reviewers
Joshua Byrom
Michele Pirovano
Till Riemer
Gennaro Vessio
Acquisition Editor
Prachi Bisht
Content Development Editor
Merint Thomas Mathew
Technical Editor
Vivek Arora
Copy Editor
Merilyn Pereira
Project Coordinator
Francina Pinto
Proofreader
Safis Editing
Indexer
Rekha Nair
Graphics
Jason Monteiro
Production Coordinator
Manu Joseph
Cover Work
Manu Joseph

Disclaimer

The Unity name, logo, brand, and other trademarks or images featured or referred to within this book are licensed from and are the sole property of Unity Technologies. This book, its author, or the publisher are not affiliated with, endorsed by, or sponsored by Unity Technologies or any of its affiliates.

About the Author

Ryan Watkins was digitized and absorbed into his computer at an early age. In the digital realm, he learned the importance of video games and the balance they brought to the ecosystem of computing. Video games strive to always push the boundaries of what we know to be true while being a super-charged source of fun. Ryan formed friendships with many of the video games he encountered on his digital journeys, and in return, they shared the secrets of their creation with him. He has since returned to the physical world to share those secrets with the rest of us.

About the Reviewers

Joshua Byrom has been programming and gaming for over two decades, and has written numerous articles on the subjects of game programming and artificial intelligence. Around the age of eight, he was introduced to computers by his father, which generated in him a deep interest for computer science, particularly computer programming.
Since then, Joshua has written code for companies such as BMC Solutions Inc., AutoTrader.com, and Elite Property Services LLC. He has also worked for the army, where he wrote genetic algorithms for the U.S. Military. Currently, he works as a software architect, where he develops and maintains web applications for local lawyers, realtors, and retailers.
In addition, Joshua writes programming articles for online publishing, runs a small business that creates and publishes independent mobile and web applications, and provides code consulting for indie start-ups.
Currently, Joshua is located in Newnan, GA, and when he isn't lost thousands of lines deep in code, he likes to read both prose and poetry, or play video games.
Michele Pirovano is a freelance game developer and game researcher based in Bergamo, Italy. He holds a PhD in computer science from the Politecnico di Milano, where he graduated with a thesis on the design of autonomous exergaming systems.
His main interest is the application of artificial intelligence, procedural content generation, and complex mathematical systems to video games. He...

Table of contents

  1. Procedural Content Generation for Unity Game Development