← Sex Lies and Video Games How to Write a Macintosh Arcade Game 1996

Sex Lies and Video Games How to Write a Macintosh Arcade Game 1996

From the originals

13 scans

Machine-transcribed text and image descriptions. Check the linked original for uncertain words or fine print.

These are transcribed pages from the documents, not the full publications. Open the original for the remaining pages.

Image 1

Includes all the games in the book and their source code Sex, Lies, and Video Games How to write a Macintosh® Arcade Game Bill Hensler

A cream-colored book cover with a black torn-paper border, a red bitten apple with green leaf and stem at top, a small floppy disk icon in the upper left with handwritten note beside it, and large hand-lettered black title text.

Reading notes: Handwritten note in upper left reads 'Includes all the games in the book and their source code'; the word 'book' and 'source' are slightly stylized and may be read with some uncertainty. Title 'and' between lines is small hand lettering and is transcribed from the image as shown.

Printed product names
Macintosh
Languages
English
PDF page 1

Includes all the games in the book — and their source code Sex, Lies, and Video Games How to write a Macintosh® Arcade Game Bill Hensler

A cover with a hand-lettered black title over a red apple with a bite taken out and a green leaf, a small floppy disk icon at upper left, and a black torn-paper border around a cream background.

Reading notes: Handwritten-style title and annotation; the 'and' in the title is small and may be read as a separate word Floppy disk icon at upper left has no text and is not part of the transcript

Printed product names
Macintosh
Languages
English
PDF page 2

~e(, Lfef, A1t4 Vf4ef ~A,.,ef Addison-Wesley Developers Press Reading, Massachusetts • Menlo Park, California • New York Don Mills, Ontario •Wokingham, England • Amsterdam Bonn • Sydney• Singapore •Tokyo • Madrid • San Juan Paris • Seoul • Milan • Mexico City • Taipei

Reading notes: Top lines contain garbled OCR fragments ("~e(, Lfef, A1t4" and "Vf4ef ~A,.,ef") that could not be reliably read. No headline, advertised products, prices, or dates are present in the supplied copy. Layout, reading order, and any artwork could not be verified because only the extracted text was provided, not the image. The publisher's city list is OCR text and may contain spacing or character errors.

Languages
English
PDF page 3

Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and Addison-Wesley was aware of a trademark claim, the designations have been printed in initial capital letters or all capital letters. The authors and publishers have taken care in preparation of this book, but make no expressed or implied warranty of any kind and assume no responsibility for er- rors or omissions. No liability is assumed for incidental or consequential damages in connection with or arising out of the use of the information or programs con- tained herein. ISBN 0-201-40757-4 Copyright© 1996 by Bill Hensler A-W Developers Press is a division of Addison-Wesley Publishing Company. All rights reserved. No part of this publication may be reproduced, stored in a re- trieval system, or transmitted, in any form or by any means, electronic, mechani- cal, photocopying, recording, or otherwise, without the prior written permission of the publisher. Printed in the United States of America. Published simultaneously in Canada. Sponsoring Editor: Keith Wollman Project Manager: Vicki L. Hochstedler Cover design: Jean Seal Set in 11-point Palatino by A & B Typesetting 1 2 3 4 5 6 7 8 9 -MA- 9998979695 First printing, December 1995 Addison-Wesley books are available for bulk purchases by corporations, institu- tions, and other organizations. For more information please contact the Corporate, Government and Special Sales Department at (800) 238-9682. Find A-W Developers Press on the World-Wide Web at: http://www.aw.com.devpress/

Reading notes: The supplied source text is a book copyright and publishing page, not an advertisement, so no advertised products or prices were found. The printing sequence '1 2 3 4 5 6 7 8 9 -MA- 9998979695' and the ISBN are not treated as dates or prices. The phone number (800) 238-9682 and the URL are not treated as prices or dates. 'Copyright© 1996' and 'December 1995' were listed as printed dates because they appear in the supplied copy.

Printed dates
Copyright© 1996 · December 1995
Languages
English
PDF page 4

P~Aa ................................................................................. XI ~.w~ ................................................................ xiv ~d """' F~ .................................................................... xv Who This Book Is For ................................................................... xv Who This Book Is Not For ......................................................... xvii What's in This Book .................................................................... xvii What You Will Need .................................................................... xix What You Should Already Know ............................................ xviii How to Use This Book .............................................................. xviii Conventions Used in This Book .................................................. xx Solely Responsible ......................................................................... xx iii

Reading notes: Table of contents page numbers and some heading characters are garbled or partially illegible in the OCR text. Reading order of entries is uncertain due to OCR line fragments.

Languages
English
PDF page 5

iv~ ~1: ~~,,..,lo~~··························· 1 Computer Game Field Guide ........................................................ 1 Adventure: "Anybody Bring a Map?" ......................................... 2 Role-playing: "What Is an 80-sided Die Called Again?" ........... 4 Simulation: "Watch Your Six!" ....................................................... 4 Strategy: "How Does the Castle Thing Work Again?" ............... 5 War Games: "Incoming!" ................................................................ 6 Sports: "Golf on a Computer? Why?" .......................................... 8 Puzzle: "It's Those Darn Russians' Fault" ................................... 9 Arcade: "Please Give Me Just One More Quarter" ..................... 9 Arcade Game Origins ............................ ....................................... 10 Spacewar ......................................................................................... 11 Pong and Nolan ............................................................................. 12 "Have Fun and Make Money" .................................................... 14 And the Rest Is ............................................................................ 16 Classic Arcade Games ................................................................... 16 Asteroids (Atari) ............................................................................ 16 Battlezone (Atari) ........................................................................... 17 Centipede (Atari) ........................................................................... 18 Crazy Climber (Taito) .................................................................... 19 Death Race (Exidy) ........................................................................ 19 Defender/Stargate (Williams) ..................................................... 19 Dig Dug (Atari) .............................................................................. 20 Donkey Kong (Nintendo) ............................................................. 21 Food Fight (Atari) .......................................................................... 21 Galaga (Midway) ........................................................................... 22 Joust/Joust II (Atari) ..................................................................... 22 Marble Madness (Atari) ................................................................ 23 Missile Command (Atari) ............................................................. 24 Pac-Man/Ms. Pac-Man et al. (Midway) ..................................... 24 Qix (Taito) .... .. .. .. .. .... .. .. ... .... ...... .. .. .... .. ... .. ..... .. ... ... .. .. .. ... .. .... ..... .... .. 25 Robotron 2084 (Williams) .. .. ... .... .. .... ... .. .... ... ...... .. .. .. ... .. ...... ... .... .. 26 Space Invaders (Taito) ... .... ...... .... .... .. ...... ... ... ...... .. .. .. ..... ............... 27 Tail Gunner (Cinematronics) ........................................................ 28 Tempest (Atari) .............................................................................. 29 Closing Ceremonies ...................................................................... 31

Reading notes: Table of contents page numbers and leader dots are partly damaged, e.g. the opening line '~1: ~~,,..,lo~~' is garbled. Reading order of the table of contents is uncertain due to scanning artifacts.

Printed product names
Anybody Bring a Map? · What Is an 80-sided Die Called Again? · Watch Your Six! · How Does the Castle Thing Work Again? · Incoming! · Golf on a Computer? Why? · It's Those Darn Russians' Fault · Please Give Me Just One More Quarter · Spacewar · Pong · Nolan · Have Fun and Make Money · Asteroids · Battlezone · Centipede · Crazy Climber · Death Race · Defender · Stargate · Dig Dug · Donkey Kong · Food Fight · Galaga · Joust · Joust II · Marble Madness · Missile Command · Pac-Man · Ms. Pac-Man · Qix · Robotron 2084 · Space Invaders · Tail Gunner · Tempest
Printed dates
2084
Languages
English
PDF page 6

~v What Makes a Game Fun? ........................................................... 32 Reinforcement ... ... ... .... ....... .. ... ... .... ... ... ... .. .... .. .. .. .. .. .. .. .. ... .. .. .. .. .. .. .. 32 Schedules of Reinforcement ......................................................... 33 Extinction .. ...... ................... .. .. .. .. ................. ............................. ....... 35 Magnitude of Reinforcement ....... ...... .......................................... 36 Delay of Reinforcement .. ... .. .. .. .... .. ... ...... .. .. .. .. .. .. .... .. .. ... .. .. .. .. .. .. .. . 37 Psychological Undo ....................................................................... 38 Addiction Is the Name of the Game ........................................... 39 (!~ 2: ~ka;.c""'4,o ~ ~ .................... 41 Arcade Games and Animation ..................... .... ........................... 41 How Animation Works ................................................................. 42 Computer Animation .................................................................... 43 Computer Graphics Flavors ......................................................... 43 Three Ways to Animate Graphics on a Mac ............................... 46 Why Buffered Animation? ........................................................... 57 ~ 3: ott~~#l, H~ ..................................... s1 How QuickDraw Sees Memory ................................................... 60 Off screen Elements .. .. .. .. .... ...... ... .. .... .. .. .. .. .. .. .. ............... .... ...... ...... 62 Classic Off screens .... .. .. ....... .. .. .... .. .. .... ........ ... .. .. .. .. .. .. .. .. ..... .. .... .. .. . 62 Color Off screens ... ... ...... .. .. .. .. .. ... .. .. .. .. .. .. .. .. .. .. .. .... .. .. .. ... .... .. .. .. ...... 68 Let's Build Some Off screens ...... .. .... .. .. .... .... ............. ...... ........ ...... 87 Color Does Not Include Black and White .................................. 87 Make an Offscreen ......................................................................... 88 Destroying Off screens .. .. .. ...... ... .. .. .. .. .. .. .. .. ... ... ... .. .... .. .. ..... .. ... ... .. 102 Using Color Offscreens ............................................................... 104 ~ Cf: H~ Ott~ .......................................... 101 A Brave New GWorld ................................................................. 109 What the Heck is a GWorld? ...................................................... 110 What's the Catch? ........................................................................ 113 Playing with GWorlds ................................................................. 114

Reading notes: Source appears to be a table of contents with OCR damage in chapter headings and page numbers Chapter 2 and 3 heading characters are garbled and uncertain

Languages
English
PDF page 7

vi~ Bit Banging ................................................................................... 121 What Is Blitting? .......................................................................... 122 A Simple Blitter ............................................................................ 123 The Mac's Built-in Blitter: CopyBits() ...................................... 125 Who Is That Masked Blitter? ...................................................... 132 Blitting Speed ............................................................................... 137 ~ S: ~ ~ ............................................... 1S7 Sprite? ............................................................................................ 157 Anatomy of a Sprite .................................................................... 158 Hardware Sprites ......................................................................... 160 Who Was That Masked Sprite? .................................................. 163 Brain Dead Again ........................................................................ 163 CopyBits Redux ........................................................................... 165 Rolling Your Own ........................................................................ 168 Logical Masking .. .. .. .. .. .. ... .. .... .. .. .. .. ... .. ...... .... .. .... .. .. .. .. .. .. .. ..... ... ... 169 Brain Dead III ............................................................................... 171 Simple Optimizations ................................................................. 173 Unrolling Your Own .................................................................... 184 Run Length Masking ................................................................... 190 Sprite Compiling ......................................................................... 199 But Which One? ........................................................................... 221 ~ 6: ~ Co~"'* ........................................... 221 What Is a Sprite Collision? ......................................................... 229 What Is a Collision? ..................................................................... 230 Collisions and Holes .. ... .. .. .. .. .. .. .. .. ... .. .. .... .. .. ...... .. .. .. .. .. .. .. .. .. .... ... 230 CopyBits Collisions ..................................................................... 232 Logical Masking Collisions .. .... .. .. .. ... .... .. ... ... .... .. .. .. .. .. .. .. ..... ... ... 232 Compiled Mask Collisions ....... .. ... .. .. .. .... .. .. .. .... .... ...... .. .. .. ... .... .. 235 Speed ............................................................................................. 235 What's the Problem? ................................................................... 235 Speeding Up Collisions ..... .. .... .. ..... .. .. .. .. .. .. .. .. .......... .... .. ..... .. .. .. . 238 Sorting ... .. .. ..... .. .. .. .. .. .. .. ..... .... .. ...... .... .. .... ....... .. .... .. .. .. .. .. .. .. .. ...... .. . 238 Sectors ........... .. .... ..... ...... .. .. .. .. .... .. ..... .. ...... .. .. .... .. ............ ......... .. ... 240

Reading notes: Source appears to be a table of contents with garbled OCR characters (e.g., '~ S: ~ ~', 'Co~"'*') and uncertain chapter headings. Page numbers and some heading text are damaged or missing in several entries.

Languages
English
PDF page 8

~vii Simplifying by Design ................................................................ 243 Frame Rates and Collision Detection .... ... .... .. ... .... .. .. .. ... ...... .. .. 245 ~ !: ~p~ ..................................................... 24? Design Goals ... .. .. .... .. .. .. .. .. .... .. .. .... .. .. .. .. .. .. .... .. .. .. .. .. .. ... ... ............. 248 C++ and Games ........................................................................... 248 The Pieces ... .. .. .. .. .. .. .. .... .. .. .. .. ....... ... .. .. .. .. .. .. .. .. .. .. ... ... ... ........ .. ... .... 254 Lists ................................................................................................ 255 Handling Errors ... .... .. .. .. .... .. .. .... .... .. .. .. .. .. .. .. .. .... .. .... ..... .. .... ..... .... 257 ~ ~= P~ F~ .................................................... 2549 Double-Buffered Animation ...................................................... 260 Play Field Creation ...................................................................... 261 Adding Sprites to a Play Field ................................................... 264 Removing Sprites from a Play Field ......................................... 265 Performing Sprite Animation .................................................... 267 Erasing the Sprites ..... ...... .. .. .. ... .... ....... .. .. .. .. .... .. ... ..... ..... .. .. .. .... .. . 268 Drawing the Sprites ..... .. .... .. ...... .... .. .. .... ...... .... .. ... ...... .. .. ..... .. .. .. .. 270 From Off screen to On-screen ....... .. .. .. .. .... .... .. .... .... .. ..... .. .. .. .. .. .. . 271 Moving the Sprites .. .. .... .. .. .. .. .... .. .. .. .. .... .. .... .. ....... .. .. .. .. ..... ...... .. .. 273 Checking for Collisions ... .. .. .. ...... .. .. .. .. .. .. .... .. .. .. ...... ......... .. .. .. .. .. 275 Play Field Miscellany .................................................................. 276 Handling Update Events ............................................................ 276 Drawing in the Off screen Buffers ... .. .. .. .. .... .. .. .. .............. ... .. ... .. . 278 Drawing in the Host Window .. .... .... .. .. .. .... .. ... .. .. .. .. .. ....... .. .... .. . 280 Play Field Summary .................................................................... 280 ~1= ~~~&4 .................................. zg3 Creating a Sprite .......................................................................... 284 Sprite Templates .......................................................................... 285 Building Sprite Cels ..................................................................... 287 Cloning a Sprite ........................................................................... 293 Cel Lists .. ... .. ... .......... .. .. ....... ......... ... ...... .. .. .. ...... .. ...... ... .. ............... 295 Cel List Reuse ..... .. .. .. .. .... .. ............ ...... ......... .... ...... ...... ....... .. ...... .. 296 Disposing of a Sprite .. .. .... .. .. .. .. .... .. .. .. .. .. .. .. .. .. .. .. ... .. ............... .. .. . 296

Reading notes: Table of contents text contains OCR-like damaged characters in several entries (e.g., '~ !: ~p~', '~1= ~~~&4', '~ ~= P~ F~') that are unreadable. Page numbers in the table of contents are partially garbled, e.g., '2549' and 'zg3'.

Languages
English
PDF page 9

viii~ Sprite Timers ................................................................................ 248 Moving a Sprite .... .. .... .. .. .. .. .. .. .. .. .. .. .... .... .. .. .. .. ... ... .... .. ... ...... .. ..... .. 300 SetStartingPosition ...................................................................... 301 SetAutoMove ............................................................................... 302 SetAutoMoveTime ....................................................................... 303 Movement Central .................... ................................................... 305 Direct sprite Movement .............................................................. 306 MoveTo .......................................................................................... 306 Offset ............................................................................................. 307 Changing the Sprite's Cel ........................................................... 308 SetCelCycleTime .......................................................................... 308 SetCurrentCel ............................................................................... 309 GetCurrentCellndex and GetCurrentCel ................................. 310 ChangeCel .................................................................................... 310 Sprite Visibility ............................................................................. 311 Sprite Miscellany ......................................................................... 312 Sprite IDs ...................................................................................... 312 Movement Extents ....................................................................... 313 ~10: P~ttAllT.o~ .................................. 31S Game Rules ................................................................................... 316 Ping's Code-Overview ............................................................. 317 Bouncing Ball ... .. .. .. ...... .......... ...... .. .... .... .... ......... ................ .. .... .. . 317 Mouse Tracking ............................................................................ 320 Paddle AI ............................................................. :........................ 321 Volleying .. .. .. ...... ...... .. ..... .. .. ..... .. .. .... ...... .. .... .. .. .... .. .. .. .. .. .... ... ... .. .. . 323 Ping's Code-Implementation .................................................. 325 Main, Where It Always Begins .................................................. 325 Building Them Sprites .......................... .. .................................... 327 Play That Game ...................................... ...... ................................ 329 Redecorating ...................... ................ ... .. .... .... .. .... .. ...... ......... ... ... 330 Experiment ................................................................................... 331 ~ 11: Sc~........................................................... 333 What Is Sound? ............................................................................ 334

Reading notes: Several characters are damaged or garbled in the table of contents, such as 'Movement Central' spacing artifacts and 'Sprite Visibility' heading layout. Some page numbers and section titles are uncertain due to OCR-like artifacts (e.g., 'Sprite IDs', 'Ping's Code-Overview'). Reading order of the fragment is partial; it appears to be a table of contents excerpt.

Languages
English
PDF page 10

~ix Measuring Sound ........................................................................ 335 Amplitude ..................................................................................... 335 What's the Frequency, Kenneth? ............................................... 337 Digital Sound ......... .......................... ...... .................... ........ .. ........ 338 Sampling ....................................................................................... 339 Sampling Rate .............................................................................. 339 Sample Resolution ....................................................................... 342 Why You Care .............................................................................. 343 Sound on the Mac ........................................................................ 344 Sound Manager: A Brief History ............................................... 344 Playing Sound .............................................................................. 347 Sound Commands ....................................................................... 347 Sound Channels ........................................................................... 350 The Easy Way ............................................................................... 351 From a Disk .................................................................................. 351 Asynchronously-Get Used to It .............................................. 353 Sound Class Kit: "The Audience Is Listening" ........................ 358 Priorities .. ......... .......................... .. .. .... .... .. ........ .. ........ .. .. .... ...... ..... 359 Starting Up ..... ........... .......... .. .... .... .. .. .. .. .. .. .... .. .. .. ... ............ .. ...... .. 360 Shutting Down ............................................................................. 362 Playing Sounds ............................................................................ 363 Tidying Up .................................................................................... 367 Silence Is Golden .................. .. ...... .. .. .. .... ...... .... .. ... .. .......... ........ .. 368 Enabling and Disabling Playback ........... ... ... ......... ......... .......... 369 ~ 12: t>~ ........................................................... 371 Game Rules ................................................................................... 372 Data Structures ............................................................................. 373 Tunnel Layout .............................................................................. 374 Level Template ............................................................................. 375 Building Levels ............ ............. .. .... .. .. .. .. ...... .... .. ... .. .......... .. ........ 377 Game Loop ................................................................................... 379 Sprite States .. ............ ......... ...... ........ .... ...... .. .... ............................. 383 Player ............................................................................................. 384 Moving .......................................................................................... 387

Reading notes: Source appears to be a table of contents with dotted leaders; no advertised products, prices or dates are present. Some section headings contain damaged or garbled characters (e.g., '~ix', '~ 12: t>~').

Languages
English
PDF page 11

x~ Freeze Ray .. .. .. .. .. .. .. ... .. .. .. ... .. .. ....... ..... .. ........ .. .. .. .. .... ...... .. .. .. ......... 388 Falling Rock .................................................................................. 389 Squishing ... .... .. .. .. ... .. .. .... ...... ........ ..... .. ... .. ... .. .. .. .. .... .. .... .. .. .. ...... .. . 390 Dying ............................................................................................. 391 Death ............................................................................................. 391 Monsters .. .... ...... ... ....... .... .. .. .. .. .. .. .. .... .. .. .. .. .. ...... ..... ... .... ...... .. ... ... . 392 Experiment ................................................................................... 393 Game Over .................................................................................... 393 ~ .................................................................................. .31$

Reading notes: Table of contents with dotted leaders; many entries partially garbled by OCR-like dots Price-like string '.31$' at end is ambiguous and not a clear advertised price

Languages
English