CLASSIC GAME DESIGN Second Edition Classic Game Design 2E_Ch00_FM_2nd Pass.indd 1 5/2/2019 5:06:56 PM LICENSE, DISCLAIMER OF LIABILITY, AND LIMITED WARRANTY By purchasing or using this book (the “Work”), you agree that this license grants permission to use the contents contained herein, but does not give you the right of ownership to any of the textual content in the book or ownership to any of the information or products contained in it. This license does not permit uploading of the Work onto the Internet or on a network (of any kind) without the written consent of the Publisher. Duplication or dissemination of any text, code, simulations, images, etc. contained herein is limited to and subject to licensing terms for the respective products, and permission must be obtained from the Publisher or the owner of the content, etc., in order to reproduce or network any portion of the textual material (in any media) that is contained in the Work. Mercury Learning and inforMation (“MLI” or “the Publisher”) and anyone involved in the creation, writing, or production of the companion disc, accompanying algorithms, code, or computer programs (“the software”), and any accompanying Web site or software of the Work, cannot and do not warrant the performance or results that might be obtained by using the contents of the Work. The author, developers, and the Publisher have used their best efforts to insure the accuracy and functionality of the textual material and/or programs contained in this package; we, however, make no warranty of any kind, express or implied, regarding the performance of these contents or programs. The Work is sold “as is” without warranty (except for defective materials used in manufacturing the book or due to faulty workmanship). The author, developers, and the publisher of any accompanying content, and anyone involved in the composition, production, and manufacturing of this work will not be liable for damages of any kind arising out of the use of (or the inability to use) the algorithms, source code, computer programs, or textual material contained in this publication. This includes, but is not limited to, loss of revenue or profit, or other incidental, physical, or consequential dam- ages arising out of the use of this Work. The sole remedy in the event of a claim of any kind is expressly limited to replacement of the book, and only at the discretion of the Publisher. The use of “implied warranty” and certain “exclusions” vary from state to state, and might not apply to the purchaser of this product. Companion files on the disc are also available by writing to the publisher at info@mer- clearning.com. Classic Game Design 2E_Ch00_FM_2nd Pass.indd 2 5/2/2019 5:06:56 PM CLASSIC GAME DESIGN From Pong to Pac-Man with Unity Second Edition Franz Lanzinger Mercury Learning and Information Dulles, Virginia | Boston, Massachusetts | New Delhi Classic Game Design 2E_Ch00_FM_2nd Pass.indd 3 5/2/2019 5:06:56 PM Copyright ©2019 by Mercury Learning and inforMation LLC. All rights reserved. This publication, portions of it, any companion materials, or its derivations, may not be reproduced in any way, stored in a retrieval system of any type, or transmitted by any means, media, electronic display or mechanical display, including, but not limited to, photocopies, recordings, Internet postings, or scans, without prior permission in writing from the publisher. Publisher: David Pallai Mercury Learning and inforMation 22841 Quicksilver Drive Dulles, VA 20166 [email protected] www.merclearning.com (800) 232-0223 This book is printed on acid-free paper. Franz Lanzinger. Classic Game Design. From Pong to Pac-Man with Unity, Second Edition. ISBN: 978-1-68392-385-5 The publisher recognizes and respects all marks used by companies, manufacturers, and developers as a means to distinguish their products. All brand names and product names mentioned in this book are trademarks or service marks of their respective companies. Any omission or misuse (of any kind) of service marks or trademarks, etc. is not an attempt to infringe on the property of others. Library of Congress Control Number: 2019939379 192021 321 Printed on acid-free paper in the United States of America. Our titles are available for adoption, license, or bulk purchase by institutions, corporations, etc . For additional information, please contact the Customer Service Dept. at 1-(800) 232-0223. The sole obligation of Mercury Learning and inforMation to the purchaser is to replace the disc, based on defective materials or faulty workmanship, but not based on the operation or functionality of the product. Table of Contents — v Classic Game Design 2E_Ch00_FM_2nd Pass.indd 4 5/2/2019 5:06:56 PM TABLE OF CONTENTS CHAPTER 1: INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1 Who Are You?........................................................1 What are Classic Arcade Video Games? ..................................2 Unity, Blender, Gimp, and Audacity.....................................4 How to Use This Book .................................................6 CHAPTER 2: TOOLS OF THE TRADE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .8 Installing Unity ......................................................8 Hello World! ........................................................10 Programming with C#................................................17 Using GIMP to Make an Image ........................................22 Using Blender to Make a 3D Object.....................................25 Using Audacity to Make a Sound Effect .................................28 Using Unity: My First Demo ..........................................31 CHAPTER 3: PONG. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .40 Before Pong.........................................................40 Pong, Atari (1972) ...................................................42 Coin-op, the Real Atari ...............................................44 Pong Sequels and Clones..............................................44 Bitmasters, Day One .................................................44 Pong at Forty .......................................................45 CHAPTER 4: CLASSIC PADDLE GAME. . . . . . . . . . . . . . . . . . . . . . . . . . . .46 Getting Ready.......................................................46 Version 0.01: The Playfield............................................46 Version 0.02: The Paddles.............................................52 Version 0.03: The Ball ................................................57 Version 0.04: A Better Playfield........................................59 Version 0.05: Audio ..................................................61 Version 0.06: Scoring.................................................64 Version 1.0: First Release!.............................................67 Table of Contents — v Classic Game Design 2E_Ch00_FM_2nd Pass.indd 5 5/2/2019 5:06:56 PM Postmortem.........................................................68 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .69 CHAPTER 5: BREAKOUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .71 Woz . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .71 Breakout, Atari (1976)................................................71 Breakout Sequels ....................................................74 Where Are They Now?................................................75 CHAPTER 6: CLASSIC BRICK GAME . . . . . . . . . . . . . . . . . . . . . . . . . . . . .76 Paddle Game for One. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .76 Version 0.01: The Playfield............................................77 Version 0.02: The Player..............................................80 Version 0.03: Basic Ball Movement.....................................83 Version 0.04: Collisions ...............................................86 Version 0.05: Bricks..................................................91 Version 0.06: First Playable ...........................................95 Version 0.07: Scoring.................................................96 Version 0.08: Title Screen .............................................99 Version 1.0: First Release and Postmortem .............................102 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .103 CHAPTER 7: SPACE INVADERS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .104 Huge Money, Huge..................................................104 The Design of Space Invaders, Taito (1978) .............................104 Score Equals Skill ..................................................105 Going Strong 41 Years Later .........................................107 CHAPTER 8: CLASSIC GAME PROJECT THREE: VERTICAL SHOOTER. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .108 Designing a Shooter.................................................108 Version 0.01: The Playfield...........................................108 Version 0.02: The Spaceship..........................................112 Version 0.03: Sprites ................................................117 Version 0.04: Aliens.................................................126 Version 0.05: Alien Shots ............................................133 vi — Classic Game Design, Second Edition Table of Contents — vii Classic Game Design 2E_Ch00_FM_2nd Pass.indd 6 5/2/2019 5:06:56 PM Version 0.06: Scoring and Lives.......................................138 Version 0.07: Alien Death Sequence ...................................149 Version 0.08: Sound.................................................153 Version 0.09: Levels.................................................156 Version 1.0: Release and Postmortem..................................162 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .163 CHAPTER 9: SCRAMBLE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .165 Scrolling Shooter ...................................................165 Experts Rule.......................................................166 Scramble Sequels...................................................167 CHAPTER 10: CLASSIC GAME PROJECT FOUR: SCROLLING SHOOTER. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .169 Designing a Scrolling Shooter.........................................169 Version 0.01: The Playfield...........................................171 Version 0.02: Spaceship Part 1: Modeling...............................179 Version 0.03: Spaceship Part 2: Texturing ..............................186 Version 0.04: Spaceship Control.......................................191 Version 0.05: Level 1 ................................................196 Version 0.06: Rockets................................................200 Version 0.07: Flying Rockets..........................................204 Version 0.08: Shots..................................................212 Version 0.09: Flying Saucers..........................................217 Version 0.10: Level Design ...........................................223 Version 0.11: Audio .................................................229 Version 0.12: Scoring................................................231 Version 1.00: Release and Postmortem.................................233 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .234 CHAPTER 11: PAC-MAN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .236 The First Maze Game ...............................................236 Cutscenes .........................................................237 Pac-Man Fever.....................................................238 Ending Rule .......................................................238 Pac-Man AI........................................................239 Pac-Man Sequels and Maze Games....................................240 Table of Contents — vii Classic Game Design 2E_Ch00_FM_2nd Pass.indd 7 5/2/2019 5:06:56 PM CHAPTER 12: CLASSIC GAME PROJECT FIVE: MAZE GAME . . . . . .244 Designing a Maze Game .............................................244 Version 0.01: The Maze..............................................245 Version 0.02: The Player.............................................251 Version 0.03: Nasty Enemies .........................................254 Version 0.04: Dots ..................................................258 Version 0.05: Audio .................................................259 Version 0.06: Scoring and Levels ......................................262 Version 0.07: Tuning ................................................268 Version 1.00: Release and Postmortem.................................270 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .271 EPILOGUE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .272 So Many Games, So Few Pages .......................................272 Novelty. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .273 How Modern Games are Influenced by the Classics ......................273 APPENDIX I: INTRODUCTION TO C# FOR BEGINNERS. . . . . . . . . . . .276 Programming Is Easy ...............................................276 Interpreted or Compiled? ............................................277 Numbers and Strings................................................278 Variables and Variable Names........................................279 Whitespace ........................................................281 Statements and Semicolons ..........................................281 Computations ......................................................282 Functions and Function Calls.........................................282 Looping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .283 Learning to Code ...................................................284 The Code in this Book ...............................................284 APPENDIX II: EIGHT RULES OF CLASSIC GAME DESIGN . . . . . . . . .286 APPENDIX III: ABOUT THE DVD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .287 INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .288 viii — Classic Game Design, Second Edition Classic Game Design 2E_Ch00_FM_2nd Pass.indd 8 5/2/2019 5:06:56 PM Acknowledgments I’d like to thank just some of the many people who made this book possible. Most significantly, Eric Ginner and Robert Jenks read and worked through large portions of the book in draft form and gave voluminous feedback and suggestions. This book would be less without their valuable contributions. Special thanks to Mark Robichek, Karl Anderson, Mark Alpiger, Sam Mehta, Brian McGhie, Desiree McCrorey, Joe Cain, Eugene Polonsky, Bob Jones, Aaron Hightower, Ed Logg, Dave O’Riva, Steve and Susan Woita, and everyone at Atari coin-op. David Pallai, my fantastic publisher, helped every step of the way and is always kind and supportive. A big word of thanks to my parents, Klaus and Aida Lanzinger, for their human- ity and love. And last, but not least, a giant hug and thank you to my wife, Susan Lanzinger, for helping throughout the years. I couldn’t have done this without you. Acknowledgments — ix Classic Game Design 2E_Ch00_FM_2nd Pass.indd 9 5/2/2019 5:06:56 PM About the Author Franz Lanzinger is the owner of Lanzinger Studio, an independent game development and music studio in Sunnyvale, California. He began his career in game programming in 1982 at Atari Games Inc., where he designed and programmed the classic arcade game Crystal Castles. In 1989 he joined Tengen, where he was a programmer and designer for Ms. Pac-Man and Toobin’ on the NES. Mr. Lanzinger co-founded Bitmasters, where he designed and coded games including Rampart and Championship Pool for the NES and SNES, and NCAA Final Four Basketball for the SNES and Sega Genesis. In 1996 Mr. Lanzinger founded Actual Entertainment, publisher and developer of the Gubble series for PC and IOS. Mr. Lanzinger has a B.Sc. in mathematics from the University of Notre Dame and attended graduate school at the University of California at Berkeley. In 1980 he started playing arcade games, and at one time held the arcade world record scores on Centipede and Burgertime. Franz Lanzinger is a professional accompanist, piano teacher, and avid golfer. He continues to design and code games. x — Classic Game Design, Second Edition Classic Game Design 2E_Ch00_FM_2nd Pass.indd 10 5/2/2019 5:06:56 PM