ebook img

Holistic Game Development with Unity. An All-in-One Guide to Implementing Game Mechanics, Art, Design and Programming PDF

467 Pages·2017·89.2 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Holistic Game Development with Unity. An All-in-One Guide to Implementing Game Mechanics, Art, Design and Programming

Holistic Game Development with Unity An All-in-One Guide to Implementing Game  Mechanics, Art, Design and Programming Second Edition Penny de Byl is a professor of interactive multimedia and games at Bond University in Australia. An award-winning teacher, Penny has researched and taught computer science, computer graphics, and game development at top- ranked universities for over 20 years. Author of two books on artificial intelligence programming for computer games, and winner of the 2011 Unity Technologies’ Unity Mobile Generation Education Giveaway, Penny also hosts the popular Unity development YouTube channel, Holistic3d. Holistic Game Development with Unity An All-in-One Guide to I mplementing Game  Mechanics, Art, Design and P rogramming Second Edition Penny de Byl CRC Press Taylor & Francis Group CRC Press 6000 Broken Sound Parkway NW, Suite 300 Taylor & Francis Group Boca Raton, FL 33487-2742 6000 Broken Sound Parkway NW, Suite 300 Boca Raton, FL 33487-2742 © 2017 by Taylor & Francis Group, LLC CRC Press is an imprint of Taylor & Francis Group, an Informa business © 2017 by Taylor & Francis Group, LLC CRC Press is an imprint of Taylor & Francis Group, an Informa business No claim to original U.S. Government works No claim to original U.S. Government works Printed on acid-free paper Printed on acid-free paper International Standard Book Number-13: 978-1-138-88879-1 (Hardback) International Standard Book Number-13: 978-1-138-88878-4 (Paperback) International Standard Book Number-13: 978-1-138-88879-1 (Hardback) This book contains information obtained from authentic and highly regarded sources. Reasonable efforts have been made to publish reli- This book contains information obtained from authentic and highly regarded sources. Reasonable efforts have been made to publish reli- able data and information, but the author and publisher cannot assume responsibility for the validity of all materials or the consequences able data and information, but the author and publisher cannot assume responsibility for the validity of all materials or the consequences of their use. The authors and publishers have attempted to trace the copyright holders of all material reproduced in this publication and of their use. The authors and publishers have attempted to trace the copyright holders of all material reproduced in this publication and apologize to copyright holders if permission to publish in this form has not been obtained. If any copyright material has not been acknowl- apologize to copyright holders if permission to publish in this form has not been obtained. If any copyright material has not been acknowl- edged please write and let us know so we may rectify in any future reprint. edged please write and let us know so we may rectify in any future reprint. Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced, transmitted, or utilized in any form by Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced, transmitted, or utilized in any form by any electronic, mechanical, or other means, now known or hereafter invented, including photocopying, microfilming, and recording, or in any electronic, mechanical, or other means, now known or hereafter invented, including photocopying, microfilming, and recording, or in any information storage or retrieval system, without written permission from the publishers. any information storage or retrieval system, without written permission from the publishers. For permission to photocopy or use material electronically from this work, please access www.copyright.com (http://www.copyright. For permission to photocopy or use material electronically from this work, please access www.copyright.com (http://www.copyright. com/) or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA 01923, 978-750-8400. CCC is a not- for- com/) or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA 01923, 978-750-8400. CCC is a not- for- profit organization that provides licenses and registration for a variety of users. For organizations that have been granted a photocopy profit organization that provides licenses and registration for a variety of users. For organizations that have been granted a photocopy license by the CCC, a separate system of payment has been arranged. license by the CCC, a separate system of payment has been arranged. Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are used only for identification and Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are used only for identification and explanation without intent to infringe. explanation without intent to infringe. Library of Congress Cataloging‑in‑Publication Data Library of Congress Cataloging‑in‑Publication Data Names: De Byl, Penny, author. Names: De Byl, Penny, author. Title: Holistic game development with unity an all-in-one guide to Title: Holistic game development with unity an all-in-one guide to implementing game mechanics, art, design and programming / Penny de Byl. implementing game mechanics, art, design, and programming / Penny de Byl. Description: 2nd edition. | Boca Raton, FL : Taylor & Francis, 2017. | Description: 2nd edition. | Boca Raton, FL : Taylor & Francis, 2017. | Includes index. Includes index. Identifiers: LCCN 2016043693| ISBN 9781138888791 (hardback : alk. paper) | Identifiers: LCCN 2016043693| ISBN 9781138888791 (hardback : alk. paper) | ISBN 9781138888784 (pbk. : alk. paper) ISBN 9781138888784 (pbk. : alk. paper) Subjects: LCSH: Computer games--Programming. | Unity (Electronic resource) | Subjects: LCSH: Computer games--Programming. | Unity (Electronic resource) | Video games--Design. Video games--Design. Classification: LCC QA76.76.C672 B335 2017 | DDC 794.8/1526--dc23 Classification: LCC QA76.76.C672 B335 2017 | DDC 794.8/1526--dc23 LC record available at https://lccn.loc.gov/2016043693 LC record available at https://lccn.loc.gov/2016043693 Visit the Taylor & Francis Web site at Visit the Taylor & Francis Web site at http://www.taylorandfrancis.com http://www.taylorandfrancis.com and the CRC Press Web site at and the CRC Press Web site at http://www.crcpress.com http://www.crcpress.com Contents Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv Chapter 1: The Art of Programming Mechanics . . . . . . . . . . . . . . . . . . . . . . . . 1 1.1 Introduction ............................................ 1 1.2 Programming on the Right Side of the Brain .............. 3 1.3 Creating Art from the Left Side of the Brain .............. 8 1.3.1 Point ......................................... 9 1.3.2 Line .......................................... 9 1.3.3 Shape..........................................10 1.3.4 Direction.......................................11 1.3.5 Size ............................................12 1.3.6 Texture.........................................13 1.3.7 Color........................................... 14 1.4 How Game Engines Work ........................... 17 1.4.1 A Generic Game Engine ........................17 1.4.2 The Main Loop .................................18 1.5 A Scripting Primer .......................................26 1.5.1 Logic...........................................27 1.5.2 Comments .....................................31 1.5.3 Functions ......................................32 1.5.4 Variables .......................................33 1.5.4.1 JavaScript Variables...................36 1.5.5 Operators ......................................42 1.5.5.1 Arithmetic Operators .................42 1.5.5.2 Relational Operators..................42 1.5.6 Conditional Statements ........................45 1.5.7 Arrays..........................................53 1.5.8 Objects.........................................56 1.6 A Game Art Asset Primer ............................... 60 1.6.1 The Power of Two Rule .........................61 1.6.2 Using Other People’s Art Assets................ 66 1.7 Summary................................................ 69 Chapter 2 : Real-World Mechanics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 2.1 Introduction............................................. 71 2.2 Principles of Vectors..................................... 72 2.3 Defining 2D and 3D Space...............................77 2.3.1 Cameras ....................................... 78 2.3.2 Local and World Coordinate Systems........... 85 v 2.3.3 Translation, Rotation, and Scaling................ 85 2.3.4 Polygons and Normals.......................... 90 2.4 Two-Dimensional Games in a 3D Game Engine .......... 93 2.4.1 Quaternions? ................................... 98 2.4.2 Quaternions to the Rescue . . . . . . . . . . . . . . . . . . . . . . 99 2.5 The Laws of Physics ................................... 109 2.5.1 The Law of Gravity............................... 111 2.5.2 The First Law of Motion......................... 113 2.5.3 The Second Law of Motion ...................... 117 2.5.4 The Third Law of Motion........................ 118 2.6 Physics and the Principles of Animation ................ 121 2.6.1 Squash and Stretch ............................ 122 2.6.2 Anticipation ................................... 128 2.6.3 Follow-Through ............................... 129 2.6.4 Secondary Motion.............................. 131 2.7 2D and 3D Tricks for Optimizing Game Space .......... 134 2.7.1 Reducing Polygons ............................ 135 2.7.1.1 Use Only What You Need ............. 135 2.7.1.2 Backface Culling...................... 135 2.7.1.3 Level of Detail ......................... 137 2.7.2 Camera Viewing Volume....................... 139 2.7.3 Fog............................................. 141 2.7.4 Textures ........................................ 141 2.7.4.1 Moving Textures ..................... 142 2.7.4.2 Blob Shadows........................ 143 2.7.5 Billboards ..................................... 144 2.8 Summary ............................................. 146 Chapter 3: Animation Mechanics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 3.1 Introduction............................................147 3.2 Sprites ................................................ 148 3.3 Texture Atlas .......................................... 149 3.4 Animated Sprites...................................... 153 3.5 Baked 3D Animations...................................159 3.6 Biomechanics ......................................... 168 3.7 Animation Management............................... 172 3.7.1 Single 2D Sprite Actions........................ 172 3.7.2 Single-Filed 3D Animations .................... 177 3.8 Secondary Animation ................................. 179 3.9 Summary ............................................. 181 Chapter 4: Game Rules and Mechanics . . . . . . . . . . . . . . . . . . . . . . . . . . . .183 4.1 Introduction .......................................... 183 4.2 Game Mechanics...................................... 184 vi 4.3 Primary Mechanics...................................186 4.3.1 Searching ..................................186 4.3.2 Matching...................................187 4.3.3 Sorting .....................................187 4.3.4 Chancing...................................188 4.3.5 Mixing......................................189 4.3.6 Timing .....................................189 4.3.7 Progressing.................................190 4.3.8 Capturing ..................................190 4.3.9 Conquering.................................190 4.3.10 Avoidance..................................191 4.3.11 Collecting ..................................191 4.4 Developing with Some Simple Game Mechanics . . . . . . 192 4.4.1 Matching and Sorting.......................192 4.4.2 Shooting, Hitting, Bouncing, and Stacking . . . 208 4.4.3 Racing......................................213 4.4.4 Avoidance and Collecting...................217 4.4.5 Searching ..................................223 4.5 Rewards and Penalties ...............................226 4.6 Summary............................................229 Reference...................................................230 Chapter 5: Character Mechanics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .231 5.1 Introduction......................................... 231 5.2 Line of Sight ......................................... 233 5.3 Graph Theory........................................238 5.4 Waypoints........................................... 239 5.4.1 Searching through Waypoints............... 241 5.5 Finite State Machines ................................ 251 5.6 Flocking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265 5.7 Decision Trees ....................................... 271 5.8 Fuzzy Logic.......................................... 276 5.9 Genetic Algorithms ..................................283 5.10 Cellular Automata....................................288 5.11 Summary............................................289 Chapter 6: Player Mechanics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .291 6.1 Introduction......................................... 291 6.2 Game Structure...................................... 292 6.3 Principles of Game Interface Design..................300 6.3.1 User Profiling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300 6.3.2 Metaphor .................................. 301 6.3.3 Feature Exposure........................... 302 6.3.4 Coherence..................................303 6.3.5 State Visualization ..........................304 vii 6.3.6 Shortcuts.....................................304 6.3.7 Layout........................................305 6.3.8 Focus.........................................306 6.3.9 Help..........................................306 6.4 Inventories............................................308 6.5 Teleportation ......................................... 323 6.5.1 Implicit Teleports ............................. 324 6.5.2 Explicit Teleports ............................. 326 6.6 Summary ............................................. 328 Chapter 7: Environmental Mechanics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .329 7.1 Introduction .......................................... 329 7.2 Map Design Fundamentals ............................ 330 7.2.1 Provide a Focal Point.......................... 330 7.2.2 Guide and Restrict the Player’s Movement..... 330 7.2.3 Scaling ....................................... 332 7.2.4 Detail......................................... 332 7.2.5 Map Layout................................... 333 7.2.5.1 Open ............................... 335 7.2.5.2 Linear............................... 335 7.2.5.3 Branching .......................... 336 7.2.5.4 Spoke and Hub ..................... 336 7.2.6 Other Considerations ......................... 337 7.2.6.1 Player Starting Position.............. 337 7.2.6.2 Flow................................ 337 7.2.6.3 Trapping............................ 337 7.2.6.4 Use the 3rd Dimension............... 337 7.2.6.5 Vantage Points...................... 338 7.3 Terrain ................................................ 338 7.3.1 Drawing a Terrain............................. 339 7.3.2 Procedural Terrain ............................344 7.3.3 Procedural Cities..............................349 7.3.4 Infinite Terrain ................................ 355 7.4 Camera Tricks ......................................... 357 7.4.1 Depth of Field ................................ 358 7.4.2 Blur........................................... 358 7.4.3 Grayscale..................................... 359 7.4.4 Motion Blur................................... 359 7.4.5 Sepia Tone.................................... 359 7.4.6 Twirl..........................................360 7.4.7 Bloom........................................360 7.4.8 Flares.........................................360 7.4.9 Color Correction..............................360 7.4.10 Edge Detection............................... 361 7.4.11 Crease........................................ 361 7.4.12 Fish Eye....................................... 361 viii 7.4.13 Sun Shafts.................................... 361 7.4.14 Vignette...................................... 362 7.4.15 Screen Space Ambient Occlusion ............. 362 7.5 Skies..................................................363 7.5.1 Skyboxes.....................................363 7.5.2 Sky Domes ...................................365 7.5.3 Clouds .......................................368 7.6 Weather............................................... 370 7.6.1 Wind . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370 7.6.2 Precipitation ..................................374 7.7 Particles................................................374 7.8 Summary .............................................382 Reference...................................................382 Chapter 8: Mechanics for External Forces . . . . . . . . . . . . . . . . . . . . . . . . . .383 8.1 Introduction ..........................................383 8.2 Mobile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 8.2.1 Design Considerations........................384 8.2.1.1 Text ................................385 8.2.1.2 Icons and User Interface Elements...386 8.2.1.3 Gameplay...........................386 8.2.2 Haptics....................................... 391 8.2.3 Accelerometer................................ 392 8.2.4 Orientation................................... 393 8.2.5 Web Services.................................396 8.2.6 GPS .......................................... 401 8.3 Gestures and Motion................................. 406 8.4 3D Viewing.............................................410 8.4.1 Side-By-Side ................................410 8.4.2 Anaglyphs ..................................413 8.4.3 Head-Mounted Displays .....................414 8.5 Augmented Reality.....................................416 8.6 The Social Mechanic................................... 423 8.6.1 External Application Security Matters ......... 424 8.6.2 Twitter ....................................... 427 8.6.3 Facebook..................................... 432 8.7 Platform Deployment: The App Store, Android Market, and Consoles.................................. 439 8.7.1 Publishing for the App Store and Android Market ....................................... 439 8.7.2 Console Publishing ...........................440 8.7.3 Download Direct to Player ....................440 8.8 Summary ............................................. 441 8.9 A Final Word.......................................... 441 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .443 ix

Description:
Master game design and digital art principles simultaneously with this all-in-one guide to creating games in the cutting-edge game engine Unity 5. Bursting with images and tutorials, Penny de Byl’s Holistic Game Development with Unity will help the reader gain the multidisciplinary skills needed t
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.