CYAN YELLOW MAGENTA BLACK PANTONE 123 CV The Game Maker’s Apprentice Game Development for Beginners TECHNOLOGY IN ACTION™ T h e The G a Game Maker’s I m f you want to learn the craft of making computer games, then you’ve come to the right place. This book, and companion CD, provide all you need to create your own games e for Microsoft Windows using Game Maker. It introduces beginners of all ages to the art of creating computer games. All the graphics, sound effects, and music you’ll need are M included to put together no less than nine professional-looking games! Apprentice Game Maker allows you to begin creating games almost immediately, using a simple a drag-and-drop system that makes learning to program much easier than traditional pro- gramming languages. This book brings together the expertise of Game Maker’s creator with k a professional game developer to present a complete guide to designing and programming e games that are fun to play. r The authors’ passion and enthusiasm for game development really shine ’ through in The Game Maker’s Apprentice, and you’ll soon discover that the s Game Development process of creating games can be just as fun as actually playing them! A for Beginners p p MINIMUM HARDWARE REQUIREMENTS PC Running Windows 98SE or Above r CD or DVD-ROM Drive e Create PC games the easy way using 32MB DirectX-Compatible Graphics Card DirectX-Compatible Sound Card n Game Maker’s simple drag-and-drop interface DirectX 8 or Above t Learn essential game design theory i c Make your games more fun! Join online discussions: e forums.apress.com RREE AA FOR PROFESSIONALS BY PROFESSIONALS™ WW TT FF OO IINNCCLLUUDDEESS CCDD Jacob Habgood EERR SSEEEEDD KK NN ISBN 1-59059-5631959-93 USUhsSeer lv $lee3 vi9ne. lG:9Ba9emgein Pnreorgramming OHvaebrgmoaords and Mark Overmars WWIITTHH EGEGRARAYYMMTTEEH EH EIIAAMNMNTTAGAGE E YY99 OOGGUU AAMMEESS!! Foreword by Phil Wilson, DD EEVV CCRR the producer of the highly anticipated Xbox 360™ game Crackdown. SS CCNNDD TTOO EE AA 6 89253 59615 9 9 781590 596159 www.apress.com LLUUDD CC NN II this print for content only—size & color not accurate 7" x 9.25" spine = 18.2 mm 336 page count 6153FM.qxd 3/25/06 3:50 PM Page i The Game Maker’s Apprentice Game Development for Beginners Jacob Habgood Mark Overmars 6153FM.qxd 3/27/06 3:29 PM Page ii The Game Maker’s Apprentice: Game Development for Beginners Copyright © 2006 by Jacob Habgood and Mark Overmars All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. In purchasing this book, the authors and publisher grant you permission to use the electronic resources from the accompanying CD for commercial or noncommercial use in your own games made with Game Maker. However, redistribution of the original games or their resources is prohibited and the authors retain full copyright of all the original game concepts and the intellectual property associated with them. ISBN-13 (pbk): 978-1-59059-615-9 ISBN-10 (pbk): 1-59059-615-3 Printed and bound in China 9 8 7 6 5 4 3 2 1 Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. Lead Editor: Chris Mills Development Editor: Adam Thomas Technical Reviewer/Additional Material: Sean Davies Editorial Board: Steve Anglin, Ewan Buckingham, Gary Cornell, Jason Gilmore, Jonathan Gennick, Jonathan Hassell, James Huddleston, Chris Mills, Matthew Moodie, Dominic Shakeshaft, Jim Sumser, Keir Thomas, Matt Wade Project Manager: Richard Dal Porto Copy Edit Manager: Nicole LeClerc Copy Editor: Liz Welch Assistant Production Director: Kari Brooks-Copony Production Editor: Ellie Fountain Compositor: Dina Quan Proofreader: Lori Bring Indexer: Present Day Indexing Artist: Kinetic Publishing Services, LLC Illustrations and Cover Art: Kevin Crossley Game Artists: Kevin Crossley, Matty Splatt and Ari Feldman Cover Designer: Kurt Krames Manufacturing Director: Tom Debolski Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail [email protected], or visit http://www.springeronline.com. For information on translations, please contact Apress directly at 2560 Ninth Street, Suite 219, Berkeley, CA 94710. Phone 510-549-5930, fax 510-549-5939, e-mail [email protected], or visit http://www.apress.com. The information in this book is distributed on an “as is” basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. 6153FM.qxd 3/25/06 3:50 PM Page iii To halcyon days with a frog, a parrot, and a talented bunch of gremlins. 6153FM.qxd 3/25/06 3:50 PM Page iv Contents at a Glance Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiv About the Authors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvi About the Technical Reviewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii About the Illustrator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xviii Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xx PART 1 ■ ■ ■ Getting Started ■CHAPTER 1 Welcome to Game Maker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 ■CHAPTER 2 Your First Game:Devilishly Easy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 PART 2 ■ ■ ■ Action Games ■CHAPTER 3 More Actions:A Galaxy of Possibilities . . . . . . . . . . . . . . . . . . . . . . . . . 41 ■CHAPTER 4 Target the Player:It’s Fun Being Squished . . . . . . . . . . . . . . . . . . . . . 65 ■CHAPTER 5 Game Design:Interactive Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . 85 PART 3 ■ ■ ■ Level Design ■CHAPTER 6 Inheriting Events:Mother of Pearl . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 ■CHAPTER 7 Maze Games:More Cute Things in Peril . . . . . . . . . . . . . . . . . . . . . . . 127 ■CHAPTER 8 Game Design:Levels and Features . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 iv 6153FM.qxd 3/25/06 3:50 PM Page v PART 4 ■ ■ ■ Multiplayer Games ■CHAPTER 9 Cooperative Games:Flying Planes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 ■CHAPTER 10 Competitive Games:Playing Fair with Tanks . . . . . . . . . . . . . . . . . . 191 ■CHAPTER 11 Game Design:Balance in Multiplayer Games . . . . . . . . . . . . . . . . . . 211 PART 5 ■ ■ ■ Enemies and Intelligence ■CHAPTER 12 GML:Become a Programmer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 ■CHAPTER 13 Clever Computers:Playing Tic-Tac-Toe . . . . . . . . . . . . . . . . . . . . . . . . 245 ■CHAPTER 14 Intelligent Behavior:Animating the Dead . . . . . . . . . . . . . . . . . . . . . . 259 ■CHAPTER 15 Final Words . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291 ■BIBLIOGRAPHY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297 ■INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299 v 6153FM.qxd 3/25/06 3:50 PM Page vi 6153FM.qxd 3/25/06 3:50 PM Page vii Contents Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiv About the Authors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvi About the Technical Reviewer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvii About the Illustrator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xviii Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xx PART 1 ■ ■ ■ Getting Started ■CHAPTER 1 Welcome to Game Maker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Installing the Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Registration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 The Global User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Running a Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 How to Get More Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 What’s Next? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 ■CHAPTER 2 Your First Game: Devilishly Easy . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Designing the Game:Evil Clutches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Sprites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 The Boss Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Events and Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 The Dragon Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Rooms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Save and Run . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Instances and Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Demons,Baby Dragons,and Fireballs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 The Fireball Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 The Demon Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 Summoning Demons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 The Baby Dragon Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 vii 6153FM.qxd 3/25/06 3:50 PM Page viii viii ■CONTENTS Backgrounds and Sounds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 A Background Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 Background Music . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 Sound Effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 Congratulations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 PART 2 ■ ■ ■ Action Games ■CHAPTER 3 More Actions: A Galaxy of Possibilities . . . . . . . . . . . . . . . . . . . 41 Designing the Game:Galactic Mail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 Sprites and Sounds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 Moons and Asteroids . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 Flying Around . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 Winning and Losing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 An Explosion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 Scores . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 Levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 Finishing Touches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 A Title Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 Winning the Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 Adding Some Visual Variety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 Help Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62 Congratulations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 ■CHAPTER 4 Target the Player: It’s Fun Being Squished . . . . . . . . . . . . . . . 65 Designing the Game:Lazarus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 An Animated Character . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 A Test Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 Falling Boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 Finishing Touches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 No Way Out! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 Adding a Goal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 Starting a Level . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 Sounds,Backgrounds,and Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 Levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 Congratulations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 6153FM.qxd 3/25/06 3:50 PM Page ix ■CONTENTS ix ■CHAPTER 5 Game Design: Interactive Challenges . . . . . . . . . . . . . . . . . . . . . 85 What Makes a Good Game? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 Game Mechanics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 Interactive Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 Game Genres . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 Difficulty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 Goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 Rewards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 Subgoals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 Interactivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 Choices and Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 Control Overload! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 Unfair Punishment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 Audio Feedback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 PART 3 ■ ■ ■ Level Design ■CHAPTER 6 Inheriting Events: Mother of Pearl . . . . . . . . . . . . . . . . . . . . . . . 101 Designing the Game:Super Rainbow Reef . . . . . . . . . . . . . . . . . . . . . . . . 101 A Game Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 The Front-End . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 The Completion Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 Bouncing Starfish . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 Biglegs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 Parent Power . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 Lives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 Normal Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 Solid Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 Special Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 Polishing the Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 Sound Effects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 Saving Games and Quitting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 A Slower Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 Creating the Levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 Congratulations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
Description: