# Tricks Of The Mac Game Programming Gurus 1995 — source transcripts, page 1

[Canonical transcript page](https://www.vintageapple.net/transcripts/media/va-tricks-of-the-mac-game-programming-gurus-1995-f45349/1)

## Transcribed source material

Machine transcriptions and image descriptions; uncertain copy may be marked [illegible]. Verify against the linked originals. Historical rights remain with the original owners.

These are transcribed excerpts, not the full publications. Open the originals for remaining pages.

### Image 1

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-tricks-of-the-mac-game-programming-gurus-1995-f45349/1#scan-3644bd1ee5742671911a11ab84bab2beb2db62e32fcf7b51639c6718040c91a6)

Transcribed text:

Master the Techniques You Need to Create Your Own Games

TRICKS OF THE MAC

GAME PROGRAMMING

GURUS

Secrets and techniques from expert game programmers!

Covers QuickDraw 3D, porting, networking, Power Macs and more!

CD-ROM includes programming tools and utilities, sample code, games, demos, and more!

Jamie McCornack, Ingemar Ragnemalm, Paul Celestin, and many more game programming gurus

The Don Crabb Macintosh Library

Image description: A book cover with a glowing orange and red dotted 3D wireframe arena image across the top, large blue-and-orange block lettering for the title, and a small CD-ROM disc graphic beside the right-hand text on a black background.

Reading notes: The top headline is partly cropped at the left edge, so the first letter appears as 'laster' with the M cut off; reconstructed as 'Master'. QuickDraw™ trademark symbol rendered as superscript TM; transcribed as QuickDraw 3D without the symbol. Reading order of the title lines is inferred from layout: 'TRICKS OF THE MAC' then 'GAME PROGRAMMING' then 'GURUS'.

Printed product names: Tricks of the Mac Game Programming Gurus · QuickDraw 3D

Languages: English

[Original Image 1](https://www.vintageapple.net/files/c06e74b873ffe3704b193c6b6a0293d15382c1b8107ed2d476dab2457c2ea20a/0e9deb9136cc1368aa4906aa.webp)

### PDF page 1

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-tricks-of-the-mac-game-programming-gurus-1995-f45349/1#scan-09eff903a63104f9c75d916f743b1eafbebff2fb03e09cb9ae598e26f5c30364)

Tricks of the Mac Game Programming Gurus

Transcribed text:

Master the Techniques You Need to Create Your Own Games

TRICKS OF THE MAC
GAME PROGRAMMING
GURUS

Secrets and techniques from expert game programmers!

Covers QuickDraw™ 3D, porting, networking, Power Macs and more!

CD-ROM includes programming tools and utilities, sample code, games, demos, and more!

Jamie McCornack, Ingemar Ragnemalm, Paul Celestin, and many more game programming gurus

The Don Crabb Macintosh Library

Image description: A book cover with a glowing orange-and-red abstract 3D grid and ring illustration across the top, black background, large blue and yellow condensed block lettering, and a small CD-ROM disc graphic beside the text.

Reading notes: The first word of the top banner is cut off at the left edge and appears as 'laster'; it is likely 'Master' but is partially cropped. The word 'MAC' is printed in red while 'TRICKS OF THE' is blue; reading order for the title block is inferred from layout. Ragnemalm and Celestin spellings are read from the image and should be confirmed against the source.

Printed product names: Tricks of the Mac Game Programming Gurus

Languages: English

[Original PDF page 1](https://www.vintageapple.net/files/1102f0dfae39d1790522791413372008ef7c9daed513dd44ae8da66055d9c3db/Tricks_Of_The_Mac_Game_Programming__Gurus_1995.pdf#page=1)

### PDF page 2

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-tricks-of-the-mac-game-programming-gurus-1995-f45349/1#scan-21be8352aa1f04b4ab18cd282548ab76ea4e46cdf687dde1292a7e8e6d7831be)

Fellow Game Programmers

Transcribed text:

Fellow   Game   Programmers\
P<ogr.unm;ng   top-quality   game'   i'   "'°more   fun   than   playing   lltem-   Every   time   a   -
grune   prog<.mm«   gcl''   paycheck,   <oy"1ty   p,ymen<.   o<   re&i'uation   fee, a   g<in   c<nne'
,1ong   wilh   iL   "Can   you believe it, l get to do thi'   nW   """·   pU'h   what''   po"ible   on   lhe
M",   exe<eit;<•   my   bnlln,   and   ).ugh   while I'm doing it   -   and   they give me money,   too!"
lf   you   ate   on<   of the'e people,   OL   you   want   to be, thi' book   i'   fo<   you.   ThIB   IB   a   "h"'d'-
on"   book   -   not too much   theo<Y   ,.d   a whole lot of   pmcti<>C-   You<   guide'   h.ve   ,peot
lhe"   time in   me   uenche,,   and they know the   diffe<ence   between   truking   •bout   prog<""'-
ming   ond   ,ol\ing   up   thei<   ,ieeve'   and   doing it.   Grune   p<og"mnUng   i'   oomplex,   and   wilh
me   Macin""h   G•"   like   the   oiliet   p"'tfotm' ),   garo<'   "e   where   me   cutting-edge   of   me
prog"mming   art   i'   honed.   Grune''"'   where   the   Mac   ,hnW'   its   "uff-   how quickly it
"n   mainpulate   d.ta.   how   ,mooilily   it   oan   P'"""t   moving   Un•g<'.   how   deatlY   it   can
tep<oduce   ,ouni\,   and   mufilc,   how   compaclly   it   can   ,tore   complex   iofonnatioo.   lf   you
oan   m""'   Macinto'h   grune   p<Og"-nuning,   "mund"'e"   pro"""'°"ing   will be a   piece   of
c"1<e-   The   technique'   u'"'1   in   gume'   tod,Y   will be   u.,d   in multimedia   next   ye><.   and   will
be found in business presentations the year after that.
Out   ,uilio<'   have   encl>   .,lected   a   ,peciol   topic to   oove<   in   depili   You won' t   trreeze
through   thi•   book   -   it'•   too jam-packed full of   ioloon•tion   -   but you   will   find   me
infmmation   ea'Y   to   integ<ate   into   yom   own   p<ojocts.   The   CD-ROM   i'   full   ofU'eful
code-   mud>   of it   wriuen   e,pecially   fo<   thi' book,   and   .,me   of it   taken   direct   ftom   popu-
l"   gum<'   ftom   top   pubU,he"-   But don't   wo<<Y.   we got   lhe   prog<anun«''   penni"ion   to
use the code   -   we got the programmers to write the   book!
Ple""   ""d   you<   oonunents   on   iliIB   boOk.   ,.d   you<   ,uggeati-OR'   lo<   ou<   next   book on
Mac   grune   developmen4   di,-ectly   to me,   o<   to   <he   publi,het. We   k•OW   you'll find thi'
book   ""'fol   and   infonnative,   and we hope you have   Ion   wiili   it, too- We hope you hav
as much fun using this book   as we   did writing   it!
Sincerely,
:5~)/_c-t
Jamie McCornack
Project Editor
MacGameDev   on   America   Online
macgamedev@aol.com

Reading notes: OCR damage throughout body text, e.g. 'P<ogr.unm;ng' and 'lltem-' in the opening paragraph Headline reading order uncertain given the column-split layout of the copy

Printed product names: CD-ROM · America Online

Languages: English

[Original PDF page 2](https://www.vintageapple.net/files/1102f0dfae39d1790522791413372008ef7c9daed513dd44ae8da66055d9c3db/Tricks_Of_The_Mac_Game_Programming__Gurus_1995.pdf#page=2)

### PDF page 3

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-tricks-of-the-mac-game-programming-gurus-1995-f45349/1#scan-a14597e42669aae52e55bdd16d57fb3a108ff8cb013143ea9a845965fa6bf55f)

Transcribed text:

Read this book and no longer will you wonder wliat   it 1 1J
Mac game.   You'll   know how to make graphics and   so
the Mac Game Programming Gurus   tells you   what   to
and why to do it, and a whole lot more, besides gi   ·
the game gurus use.   Plus,   you get the tools (don't   fotg
the book!) you need to get the job done.
But don't take my word for it Read the book and tell
Mac Game Programming   Gurus   lives   in   the   Don   cf8
delivers the inside goods on game programming
games. Let it   be   your companion for finding   and*
in   your gray matter.
See   you   on the ether,

Reading notes: OCR damage in several words (e.g., 'wliat', 'fotg', 'cf8', 'Don') Reading order of fragmented lines is uncertain

Printed product names: Mac Game Programming Gurus

Languages: English

[Original PDF page 3](https://www.vintageapple.net/files/1102f0dfae39d1790522791413372008ef7c9daed513dd44ae8da66055d9c3db/Tricks_Of_The_Mac_Game_Programming__Gurus_1995.pdf#page=3)

### PDF page 4

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-tricks-of-the-mac-game-programming-gurus-1995-f45349/1#scan-7b38552c753fbce362dc027fd530e9d23a4023927dd752f76ede9602bcfa6e84)

Transcribed text:

U~~©~~   @il   U[fo~   rnvtJ~©®
@ @.   [fffiJ   @
~   ~@   ~   ~@   ITffiJ   ITffiJ   ~   ITU   ~
@J   01J   ~   01J   ~
by Mccornack, Ragnemalm,   Celestin,   et al.

Reading notes: Most characters in the source text are garbled or damaged and cannot be reliably read. Legible fragment 'by Mccornack, Ragnemalm, Celestin, et al.' appears to be an attribution line; its role in the printed copy is uncertain.

[Original PDF page 4](https://www.vintageapple.net/files/1102f0dfae39d1790522791413372008ef7c9daed513dd44ae8da66055d9c3db/Tricks_Of_The_Mac_Game_Programming__Gurus_1995.pdf#page=4)

### PDF page 5

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-tricks-of-the-mac-game-programming-gurus-1995-f45349/1#scan-36b31f69ffccd5cb09b80a4f22e5e7687bdda705bd4d65b097d5f461fd8ff298)

Transcribed text:

Tricks of the Mac® Game Programming Gurus
©1995 Hayden Books, a division of Macmillan Computer Publishing
All rights reserved. Printed in the   United   States   of America. No part of this book
may be used or reproduced in any form or by any means, or stored in a database or
retrieval system, without prior written permission of the publisher except in the case
of brief quotations embodied in critical articles and reviews. Making copies of any
part of this book for any purpose other than your own personal use is a violation of
United   States   copyright laws. For information, address Hayden Books,   201W.103rd
Street,   Indianapolis, Indiana   46290.
Library of Congress Catalog Number: 95-60416
ISBN:   1-56830-183-9
This book is sold as is, without warranty of any kind, either express or implied.
While every precaution has been taken in the preparation of this book, the publisher
and author assume no responsibility for errors or omissions. Neither is any liability
assumed for damages resulting from the use of the information or instructions
contained herein.   It   is further stated that the publisher and author are not respon-
sible for any damage or loss to your data or your equipment that results directly or
indirectly from your use of this book.
97   96   95   4   3   2
Interpretation of the printing code: The rightmost double-digit number is the year of
the book's printing; the rightmost single-digit number is the number of the book's
printing. For example, a printing code of 95-1 shows that the first printing of the
book occurred in 1995.
Trademark Acknowledgments:   All products mentioned in this book are either
trademarks of the companies referenced in this book, registered trademarks of the
companies referenced in this book, or neither. We strongly advise that you investi-
gate a particular product's name thoroughly before you use the name as your own.
Apple, Mac, and Macintosh are registered trademarks of Apple Computer, Inc.

Reading notes: Printing code interpretation example refers to '95-1' and the catalog number '95-60416' is listed separately; dates may be ambiguous as printed years.

Printed product names: Mac · Macintosh

Printed dates: 1995 · 95-60416 · 95-1

Languages: English

[Original PDF page 5](https://www.vintageapple.net/files/1102f0dfae39d1790522791413372008ef7c9daed513dd44ae8da66055d9c3db/Tricks_Of_The_Mac_Game_Programming__Gurus_1995.pdf#page=5)

### PDF page 6

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-tricks-of-the-mac-game-programming-gurus-1995-f45349/1#scan-65b165b9cca9dd866cf756b3e9ce891fc10f61d632299d66affb6fded0fb37a6)

Transcribed text:

The Hayden Books Team
Publisher
David Rogelberg
Product   Development   Manager
Patrick Gibbons
Acquisitions Editor
Stacy Kaplan
Development   Editor
Brad Miser
Copy/Production Editor
Steve Mulder
Technical   Reviewers
·   MarkAdams
Stuart Cheshire
Dennis Cohen
Brian Greenstone
Jake Hoelter
Interviewer
Tom Thompson
Publishing   Coordinator
Rosemary Lewis
Interior   Designer
Fred Bower
Cover Designer
Jay Corpus
Production
Angela Calvert, Dan Caparo, Kim Cofer,
Kevin Foltz, David Garratt, Shawn
MacDonald, Joe Millay, Erika Millen,
Beth Rago, Regina Rexrode, Erich   J.
·   Richter, Christine Tyner, Karen Walsh,
Robert Wolf
Indexer
Bront Davis

Languages: English

[Original PDF page 6](https://www.vintageapple.net/files/1102f0dfae39d1790522791413372008ef7c9daed513dd44ae8da66055d9c3db/Tricks_Of_The_Mac_Game_Programming__Gurus_1995.pdf#page=6)

### PDF page 7

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-tricks-of-the-mac-game-programming-gurus-1995-f45349/1#scan-edba45f6d2f387f3af77eb682530cdd10cbefdb5266aee851b494b01569d357c)

To Our Readers

Transcribed text:

To   Our   Readers
Dear Friend,
Thank you on behalf of everyone at
Hayden Books for choosing   Tricks of the
Mac Game Programming Gurus   to enable
you to explore game programming on
the Macintosh. For many reasons, the
Mac is the best platform for games, and
fortunately games on the Mac are
exploding in both quality and popular-
ity. This book will help you make your
own contribution to this growth.
We'd love to see any games that this
book helps you with.   Please   write and
let us know. What you think of this
book is important to our ability to
better serve you in the future.   If   you
have any comments, no matter how
great or small, we'd appreciate you
taking the time to send us email or a
note by snail mail.   Of   course, we'd love
to hear your book ideas.
Sincerely yours,
-   J/_:.t
You can reach Hayden Books at the
following:
Hayden Books
201West103rd   Street
Indianapolis, IN 46290
(800) 428-5331 voice
(800) 448-3804 fax
Email addresses:
America Online: Hayden Bks
Apple   Link:   hayden.books
CompuServe:   76350,3014
Internet:   hayden@hayden.com

Reading notes: Signature line is illegible and cannot be transcribed. Reading order of the mailing address block and contact list is inferred from layout of extracted text.

Printed product names: Tricks of the Mac Game Programming Gurus

Languages: English

[Original PDF page 7](https://www.vintageapple.net/files/1102f0dfae39d1790522791413372008ef7c9daed513dd44ae8da66055d9c3db/Tricks_Of_The_Mac_Game_Programming__Gurus_1995.pdf#page=7)

### PDF page 8

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-tricks-of-the-mac-game-programming-gurus-1995-f45349/1#scan-a011d8421d668990a54f24a3f7a9d9f6e1a79f9874677edddca8856b6b3663f0)

Contents at a Glance

Transcribed text:

Contents   at a   Glance
0   A Game Programming Primer ........................................................... 1
1   Your First Game ............................................................................... 41
2   Basic Game Graphics ....................................................................... 87
3   Advanced Graphics ........................................................................ 121
4   File Management ...........................................................................   209
5   User Interaction .............................................................................. 265
6   Audio .............................................................................................. 327
7   Game Mechanics: Environments and Entities ............................... 389
8   Game Mechanics: Behavior ........................................................... 433
9   QuickDraw 3D ............................................................................... 491
10   Networking .................................................................................... 547
11   Porting ............................................................................................ 627
12   Game Aesthetics .............................................................................   709
13   Optimizing   Game Code for   PowerPC   ............................................ 731
14   Glypha III: A Case Study ............................................................... 749
A   Top Speed-or Not? ...................................................................... 797
B   Macintosh Environments ............................................................... 811
Index .............................................................................................. 843

Reading notes: Page numbers and chapter titles are dotted-leader contents entries; the 'Top Speed-or Not?' and 'Macintosh Environments' appendix titles were read as printed.

Languages: English

[Original PDF page 8](https://www.vintageapple.net/files/1102f0dfae39d1790522791413372008ef7c9daed513dd44ae8da66055d9c3db/Tricks_Of_The_Mac_Game_Programming__Gurus_1995.pdf#page=8)

### PDF page 9

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-tricks-of-the-mac-game-programming-gurus-1995-f45349/1#scan-d3925b446825fcf377127afb1363b75375b41253cb727f614097e5f4a5c4c84c)

Table of Contents

Transcribed text:

Table of   Contents
0   A   Grune   Programming   Primer   ........................................................... 1
Animation Basics ........................................................................ 2
What's Animation? ............................................................... 2
How Quick Is Quick Enough? ............................................. 2
How Smooth Is Smooth Enough? ........................................ 4
How Fast Is Too Fast? .......................................................... 5
The Hello   World Code .............................................. · ................... 6
HelloWorldl: Bare Bones .................................................... 6
HelloWorld2: Color and Complexity ................................. 16
HelloWorld3: Clams in Formation ..................................... 23
HelloWorld4:   Clruns   in Collision ....................................... 25
HelloWorld5:   Clruns   in Multibit ........................................ 26
HelloWorld6: 8 Bits Preferred ........................................... 28
HelloWorld6. l: No Brakes .................................................   30
Some Sound Advice ..................................................................   30
Sound Markers ................................................................... 31
Synchronous vs. Asynchronous Sound .............................. 32
MGWSound.c .................................................................... 32
What Do I Do Next? ................................................................. 39
1   Your First Game ............................................................................... 41
Dungeon   I   ................................................................................. 41
Graphics ............................................................................. 42
Sounds ................................................................................ 43
Moving Around and Fighting ............................................. 44
Random Numbers .............................................................. 45
Let's See Some Source Code! ................................................... 45
Building Dungeon .............................................................. 46
Understanding   Dungeon .................................................... 46
Declarations, Constants, and Variables .............................. 46
Subroutines ........................................................................ 49
The Main   Progrrun   ............................................................. 58
But How about My   Own   First Game? ...................................... 59
Problem   1: A Good Idea ....................................................   60
Can You Do It? ................................................................... 61
Can the Computer Do It? ................................................... 61
Can Your   Players   Do It? ..................................................... 64

Reading notes: Several characters in headings appear garbled, e.g. 'Clruns' and 'Progrrun'. Dotted-leader page numbers and reading order of some entries are uncertain.

Languages: English

[Original PDF page 9](https://www.vintageapple.net/files/1102f0dfae39d1790522791413372008ef7c9daed513dd44ae8da66055d9c3db/Tricks_Of_The_Mac_Game_Programming__Gurus_1995.pdf#page=9)

### PDF page 10

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-tricks-of-the-mac-game-programming-gurus-1995-f45349/1#scan-2b51a1b53c50283c34e075a8ebeb0ce2e39b17513569005c258c9bf29ae0a3db)

Transcribed text:

All Those Games ....................................................................... 65
2-D Space Games ............................................................... 65
Platform Games ................................................................. 66
Side-Scrollers ..................................................................... 67
Board Games and Puzzle Games ....................................... 69
Card Games ........................................................................   70
First-Person 3-D Action Games ......................................... 71
Adventure Games ............................................................... 72
Dungeon-Digging Games .................................................. 74
Abstract Action Games ...................................................... 75
Simulation Games .............................................................. 77
Strategy Games .................................................................. 77
Programmer's Games ......................................................... 79
Dungeon 1   Plus   .........................................................................   80
Map Generation .................................................................   80
Source Code Additions ......................................................   80
Leaving the Game .............................................................. 85
2   Basic Game Graphics ....................................................................... 87
Color Theory ............................................................................. 87
How to Dress Better ........................................................... 88
Comparing RGB and RYB ................................................. 89
The Color Wheel ................................................................   90
Using Color Wisely ............................................................ 91
HSV   and the Color Picker .................................................. 92
Indexed and Direct Graphics Hardware .................................... 96
Direct Devices .................................................................... 96
Fixed Devices ..................................................................... 96
Indexed Devices and Color Tables ..................................... 96
Palettes and the Palette Manager   ............................................... 99
Using Palettes ...................................................................   102
Drawing with Palettes ......................................................   105
Palette Animation .............................................................   106
Of   GWorlds and GDevices ......................................................   108
A Graphic Buffer, Pixmap, and   CopyBi   ts () Primer .......   108
Why   Use   an Off-Screen? .................................................   109
GWorlds ...........................................................................   110
GDevices .......................................................................... 113
Game Graphics Programming ................................................. 116
Multiple Monitor Tactics ................................................. 116
Fading Strategies .............................................................. 117
Hiding the Menu Bar Suavely .......................................... 118
Your Friend,   CopyBits()   ................................................. 118

Reading notes: Source is a table of contents with dot leaders; no primary headline or advertised products, prices, or dates are present. Some characters are split or spaced (e.g., 'Dungeon 1 Plus', 'CopyBi ts ()', 'Of GWorlds'), possibly from extraction damage.

Languages: English

[Original PDF page 10](https://www.vintageapple.net/files/1102f0dfae39d1790522791413372008ef7c9daed513dd44ae8da66055d9c3db/Tricks_Of_The_Mac_Game_Programming__Gurus_1995.pdf#page=10)

### PDF page 11

[Cite this scan](https://www.vintageapple.net/transcripts/media/va-tricks-of-the-mac-game-programming-gurus-1995-f45349/1#scan-542a53c180d5c4841d12bceb427d094cb6ffcc2003fb7e691f9ac761bdd00d1f)

Transcribed text:

3   Advanced Graphics ........................................................................ 121
The Theory .............................................................................. 121
The Practice ............................................................................. 122
Example 1: A Very Simple Scene .................................... 122
Example 2:   CopyMask() ...................................................   144
Example 3: A Clear Color Sprite Draw ...........................   150
Example 4: Encoded Sprites ............................................ 159
Example 5: Dirty Rectangle ............................................. 179
Example 6: An   Update   Rectangle List ............................. 188
Example 7: The Background ........................................... 195
4   File Management ...........................................................................   209
The File Manager and the Resource Manager ........................   209
The Two Forks .................................................................   210
A Quick Look into the File Manager ............................... 211
Resources and Handles .................................................... 211
Loading and Creating Resources ..................................... 213
Using   Resources and Handles .......................................... 214
Storing Pregenerated Data ....................................................... 215
Saving Settings ........................................................................   220
Switching between Several Resource Files ............................. 223
Saving High Score Lists .......................................................... 226
Saving the Player's   "Save"   Files ............................................. 232
Save Files .........................•............................................... 232
Internally Recorded Game State ...................................... 233
Passwords ......................................................................... 233
Dungeon 3 ........................................................................ 233
Dungeon 3's Save File Management Routines ................ 235
Apple Events in Dungeon 3 ............................................. 238
Other   Changes in the Dungeon Source ............................ 241
Using   Data Formats ................................................................ 243
Putting Together Your Resource File with ResEdit ......... 243
Navigating in ResEdit ...................................................... 244
'STR#' Resources ............................................................ 246
Adding String Lists .......................................................... 246
'STR' Resources ............................................................. 247
'TEXT'   /'styl' Resources .................................................. 247
Balloon Help Resources ................................................... 248
Resources for the   OS   and the Finder ...............................   250
Menu Resources ............................................................... 253

Reading notes: Table of contents format with page numbers; headline not identifiable as a primary printed heading Some characters and spacing are irregular (e.g. 'Using   Resources'), possibly from extraction

Languages: English

[Original PDF page 11](https://www.vintageapple.net/files/1102f0dfae39d1790522791413372008ef7c9daed513dd44ae8da66055d9c3db/Tricks_Of_The_Mac_Game_Programming__Gurus_1995.pdf#page=11)

[Next transcribed scans](https://www.vintageapple.net/transcripts/media/va-tricks-of-the-mac-game-programming-gurus-1995-f45349/2.md)
