Advanced 2D Game Development

Advanced 2D Game Development

by Jonathan S. Harbour
Advanced 2D Game Development

Advanced 2D Game Development

by Jonathan S. Harbour

eBook

$34.99 

Available on Compatible NOOK Devices and the free NOOK Apps.
WANT A NOOK?  Explore Now

Related collections and offers

LEND ME® See Details

Overview

Get ready to build a complete, professional-quality 2D game engine from start to finish! Advanced 2D Game Development is your comprehensive guide to 2D game development using DirectX in the C++ programming language. Each chapter of the book covers one major component of the game engine, including 2D and 3D rendering, DirectInput, FMOD audio, game math, multi-threading, Lua scripting, and more, and the game engine is built upon chapter by chapter. Through the creation of the game engine, you'll learn step by step how to write solid code for multiple compliers, adding to the code as you work through each chapter. And every chapter includes an example game that illustrates the new techniques being taught. Perfect for game programming students and professionals alike, this book is your ultimate guide to awesome 2D game development.

Includes coverage of: Collision detection techniques, 32-bit artwork and runtime alpha manipulation, Sprite entity system, Math topics, such as linear velocity and targeting. What's on the CD-ROM: Full support for both Visual C++ 2005 and Dev-C++ 5.0, Complete source code for the game engine and chapter examples, Two complete games: Blocks and Alien Invaders, FMOD audio system from Firelight Technologies, Pthreads library, Lua scripting library, Dev-C++ complier from Bloodshed Software, DirectX 9.0c DevPak for Dev-C++.

About the Author:
Jonathan S. Harbour is an Associate Professor of Game Development at the University of Advancing Technology in Tempe, Arizona


Product Details

ISBN-13: 9781598636970
Publisher: Course Technology PTR
Publication date: 01/06/2008
Sold by: CENGAGE LEARNING
Format: eBook
File size: 4 MB

About the Author

Jonathan S. Harbour is a freelance writer, indie game developer and an Associate Professor of Game Development at the University of Advancing Technology in Tempe, Arizona. His current game project is "Starflight: The Lost Colony" (www.starflightgame.com).

Table of Contents


Building a 2D Game Engine     1
Compiler Support     2
DirectX SDK Support     4
Why Do We Need an Engine?     5
Creating the Engine Project     7
Dev-C++ Project     8
Visual C++ Project     13
Engine Source Code     18
Compiling the Engine Project     33
Testing the Engine     34
The TestEngine Source Code     34
Dev-C++ Library Test Project     35
Visual C++ Library Test Project     38
3D Rendering     43
Rendering Basics     44
Adding Rendering Support     45
Adding Camera Support     48
Adding Mesh Support     51
Rendering Meshes     56
Runtime Cubes     56
Bouncing Balls     58
Direct Lighting     63
Directional Light     64
Spot Light     65
Point Light     65
Creating Lights     66
2D Rendering     73
Basic 2D Rendering     74
Raising Happy Sprites     78
Creating Vectors     79
Testing Vector3     83
Creating a Reusable SpriteClass     85
Rendering Spirites with Transparency     92
Color Key Transparency     93
Alpha Channel Transparency     95
Animation     99
Animation Demo     101
Sprite Rotation and Scaling     105
Animation with Transforms     107
Particles     110
Input     123
Keyboard Input     123
DirectInput Device     124
Initializing the Keyboard     125
Reading Key Presses     126
Mouse Input     127
Initializing the Mouse     127
Reading the Mouse     128
Engine Modifications     129
Input Class     130
Engine Changes     132
Testing Keyboard and Mouse Input     134
Audio     139
Designing an Audio System     139
What Is FMOD?     140
Using the FMOD SDK     140
Audio Classes     142
Sample Class     142
Audio Class     143
Adding FMOD to the Game Engine     148
Audio Test     149
Entities     153
Building an Entity Manager      154
The Entity Class     155
Modifying the Engine     158
Modifying the Sprite Class     165
Testing Sprites as Entities     165
Modifying the Mesh Class     168
Testing Meshes as Entities     168
Fonts     173
Creating a Font     173
Loading and Rendering a Font     176
Font Class     176
Using the New Font Class     178
Physics     185
Collision Detection     185
Automated Collision Detection     186
Bounding Rectangle Collision Test     192
Distance-Based Collision Test     204
Math     213
Math Class     214
Math Class Header     214
Math Class Implementation     215
Math Test     218
Linear Velocity     220
Angle to Target     226
Drop-Down Console     237
Console Class     237
Console Test     240
Threading     243
Introducing the POSIX Threads Library     243
Installing POSIX Threads     245
Using POSIX Threads     246
Programming POSIX Threads      248
ThreadDemo Program     251
Threading the Game Engine     262
Threaded Garbage Collection     262
Testing the Newly Threaded Engine     264
Scripting     271
Introducing Lua     272
Running Lua from the Command Prompt     272
Lua and C++     286
Lua Script Class     287
Linking with the Lua Library     291
Script Test     292
Games     297
Scrolling Example     299
Blocks Game     301
Alien Invaders     302
Epilogue     303
Index     307
From the B&N Reads Blog

Customer Reviews