#define
macro, 35
@class
declaration, 171
@implementation
declaration, 173
@import
declaration, 171
@interface
declaration, 171–172, 179
@synthesize
command, 173
2D games. See also Raiders
depth values in, 138
lighting effects for, 44
moving objects in, 160
and quads, 38
shaders for, 43
2D textures, 44
3D transformations, 161
abstract classes, 32–33, 34, 36
abstraction, 32–33
AbstractSceneController class, 33, 34, 35, 79
acceleration
variable, 55
achievements, 107–109
ActionItem class, 50, 51, 53, 76, 104
activeEnemies
variable, 96
ADBannerView
protocol, 118–120
AddDelegate file, 151
addSprite
method, 34
AdMob, 122
advertising framework, 118–122
AdWhirl network, 122
creating dynamic difficulty using, 68
defined, 7
for Diagonal Sprite, 70
from gaming point of view, 68
importance of, 7
for Kamikaze Sprite, 72
standard algorithms for, 7
algorithms, game programming, 7, 68, 72, 76, 185
AppDelegate file, 24, 103, 134, 151
Apple
advertising framework, 118
App Store, xi
developer program, 22
Game Center, 102 (See also Game Center)
GLKit (See GLKit)
Objective-C documents, 181
Retina Display, 17
second display feature, 123
Twitter framework, 110
Apple TV, 123
App Store, Apple, xi
ARC, 178. See also Automatic Reference Counting feature
arrays
clearing sprite, 97
for defining quad vertices, 39
explosion, 83
for interleaved vertex data, 41
and matrix transformations, 45
artificial intelligence, 7. See also AI
artists, 18
assigning vs. copying, 93
audio editor, xiii
audio formats, 19
Audio frameworks, 84–86
AudioServicesPlaySystemSound
method, 85
audio streaming, 123
Automatic Reference Counting feature, 134, 178
autorelease
method, 177
AVAudioPlayer framework, 84–86
AVPlayer, 86
background music, 85
barriers, 16
base classes, 32–33
Beginning Math and Physics for Game Programmers, 185
bitmaps, 157
Blair Medium font, 92
bounding box detection, 76–77, 79
bounding circle detection, 77, 79
bounds checking, 60
bounds
property, 50
braces, 171
buffers, 138–139
Bundle Identifier, 102
caching resources, 33
CADisplayLink
timer, 136, 138, 165
Campbell, Duncan, 184
canFireMissiles
property, 95
C-based sound effects framework, 85
changeScene
method, 52
character sprites, 93
checkForCollisions
method, 86
Chopper 2 game, 59
circular bounds, 77
classes
adding methods to, 35
extending functionality of, 179
importing, 171
instantiating, 175
managing game flow with, 32–33
Class Prefix, 22
downloading from book’s website, 31
reading/maintaining, 36
defined, 76
methods, 76–78
purpose of, 73
collision logic, 80–82
Common.h file, 52
Company Identifier, 22
compiler cheats, 173
compiling shaders, 143
contract/freelance sites, 18
controllers, 32
controls, 53–59
allowing player to choose, 58
importance of, 14
novel approaches to, 59
purpose of, 7
tilt-based, 54–55
virtual joystick, 55–58
coordinates, mapping, 40
copying vs. assigning, 93
Core Techniques and Algorithms in Game Programming, 185
Cox, Brad, 169
C-style syntax, 169
currentLives
property, 97
currentPosition
property, 53, 60
currentScene
property, 35
currentSprite
method, 83
Dalmau, Daniel, 185
deaths, player, 94
#define
macro, 35
design documents, 10
Device Family, 22
dirtyBit
variable, 45–46
distance formula, 69
doAnimation
method, 83
Doom, 68
drawAtPoint
method, 53
drawAtPosition
method, 45
draw
method, 45–46, 150, 159, 161, 165
drawPlayer
method, 53
drawTextAtPoint
method, 93
drawView
selector, 141
driving games, 7
dynamic difficulty, 68
EAGLContext,
138
EAGLView
layer, 140
effects classes, 43–44
elevator pitches, 11
Embedded Systems, 6. See also ES
enemy missile collisions, 79, 82
class considerations, 65
creating multiple types of, 15
keeping track of number of, 96
killing, 15
missile graphics for, 66
vs. player sprites, 53
enemyType
property, 64
engines, game, 5–6
ES 1.1, 6, 21. See also OpenGL ES
ES 2.0, 6, 21. See also OpenGL ES
ESMatrix
structure, 155
Explode class, 83
explosions, 83–86
extension methods, 179
files pane, 34
formulas
distance, 69
fragment shader, 158
frame buffers, 138
freelance artists, 18
Gallagher, Matt, 35
Game Center, 102–109
disabling, 103
enabling, 102
features provided by, 104
purpose of, 102
sending scores to, 106
GameController class, 35, 52, 94, 97, 165
game controllers, 33
game controls, 53–59
allowing player to choose, 58
importance of, 14
novel approaches to, 59
purpose of, 7
tilt-based, 54–55
virtual joystick, 55–58
game descriptions, 11
game design, 9–19
choosing controls, 14
choosing genre, 10–11
establishing a look, 12–13
finding graphics/sounds, 17–19
importance of, 10
programming knowledge required for, xi
role of sound in, 12
setting rules, 15–16
tools, xii–xiii
and view modes, 12–13
game development
fundamentals, 3–7
further reading on, 185
terms, 32–33
tools, xii–xiii
game engines, 5–6
game genres, 10–11
game graphics, 13
Game Kit framework, 102, 104, 107, 109, 163
GameOverScene, 32
games. See also iOS games
adding social features to, 101–115
converting from GLKit-based to OpenGL ES, 135–151
creating in Xcode, 22
creating multi-level, 98
designing (See game design)
displaying ads in, 118–122
further reading on developing, 185
increasing “stickiness” of, 101
initializing, 97
math/physics programming for, 185
multiplayer, 102
selling items in, 124–128
sharing information about, 102
game scenes, 32. See also scenes
game states, 24
gaming network, 102–103
gaming terms, 32–33
genres, game, 10–11
geometry system, 40
getter methods, 173
GIMP image editor, 17
GKAchievementViewController, 107
GKLeaderBoardViewController, 107
GLES2, 153, 154, 167. See also OpenGL ES
effects classes, 43–44
how it works, 29
implementing translations in, 160
loading textures in, 156–157
rendering scenes in, 150
updating scenes in, 136
vs. OpenGL ES, 150
GLKTextureLoader
class, 156
GLView, 136, 137, 138, 140, 142
goals, 107
Google AdMob, 122
graphics. See also images
missile, 66
purchasing, 18
scaling, xiii
usage rights for, 18
graphic stock websites, 18
gyroscope, 7
hasAnimationFinished
variable, 84
hasBeenShot
property, 79, 80, 95
hasBeenTapped
method, 50
header files, 171–172. See also .h files
hideAd
method, 121
HighScoreScene, 32
high score table, 104
Hillegass, Aaron, 184
house image, 37–38
images. See also graphics
copying, 157
cropping, xiii
house, 37–38
loading into texture buffer, 42
previewing, xiii
implementation files, 171, 173–174. See also .m files
import declarations, 171
in app purchases, 124–128, 129
income, generating, 117, 118, 124, 129
initEffect
method, 43–44
initialization code, 24
initVertexInfo
method, 43
initWithImageNamed
method, 42
intelligent agents, 7
interface declaration, 171–172, 179
interface files, 171
interleaved vertex data, 41
iOS
advertising framework, 118–122
audio formats, 19
devices (See specific devices)
further reading on, 184
games (See iOS games)
language behind, 169 (See also Objective-C)
memory errors, 178
memory management, 176
and multitasking, 24
playing sound in, 84–86
social gaming network, 102–103
and textures, 38
top source of bugs in, 178
and touch-based control, 53
and Twitter framework, 165
iOS games. See also games
characteristics of good, 11
choosing genre for, 10–11
creating in Xcode, 22
designing, xi (See also game design)
and device orientation, 12–13
game controls for, 14
popular game engines for, 5
saving game state for, 24
time considerations, 11
iOSGames website, 31
iPad
and game genres, 10
and OpenGL, 6
and player controls, 59
screen-size considerations, 17
and second display feature, 123
and textures, 38
iPhone
accelerometer, 54–55
core set of apps for, 24
and game genres, 10
screen-size considerations, 17
testing apps for, 23
and textures, 38
and tilt-based control, 54
and touch-based control, 53
iPhone 3D Programming, 184
iPhone Application Development for iOS 4: Visual QuickStart Guide, 184
isMissileActive
property, 66–67
isReturning
variable, 69
isStrafing
property, 64
joystick control, virtual, 55–58
keys values, 52
landscape mode, 12–13
layoutSubviews
method, 141–142
Level1SceneController class, 52, 54, 97
Level Scene, 32
lighting effects, 43–44
loadShaders
method, 150
Love, Tom, 169
main.m file, 24
MainWindow.xib file, 24
Majic Jungle Software, 59
maps, 10
masks, 5
math programming, 185
matrix math, 160–162
memory buffers, 43
memory errors, 178
memory management, 176
memory space, 157
MenuScene, 32
MenuSceneController, 35, 46, 51, 104
menu screen, 46
messaging, 170
.m files, 24, 25, 34, 171, 173
Mighty Eagle, 124
missiles, 4, 16, 66–67, 79, 95
mixins, 179
Model-View-Controller technique, 24
movement, enemy/player, 15–16, 68–72
MP3 files, 19
MPEG files, 19
multi-level games, 98
multiplayer games, 102
multitasking, 24
Munshi, Aaftab, 184
musical score, 18
music, background, 85
MVC programming technique, 24
named parameters, 170
navigation code, 25
New Project command, 22
nib files, 25. See also .xib files
non-player characters (NPCs), 7
NPOT textures, 156
NSCoding protocol, 106
NSDictionary
variable, 52
Object-C Programming: The Big Nerd Ranch Guide, 184
Objective-C, 169–181
Automatic Reference Counting feature, 178
AVAudioPlayer framework, 85
calling methods in, 170
creators of, 169
further reading on, 184
header files in, 171–172
implementation files in, 171, 173–174
instantiating objects in, 175
memory management in, 176
protocols, 179–180
resources, 181
retain count, 177
vs. other object-oriented languages, 170
object-oriented languages, 169, 170
objects
instantiating, 175
moving, 160
releasing, 177
OpenAL framework, 86
OpenGL, 6, 25. See also OpenGL ES
OpenGL Embedded Systems, 6. See also OpenGL ES
challenges of using, 21
converting Raiders to, 153–167
creating 2D/3D graphics with, 37
creating transformations in, 155, 167
font support, 91
further reading on, 184
implementing translations in, 160–162
and interleaved vertex data, 41
and legacy iOS devices, 133
limitation on textures in, 38
loading textures in, 156–157
and Objective-C, 169
readying app for conversion to, 135–151
setting up empty template in, 134
and template app, 25
transformations in, 45
updating scenes in, 136
versions, 6
vs. GLKit, 150
OpenGL ES 2.0 Programming Guide, 184
Open Graphics Library, 6. See also OpenGL
open source audio editor, xiii
orthographic projection, 44, 160
parameters, named, 170
parent classes, 32
parent sprite class, 154
PDFs, xiii
per pixel detection, 78
perspective, 44
physics programming, 185
pixel-based detection, 78
pixel-based graphics editors, 17
Plants vs. Zombies, 10
playCurrentScene
method, 35
player
controls, 53–59
movement, 15–16
PlayerSprite class, 53, 60, 64, 79
playExplosionEffect
method, 85, 86
playing loops, 84
playScene
method, 34, 35, 79, 80
portrait mode, 12–13
Preview tool, xiii
private methods, 35
products, selling, 124–128
programming. See also code
further reading on, 184–185
games vs. other applications, 4
terms, 32–33
tools, xii–xiii
projection matrix, 44
projectionMatrix
variable, 160
projects
adding Twitter framework to, 110
basic files needed for, 23–25
converting from GLKit-based to OpenGL ES, 135–151
saving, 22
protocols, 179–180
Python, 179
QuartzCore framework, 135
AI in, 68
changing scenes in, 50–52
collision detection in, 76–82
converting to standard OpenGL ES, 153–167
creating achievements in, 107–109
creating multiple levels in, 98
creating project, 22
dynamic difficulty in, 68
effect usage in, 44
elevator pitch for, 11
enemies in, 15
enemy attacks in, 16
enemy classes in, 65
enemy movement in, 68–72
font used in, 92
fragment shader for, 158
game objects for, 17
handling complex interactions for, 26
implementing Game Center features in, 104–109
implementing translations in, 160–162
keeping score in, 94–96
menu screen for, 46
orthographic projection in, 44
parent sprite class in, 154
perspective in, 44
player/enemy movement in, 16
player vs. enemy shots in, 16
scenes in, 32
scoreboard for, 90
shooting in, 16
showing iAds in, 120
Sprite class for, 42–46
types of enemies in, 64
vertex shader for, 159
vertices in, 37
real-time strategy games, 10, 68
rectangles, 37
render buffers, 138
rendering code, 140–142
retain count, 177
Retina Display, 17
revenue, advertising/product, 118–122, 124–128
Rideout, Phillip, 184
rotation, 45
Ruby, 179
Run Button, 23
scaling, 45
scene controllers, 32
abstract class for, 34
adding to dictionary, 52
changing, 50–52
defined, 32
examples of common, 32
initializing, 52
rendering, 36
updating, 136
where game stores, 97
scores
adding to Game Center, 106
filtering, 104
storing, 106
screen space, 44
second display feature, 123
selectors, 50
sending tweets, 110–114
sendTweet
code, 165
setHidden
method, 121
setter methods, 173
setupGL
method, 25
shaders
applying, 158–162
compiling, 143
deleting, 26–28
linking, 143–151
purpose of, 25
shading effects, 43–44
sharedGameController
variable, 36
shared resources, 33
shooter games, 68
shooting missiles, 16, 79, 95. See also missiles
Simulator, 23
single-screen action games, 10, 11. See also Raiders
Single View Application option, 134
SlidingDoor class, 32
Smalltalk, 169
social features, 101–115
Game Center integration, 102–109
leaderboards, 104–109
Twitter updates, 110–114
social gaming network, 102–103
social networks, 101
sound design, 12
sound editor, xiii
Space Invaders, 4
spherical bounds, 77
spot effects, 85
sprite arrays, clearing, 97
Sprite class, 42–46, 158. See also sprites
Sprite.h file, 154
Sprite.m file, 39, 154, 159, 160, 161
sprites. See also enemy sprites
changing header for, 155
checking bounds for, 60, 76–77
copying vs. assigning, 93
creating, 17
defined, 4
drawing, 37–38
movement patterns for, 68
moving, 160
player vs. enemy, 53
putting in action, 39–46
rendering, 45–46
size considerations, 17
sources of free, 18
transforming, 155
sprite sheets, 5
sprite velocity, 69
square brackets, 170
squareVertices
array, 150
Stahler, Wendy, 185
startRun
method, 64
stock graphics, 18
StoreKit framework, 124
Storyboard file, 25
strafingFinished
method, 81
streaming audio/video, 123
strings, 175
structs, 41
(s,t) system, 40
Supporting Files group, 163
SynthesizeSingleton.h file, 35
System Sound Services, 85
taking-ownership technique, 177
target objects, 51
terminology, 32–33
Test Account, iTunes Connect, 124
texCoordIn
attribute, 159
texCoords
array, 159–160
texture coordinates, 43
texture coordinate system, 40
texture mapping, 38, 39–40, 43
textures
calculating pixels in, 78
copying vs. assigning, 93
loading in GLES2, 156–157
mapping (See texture mapping)
OpenGL ES limitations on, 38
reading, 156–157
rendering, 158
three-dimensional games. See 3D games
threshold level, acceleration, 55
tilt-based control, 54–55
touch-based control, 53, 58, 162
touchesBegan
method, 56
touchesEnded
method, 51, 56, 57
touchesMoved
method, 53
touchPoint
parameter, 50
touchscreen, 14
transformations, 45, 155, 161, 167
translation
variable, 160
transparent backgrounds, 43
triangles, 37–38
TrueType fonts, 91
TV Out technology, 59
tweets, sending, 110–114
Twitter, 110–114
account setup, 110
and iOS versions, 165
sending tweets to, 111–114
two-dimensional games. See 2D games
TWRequest
method, 114
TWTweetComposeViewController, 110, 111–112
UIAccelerometerDelegate
method, 54
UIKit View Controller, 104
UIView, 136
Unity game engine, 5
update
method, 25
updateScene
method, 34
updateTransforms
method, 44, 66
updateWorld
method, 35
usage rights, 18
Use Automatic Reference Counting option, 134
UV mapping, 40
(u,v) system, 40
vanishing point, 44
vector space, 44
velocity, sprite, 69
_vertex
variables, 26
vertices, 37, 150. See also vertex data
video streaming, 123
ViewController
changing header file for, 163
displaying ads in, 118–119
editing, 163–165
and inheritance, 51
and redrawing screens, 142
sending tweets without, 113–114
vs. GameController, 36
vs. Sprite class, 158
viewDidLoad
method, 25
view modes, 12–13
virtual joystick control, 55–58
weapons, 4
winning levels, 96
Xcode
creating new projects in, 22, 134
examining specific files in, 24–25
files pane, 34
iOS Simulator, 23
purpose of, xii
x plane, 160
x,y points, 37
“you win” message, 96
y plane, 160
z plane, 160