You are previewing C# Game Programming: For Serious Game Creation.

C# Game Programming: For Serious Game Creation

Cover of C# Game Programming: For Serious Game Creation by Daniel Schuller Published by Course Technology PTR
  1. Copyright
    1. Dedication
  2. Acknowledgments
  3. About the Author
  4. Introduction
    1. CD-ROM Downloads
  5. I. Background
    1. 1. The History of C#
      1. C# Basics
      2. Summary
    2. 2. Introducing OpenGL
      1. Architecture of OpenGL
      2. OpenGL Is Changing
      3. OpenGL and the Graphics Card
      4. The Tao Framework
      5. Summary
    3. 3. Modern Methods
      1. Pragmatic Programming
      2. Summary
  6. II. Implementation
    1. 4. Setup
      1. Introducing Visual Studio Express—A Free IDE for C#
      2. Subversion, an Easy Source Control Solution
      3. Tao
      4. NUnit
      5. Summary
    2. 5. The Game Loop and Graphics
      1. How Do Games Work?
      2. Implementing a Fast Game Loop in C#
      3. Graphics
      4. Summary
    3. 6. Game Structure
      1. The Basic Pattern of a Game Object
      2. Handling Game State
      3. Game State Demo
      4. Setting the Scene with Projections
      5. Sprites
    4. 7. Rendering Text
      1. Font Textures
      2. Font Data
      3. Rendering Text
      4. Refining the Text Class
      5. Faster Rendering with glDrawArrays
      6. Summary
    5. 8. Game Math
      1. Trigonometric Functions
      2. Vectors
      3. Two-Dimensional Intersection
      4. Tweens
      5. Matrices
    6. 9. Making the Game Engine
      1. A New Game Engine Project
      2. Extending the Game Engine
      3. Adding Sound Support
      4. Improving Input
    7. 10. A Simple Side-Scrolling Shooting Game
      1. A Simple Game
      2. The First Implementation Pass
      3. Developing the Inner Game
      4. Continuing Iterations
    8. 11. Creating Your Own Game
      1. Project Management
      2. Display Methods
      3. Types of Games
      4. Final Words
  7. A. Recommended Reading
    1. The Practice of Programming
      1. The Pragmatic Programmer: From Journeyman to Master (ISBN 0-201-61622-X) by Andrew Hunt and David Thomas
      2. Code Complete Second Edition: A Practical Handbook of Software Construction (ISBN-13: 978-0735619678) by Steve McConnell
    2. The C# Language and Software Architecture
      1. CLR via C#, 3rd Edition (ISBN-13: 978-0735627048) by Jeffrey Richter
      2. Head First Design Patterns (ISBN-13: 978-0596007126) by Eric T Freeman, Elisabeth Robson, Bert Bates, and Kathy Sierra
    3. Math and Graphics Programming
      1. 3D Math Primer for Graphics and Game Development (ISBN-13: 978-1556229114) by Fletcher Dunn and Ian Parberry
      2. Computer Graphics: Principles and Practice in C (2nd Edition) (ISBN-13: 978-0201848403) by James D. Foley, Andries van Dam, Steven K. Feiner, and John F. Hughes
    4. OpenGL
      1. OpenGL Programming Guide: The Official Guide to Learning OpenGL (ISBN-13: 978-0321552624) by Dave Shreiner
      2. OpenGL Shading Language 3rd Edition by Randi J. Rost, Bill Licea-Kane, Dan Ginsburg, John M. Kessenich, Barthold Lichtenbelt, Hugh Malan, and Mike Weiblen
O'Reilly logo

Chapter 6. Game Structure

Now that the basics of the rendering are working, it’s time to revisit game architecture. Even small games (Pong, for example) usually require a large amount of code. Pong is a pretty simple game; the player moves a paddle left or right and attempts to hit a ball past an opponent’s paddle. It was one of the first popular computer games released in 1987 so there have been numerous reimplementations since then. SourceForge (www.sourceforge.net) is a website that hosts hundreds of thousands of open source projects. There are quite a few open source Pong clones, and even the simplest ones are over 1,000 lines of code. As a game programmer, it’s important to have strategies to manage that complexity.

Big games are orders of ...

The best content for your career. Discover unlimited learning on demand for around $1/day.