Procedural Content Generation for Unity Game Development By Ryan Watkins January 2016
Ebook in PDF Introducing PCG We begin our learning adventure with the broad concept of PCG. The key word here is procedural. A procedure in programming, simply put, is an instruction to be executed. Procedures are the main paradigm in computer programming. A script you write in Unity is just a set of instructions or procedures we want Unity to perform. You use procedures, methods, or functions as a means to communicate the instructions you want the computer to complete. We can use these same procedures to instruct the computer to generate content in many different ways. We can apply this idea to a broad range of programming disciplines such as data visualization, dynamic advertising, and so on, but in this book, we are using it for video games. If procedural is the how then content is the what. Content can be anything we are presenting to the user. In our Hello World example later in the chapter, our content will simply be text. However, video games have a wide range of assets that make up the content we want to deliver to a player. Typically, we think of the levels, character models, and other art assets when we think of content in video games. But there is also textures, music, sounds, story, artificial intelligence, and more that together make up the content of a game. PCG is the concept or paradigm by which all these pieces of content can be generated with some well-written code. PCG can be applied to nearly all aspects of a game through scripting, and you will learn some of the main ways to do this throughout the book.