Index

#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 OpenGL, 6, 37

and quads, 38

shaders for, 43

2D graphics, 6, 37

2D textures, 44

3D games, 44, 138, 184

3D graphics, 6, 37

3D math, 45, 161

3D transformations, 161

A

abstract classes, 32–33, 34, 36

abstraction, 32–33

AbstractSceneController class, 33, 34, 35, 79

acceleration variable, 55

accelerometer, 7, 14, 54

achievements, 107–109

action games, 10, 63

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

AI

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

AIFF files, 19, 85

AirPlay, 123, 129

algorithms, game programming, 7, 68, 72, 76, 185

alloc method, 175, 176

Angry Birds, 10, 124

animation, 136, 138

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

Audacity, xiii, 19

audio editor, xiii

audio effects, 18–19, 84–86

audio formats, 19

Audio frameworks, 84–86

AudioServicesPlaySystemSound method, 85

audio streaming, 123

AudioToolbox, 85, 163

Automatic Reference Counting feature, 134, 178

autorelease method, 177

AVAudioPlayer framework, 84–86

AVPlayer, 86

B

background music, 85

barriers, 16

base classes, 32–33

Beginning Math and Physics for Game Programmers, 185

BitmapFont class, 92, 166

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

C

caching resources, 33

CADisplayLink timer, 136, 138, 165

CAFF files, 19, 85

Campbell, Duncan, 184

canFireMissiles property, 95

categories, 35, 179–180

C-based sound effects framework, 85

C/C++ methods, 25, 170

changeScene method, 52

character sprites, 93

checkForCollisions method, 86

child classes, 32, 34

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

CocoaWithLove.com, 35

cocos2d game engine, 5, 6

code

downloading from book’s website, 31

reading/maintaining, 36

reusing, 6, 155

collision detection

defined, 76

methods, 76–78

purpose of, 73

in Raiders, 76, 79–82, 162

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

touch-based, 53, 58, 162

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

currentScore property, 94, 97

currentSprite method, 83

D

Dalmau, Daniel, 185

deaths, player, 94

#define macro, 35

design documents, 10

Device Family, 22

Diagonal Sprite, 64, 69–71

difficulty levels, 16, 98

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

DumbSprite, 64, 68–69

dynamic difficulty, 68

E

EAGLContext, 138

EAGLView layer, 140

effects classes, 43–44

elevator pitches, 11

Embedded Systems, 6. See also ES

enemy missile collisions, 79, 82

enemy movement, 15, 68–72

EnemySprite class, 64, 79, 82

enemy sprites

class considerations, 65

creating multiple types of, 15

importance of, 63, 64

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

esTranslate method, 155, 161

Explode class, 83

explosions, 83–86

extension methods, 179

F

files pane, 34

font rendering, xiii, 91–93

formulas

distance, 69

slope of line, 70, 71

fragment shader, 158

frame buffers, 138

freelance artists, 18

G

Gallagher, Matt, 35

game AI, 68. See also AI

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

touch-based, 53, 58, 162

virtual joystick, 55–58

game descriptions, 11

game design, 9–19

changing, 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

sketching, xiii, 12

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

game loop, 4, 84

game objects, 4, 7

“game over” message, 94, 95

GameOverScene, 32

game rules, 12, 15–16

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

scoring, 90, 94–96

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

GLKit

effects classes, 43–44

how it works, 29

implementing translations in, 160

and iOS versions, 21, 133

limitations of, 133, 153

loading textures in, 156–157

purpose of, xi, 21, 29, 133

rendering scenes in, 150

and shader files, 25, 26

updating scenes in, 136

vs. OpenGL ES, 150

GLKTextureLoader class, 156

GLKView, 25, 46

GLKViewController, 25, 104

GLView, 136, 137, 138, 140, 142

goals, 107

Google AdMob, 122

graphics. See also images

creating, 13, 17, 37–38

missile, 66

purchasing, 18

scaling, xiii

usage rights for, 18

graphics editors, 13, 17

graphic stock websites, 18

gyroscope, 7

H

hasAnimationFinished variable, 84

hasBeenShot property, 79, 80, 95

hasBeenTapped method, 50

header files, 171–172. See also .h files

.h files, 24, 25, 34, 171

hideAd method, 121

Hiero, xiii, 91–93

HighScoreScene, 32

high score table, 104

Hillegass, Aaron, 184

house image, 37–38

I

iAds, 118–122, 129

IAP, 124–128, 129

image editors, xiii, 13, 17

images. See also graphics

copying, 157

cropping, xiii

house, 37–38

loading into texture buffer, 42

previewing, xiii

resizing, xiii, 163

implementation files, 171, 173–174. See also .m files

import declarations, 171

in app purchases, 124–128, 129

income, generating, 117, 118, 124, 129

inheritance, 50, 51, 179

initEffect method, 43–44

initialization code, 24

init method, 85, 97, 140, 175

initScene method, 35, 52, 97

initVertexInfo method, 43

initWithImageNamed method, 42

intelligence, 68. See also AI

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

and OpenGL, 6, 21, 153

playing sound in, 84–86

Simulator, xii, 23

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

and OpenGL ES, 6, 21

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

iPod Touch, 6, 17

isGameOver property, 96, 97

isMissileActive property, 66–67

isMoving property, 56, 57

isReturning variable, 69

isStrafing property, 64

iStockphoto.com, 18

itemStrafing variable, 80, 81

iTunes Connect, 102, 104, 124

J

joystick control, virtual, 55–58

K

Kamikaze Sprite, 64, 72

keys values, 52

L

landscape mode, 12–13

latency, 85, 86

layoutSubviews method, 141–142

leaderboards, 104–105, 106

Level1SceneController class, 52, 54, 97

levels, 16, 96, 98

Level Scene, 32

lighting effects, 43–44

line-slope formula, 70, 71

lives, player, 15, 94–96

loadShaders method, 150

loops, 4, 84

Love, Tom, 169

M

main.m file, 24

MainWindow.xib file, 24

Majic Jungle Software, 59

mapping, texture, 38, 39–40

maps, 10

masks, 5

math programming, 185

matrices, 45, 161

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

N

n4te.com, 91

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

NSString object, 42, 175

O

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

categories, 35, 179–180

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

methods, 25, 171

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

onscreen controls, 14, 59

OpenAL framework, 86

OpenGL, 6, 25. See also OpenGL ES

OpenGL Embedded Systems, 6. See also OpenGL ES

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

Shader Language, 25, 29

and shaders, 43, 143–151

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

open source websites, 18, 19

orthographic projection, 44, 160

P

parameters, named, 170

parent classes, 32

parent sprite class, 154

path finding, 7, 68

PDFs, xiii

pencil sketches, xiii, 10, 12

per pixel detection, 78

perspective, 44

Photoshop, 13, 17

physics programming, 185

pixel-based detection, 78

pixel-based graphics editors, 17

Pixelmator, 13, 17

Plants vs. Zombies, 10

playCurrentScene method, 35

player

controls, 53–59

lives, 15, 94–96

missile collisions, 79, 82

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

POT textures, 156, 163, 166

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

creating, 22, 134

naming, 22, 134

saving, 22

protocols, 179–180

puzzle games, 7, 10

Python, 179

Q

quads, 38, 39–40, 43

QuartzCore framework, 135

R

racing games, 58, 123, 124

Raiders

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 controls for, 14, 32–33

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

sounds for, 18, 19, 85

Sprite class for, 42–46

types of enemies in, 64

vertex shader for, 159

vertices in, 37

Real Racing 2 game, 59, 123

real-time strategy games, 10, 68

rectangles, 37

render buffers, 138

rendering code, 140–142

rendering fonts, xiii, 91–93

retain count, 177

Retina Display, 17

revenue, advertising/product, 118–122, 124–128

Rideout, Phillip, 184

rotation, 45

RTS games, 10, 68

Ruby, 179

Run Button, 23

S

scaling, 45

scene controllers, 32

scenes

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

scoreboard, 90, 91

scores

adding to Game Center, 106

filtering, 104

storing, 106

scoring games, 90, 94–96

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

setup method, 150, 165

shader.fsh file, 25, 26, 148

Shader Language, 25, 29

shaders

applying, 158–162

compiling, 143

creating, 43, 148–151

deleting, 26–28

linking, 143–151

purpose of, 25

shader.vsh file, 25, 26, 148

shading effects, 43–44

sharedGameController variable, 36

shared resources, 33

shooter games, 68

shooting missiles, 16, 79, 95. See also missiles

Simulator, 23

Simulator, iOS, xii, 23

single-screen action games, 10, 11. See also Raiders

singletons, 33, 35

Single View Application option, 134

sketches, xiii, 10, 12

SlidingDoor class, 32

slope-of-line formula, 70, 71

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

sound effects, 18–19, 84–86

SoundEffects class, 85, 86

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

squares, 37, 38

squareVertices array, 150

Stahler, Wendy, 185

startRun method, 64

stock graphics, 18

StoreKit framework, 124

Storyboard feature, 24, 25

Storyboard file, 25

strafingFinished method, 81

strafing runs, 64, 65, 68–69

strategy games, 7, 68

streaming audio/video, 123

strings, 175

structs, 41

(s,t) system, 40

Supporting Files group, 163

SynthesizeSingleton.h file, 35

System Sound Services, 85

T

taking-ownership technique, 177

tapAction method, 50, 51

target objects, 51

template app, 25, 26

template, OpenGL ES, 134, 151

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

POT vs. NPOT, 156, 163

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

transformation matrix, 44, 46

transformations, 45, 155, 161, 167

translations, 45, 160–162

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

U

UIAccelerometerDelegate method, 54

UIKit View Controller, 104

UIView, 136

UIViewController, 51, 107

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

V

vanishing point, 44

vector space, 44

velocity, sprite, 69

vertex arrays, 41, 160

vertex data, 25, 37, 41

vertex shader, 159–160, 161

_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

files, 24, 25

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

W

WAV files, 19, 85

weapons, 4

winning levels, 96

X

Xcode

creating new projects in, 22, 134

examining specific files in, 24–25

files pane, 34

iOS Simulator, 23

purpose of, xii

template, 134, 151

.xib files, 24, 25

x plane, 160

x,y points, 37

Y

“you win” message, 96

y plane, 160

Z

z plane, 160

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.107.152