Part A - Foundations

Introduction

Introduce game programming
Describe the instructional software support
Outline the different topoics covered

Game Programming Stream | Software Support | Topic Outline | Exercises


Game programming is rich, demanding and engaging: rich in its use of various media and cross-cultural sources of information, demanding in its complexity and need for computational efficiency, and engaging in its management of interactions between the hardware, the operating system, and the user.  Today's digital games are three-dimensional applications.  They engage the user in a virtual, real-time, three-dimensional world.  They utilize sophisticated, relatively inexpensive, hardware yet require advanced low-level programming skills. 

Digital game programming involves algorithms within the event-driven paradigm.  Digital games process events that the user, the operating system, and the game designs themselves initiate.  Event-driven logic binds the application with the user, letting the user play for extended periods of time with different outcomes for different actions. 

Game programming is one of those branches of computer studies where you can challenge your own perceptions and surpass your own limits in the process of meeting your challenges.  Some of the most advanced software development has been done in this field. 


Game Programming Stream

The game programming stream at the School of Information and Commications Technology currently consists of five courses in two separate threads:

  • Programming Thread
    • Introduction to Game Programming
    • Game Programming Techniques - advanced modeling and low-level techniques
    • Simulation - artificial intelligence and physics
  • Design Thread
    • Modeling - design tools
    • Scripting - manipulation, importing, and exporting

All three programming courses assume familiarity with interfaces and abstract classes, multiple inheritance, dynamic memory management, polymorphism, bit manipulation, cross-platform development and pre-processing in the C++ language. 

Introductory Course

The introductory course covers draws on distinct and unrelated concepts from the fields of computer graphics, sound, and user interface programming.  Presentations are brief and discussions step directly into implementation details.  The course teaches you how to display graphics at many frames per second, augment the graphics with sound, and assumes no knowledge of low-level programming.  The focus is on three-dimensional, real-time game outcomes throughout. 

The ability to create complex graphics rapidly and consistently in real-time is central to game programming.  Although many libraries support graphical representations, most are too slow for real-time visualization.  Digital games demand specialized low-level libraries that access hardware directly.  The two most popular dedicated libraries are DirectX and OpenGL.  DirectX is supported by Microsoft, while OpenGL is supported by members of the Khronos Group.  We cover DirectX in this course and show how to port a DirectX game to the OpenGL graphics library at the end of the course. 

As a student of game programming, you naturally expect to produce some sort of game by the end of such a course.  Implementing a three-dimensional design using low-level programming is not a trivial task and if you were to produce a three-dimensional game and learn low-level programming from scratch, your work would indeed be daunting.  To facilitate your production of a simple three-dimensional game alongside your learning of low-level programming, this course includes extensive software support.  An instructional framework assists you in navigating the gulf between game design and game programming by providing a robust interface between your game design and the low-level libraries that access the hardware directly. 

framework

The instructional framework is a mid-level, object-oriented, open-source pair of layers between the high-level game design layer and the low-level that communicates with the hardware directly. 

The framework manages all of your game events.  You can access it from the beginning of the course and start developing your own game immediately using your existing knowledge of object-oriented programming before you learn any low-level details.  As you progress through the course, you will learn how to implement basic concepts from computer graphics at the low-level.  By the end of the course, you should be able refine the low-level details yourself. 

The open source code allows you to study, modify, and eventually upgrade the framework to suit your own game design requirements and to incorporate any lower-level innovations.  The framework provides a default structure for any part that you choose to leave intact. 


Software Support

Game programs are built on top of application programming interfaces.  The software support for this course consists of:

  • an integrated development environment (IDE)
  • application programming interfaces (APIs) with a supporting developer network
  • a source code repository with the instructional framework and intermediate release samples

The IDE manages the source code, its compilation, debugging, and the creation of its executables.  The instructional framework integrates the various aspects of the APIs with your game design logic for a complete gaming application.

Integrated Development Environment

Microsoft supplies an IDE called Visual Studio for managing and compiling source code.  We use the Visual Studio IDE to run all of the samples in this course.  This environment offers both command line and GUI access.  The GUI version provides sophisticated support for developing and debugging applications. 

Microsoft designed Visual Studio 2010 to work seemlessly with its Windows Operating Systems.  You can obtain your personal copy of Visual Studio 2010 Professional Edition at School's Downloads Site.  Click the MSDN link off the Downloads link to retrieve the .iso image.  To setup the environment directly from this .iso image, use a virtual DVD application like MagicDisc

If you don't have access to the Professional Edition of Visual Studio 2010, Microsoft offers a free copy of its Express Edition. 

Creating a Visual Studio Project

To create a Win32 project in Visual Studio:

  1. Start Visual Studio
  2. Select File->Project->New
  3. Select C++ - Win32 App, identify your project directory, name your project, and click OK
  4. Identify the type of application, check Empty Project, and click Finish
  5. Select Project->Add New Item
  6. Select Code, select .h file, name your header file, and click Add
  7. Add your code to the new header file
  8. Select Project->Add New Item
  9. Select Code, select .cpp file, name your implementation file, and click Add
  10. Add your code to the new implementation file
  11. Select Build->Build Solution
  12. Select Debug->Start Without Debugging

Project files reside in the project directory.  The project directory resides in the solution directory.  The solution directory may contain a Debug and possibly a Release sub-directory.  These two sub-directories contain the executable files for your project.  Any file that is used by your project without a redirecting path should be in that project's directory. 

Application Programming Interfaces

Lower-level library support ships in the form of APIs.  These APIs include header and library files and are packaged as software development kits (SDKs).  These SDKs include both documentation and implementation tools. 

The three sets of APIs that we use in this course are the Windows APIs, the DirectX APIs, and the OpenGL APIs.  The Windows APIs interface directly with the Windows operating system.  The DirectX and OpenGL APIs interface directly with the hardware. 

Windows API

The Windows API includes a graphics device interface (GDI) for outputting graphical content to monitors and printers, a graphical user interface (GUI) for managing screen windows, mouse input and keyboard input, and functions for accessing resourses such as file systems, devices and network services. 

The Visual Studio 2010 setup installs the Windows SDK and .NET Framework along with the Visual Studio IDE.  A recent version of the Windows API is available in the Windows SDK for Windows 7 and .NET Framework 4.  We only use the Windows API for communications with the user at speeds comparable to user typing speeds. 

DirectX APIs

Microsoft supplies the DirectX APIs for accessing hardware directly.  A recent version of the DirectX API is available in the DirectX 9.0c (June 2010)

To ensure that your Visual Studio IDE has access to your DirectX SDK, you may need to identify two project directories the first time that you build a solution.  Under Project->Properties->Configuration Properties->VC Directories add:

  • ($DXSDK_DIR)Include
  • ($DXSDK_DIR)Lib\x86

Documentation

Microsoft supports its Windows and DirectX developers through its Microsoft Developer Network (MSDN).  This network includes documentation for all of the libraries supported by Microsoft.  You can access this network online at http://msdn.microsoft.com/en-us/library

Instructional Framework

The complete framework is available from the trunk of the course repository.  Pre-releases expose the framework in successive stages of development, consistent with the presentation of the material in this text. 

scaffolding of the framework

Repository

Each solution in the repository contains the source code, the Visual Studio project and solution files and the directories needed to build and run the samples directly.  To download the complete framework from the repository:

  • Download and install Tortoise SVN 1.7 or greater
  • Right-click with the cursor on the Desktop and select SVN Checkout from the context menu
  • Enter svn://zenit.senecac.on.ca/dpsgam/trunk/gam666
  • Enter the destination path where you would like the code stored
  • Enter dpsgam as the userid (if requested)
  • Enter a blank password (no characters)

To run the downloaded code,

  • Open the solution directory folder and select *.sln file
  • Select Build->Build Solution
  • Select Debug->Start Without Debugging

Topic Outline

Each chapter introduces a different concept and describes the code needed to implement that concept.  Most game programming concepts involve first-level approximations that are specifically suited to digital games.  We discuss refinements that make games more sensually appealing, more realistic, or more un-realistic in the subsequent courses. 

The chapters group into five major sections:

  • Foundations
    • Introduction
    • Windows, COM Technology, and DirectX
    • Display and Resolution Selection
    • Event-Driven Programming
    • Sprites, Motion and User Control
  • Mathematics
    • Two-Dimensional Mathematics
    • Three-Dimensional Mathematics
  • Graphics
    • Primitives
    • Visibility
    • Lighting
    • Texturing
  • Audio
    • Global Sounds
    • Local Sounds
  • User Input
    • Keyboard and Mouse
    • Controller

The foundations part ends with images moving on a screen under program and user control.  The second part presents the mathematics involved in representing three-dimensional data.  The third part covers the concepts used to display vivid, three-dimensional models on a two-dimensional screen.  The fourth part covers sound effects, which include local sounds with three-dimensional properties.  The fifth part covers direct access for input devices. 


Exercises




Previous Reading  Previous: Table of Contents Next: Windows Programming   Next Reading


  Designed by Chris Szalwinski   Copying From This Site   
Logo