Video game programmer and teacher looks at the fundamental concepts of game programming and how to get an initial game up and running. He also introduces the Simple DirectMedia Layer (SDL) library.
Save 35% off the list price* of the related book or multi-format eBook (EPUB + MOBI + PDF) with discount code ARTICLE.
* See informit.com/terms
This chapter first discusses how to set up a development environment and access the source code for this book. Next, it covers the core concepts behind any real-time game: the game loop, how a game updates over time, and the basics of game input and output. Throughout the chapter, you will see how to implement code for a version of the classic game Pong.
Setting Up a Development Environment
Although it’s possible to write the source code for any program with a text editor, professional developers typically use an integrated development environment (IDE). The advantage of an IDE is that it provides code completion and debugging in addition to text editing capabilities. The code for this book works on both Microsoft Windows and Apple macOS, and the choice of IDE depends on the choice of platform. For Windows, this book uses Microsoft Visual Studio, and for macOS, it uses Apple Xcode. The remainder of this section contains brief instructions on setup of these environments on their respective platforms.
For Windows development, the most popular IDE by far is Microsoft Visual Studio. Visual Studio also tends to be the most popular IDE for C++ game developers, with most PC and console developers gravitating toward the IDE.
This book uses Microsoft Visual Studio Community 2017, which is available as a free download at https://www.visualstudio.com/downloads/. Installation of Visual Studio Community 2017 requires Microsoft Windows 7 or higher.
When you run the installer program for Visual Studio, it asks which “workloads” it should install. Make sure to minimally select the Game Development with C++ workload. Feel free to also select any other workloads or options desired.
On macOS, Apple provides the free Xcode IDE for development of programs for macOS, iOS, and other related platforms. The code for this book works in both Xcode 8 and 9. Note that Xcode 8 requires macOS 10.11 El Capitan or higher, while Xcode 9 requires macOS 10.12 Sierra or higher.
To install Xcode, simply go to the Apple App Store and search for Xcode. The first time Xcode runs, it asks if you want to enable debugging features. Make sure to select Yes.