FIRST-PERSON SHOOTER in Unity
Total Page:16
File Type:pdf, Size:1020Kb
presents Build Your Own FIRST-PERSON SHOOTER in Unity Learn Unity • Create enemies • Design levels • Make Zombie Panic 01_WF_Unity FPS Guide_Cover V3_LA_RL_LA_PK.indd 1 09/01/2020 13:42 Find hundreds more books and magazines in the TARTED S STORE wfmag.cc/store Robots, musical instruments, smart displays and more Create AMAZING projects with this programmable controller MAGAZINE FROM THE MAKERS OF Editorial Editor Ryan Lambie Email [email protected] Features Editor Ian Dransfield Email [email protected] Book Production Editor Phil King Sub-Editors You too can David Higgs, Vel Ilic, Nicola King Design make a shooter criticalmedia.co.uk Head of Design an one person make a first-person shooter? The size, scope, Lee Allen and sheer detail of a typical triple-A game – the Call of Dutys, Designer Battlefields and Halos of this world – might leave you thinking Harriet Knight C that the answer’s a resounding no. But beneath all the polish and modes, the basic elements that underpin the shooter Contributors genre haven’t changed all that much since Doom and Quake defined it way Stuart Fraser, Patrick Gordon, Steve Lee, back in the 1990s. Andrew Palmer, Ryan Shah, Mark Vanstone In fact, with a bit of help and guidance, even a relative newcomer can put together a simple shooter with most of the trappings you’d expect: a level Publishing to navigate around, keys that unlock doors and, most importantly, hordes of Publishing Director enemies to blast. Russell Barnes That’s where this guide comes in “Follow our guide Email [email protected] – it’ll take you step by step through Director of Communications the process of making your very through to the end Liz Upton own first-person shooter. From and you’ll have a CEO downloading the free software shooter that you can Eben Upton you’ll need, to setting up a player character and waves of zombies, customise further” Advertising it’ll show you how to get a basic Commercial Manager shooting game up and running. Once that’s in place, you’ll be taken through Charlie Milligan the process of building level assets and 3D models, and shown how to add Email [email protected] lighting, sound, and other effects. Tel +44 (0)7725 368887 Follow our guide through to the end and you’ll have a shooter that you can customise further with optional mechanics and even a boss fight. So Distribution if you’ve always wanted to make your own first-person action game, or Seymour Distribution Ltd simply wanted an approachable means of getting started in Unity, this is 2 East Poultry Ave, London EC1A 9PT the book for you. Tel +44 (0)207 429 4000 Turn the page, and let’s get started. Subscriptions Ryan Lambie Unit 6, The Enterprise Centre, Kelvin Lane, Manor Royal, Crawley, West Sussex, RH10 9PE Editor To subscribe Call 01293 312192 or visit wfmag.cc/subscribe Subscription queries [email protected] This magazine is printed on paper sourced from sustainable forests and the printer operates an environmental management system which has been assessed as conforming to ISO 14001. Wireframe magazine is published by Raspberry Pi (Trading) Ltd, Maurice Wilkes Building, St. John’s Innovation Park, Cowley Road, Cambridge, CB4 0DS. The publisher, editor, and contributors accept no responsibility in respect of any omissions or errors relating to goods, products or services referred to or advertised in the magazine. Except where otherwise noted, content in this magazine is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0). ISSN: 2631-6722 (print), 2631-6730 (online). 3 Build Your Own FIRST-PERSON SHOOTER in Unity 46 Levels, models, and more 64 34. Creating a level Construct an arena for our players: Castle Brains 40. Add doors and switches Building the Create elements that control your basic engine level’s flow 46. Expand your gameplay 08. Upgrade your shooter with medikits Contents Taking your first steps in Unity and limited ammo Set up Unity and create a moving, firing character 52. Create a character Construct, texture, and animate a 16. Add enemies and walking zombie in Blender improvements Advanced your shooter, 64. Add lighting and effects adding enemies and basic AI Use lighting and visual effects to create atmosphere 24. Expand your first- person shooter 70. Add sound and audio Add spawners to create Heighten tension and excitement 08 waves of angry zombies with sound effects 4 Unity FPS Guide WHERE TO FIND ASSETS 114 You’ll find all the files, models, and other assets you need for this book at wfmag.cc/fps-guide 134 34 Additional mechanics 78. Create a mission marker Make a rotating arrow to guide 124 players to a goal 84. Adding a minimap Improve the user interface with enemy and goal positions Level design and inspiration 88. Create a gun turret Help the player fend off zombies with a deployable weapon 124. Getting into level design A masterclass from Bulletstorm’s 94. Create a blink ability Steve Lee 52 Teleport around levels like Tracer from Overwatch 126. Tips for improving your level designs 100. Develop wall running Six simple ways to make your Let your players defy gravity stages sparkle and dodge enemies 128. The theory 106. Saving and loading behind hitboxes How to add a handy Why hitboxes matter, and how to quality-of-life feature implement them 114. Develop a boss battle 134. Jon Chey on design End your level with a formidable Design principles from the director boss encounter of System Shock 2 88 Unity FPS Guide 5 Build Your Own FIRST-PERSON SHOOTER in Unity Building the basic engine From downloading the Unity engine to creating a player character, here’s everything you need to get your shooter started 08. Taking your first steps in Unity Set up Unity and create a moving, firing character 16. Add enemies and make improvements Advanced your shooter, adding enemies with basic AI 24. Expanding your first-person shooter Learn how to add spawners to create waves of angry zombies 6 Follow the tutorials in this section and you’ll have the basics for your shooter down, including simple enemies that attack the player. 7 Building the basic engine Taking your first steps in Unity Taking your first steps in Unity From setting up Unity to creating a moving, firing character, here’s how to lay the foundations for your shooter AUTHOR STUART FRASER Stuart is a former designer and developer of high-profile games such as RollerCoaster Tycoon 3, and has also worked as a lecturer of games development. ools such as Unity and Unreal easy to get hold of any supported version of Engine have opened the way Unity by using a tool called Unity Hub. This is for just about anyone to make essentially a program launcher and still in beta, T high-quality video games. In this but it’s simple, reliable, and will give you fast guide, we’re going to look at Unity, access to what you need. First, open up a web and how we can develop a basic first-person browser and navigate to the downloads page: shooter. The great thing about the Unity engine wfmag.cc/get-unity. Then you need to select is that it works well on multiple platforms, and Download Unity Hub, run the UnityHubSetup to the documentation is really clear, with a suite of continue, and select a suitable install location. easy-to-follow tutorials available for beginners and also experts. INSTALLING UNITY USING THE HUB GETTING HOLD OF UNITY Once you open the Hub, you’ll be presented First, then, we need to get our hands on with some choices in the launcher. They’re Under the official releases the Unity software itself and get it installed pretty self-explanatory, with the headings window, we can see the various available versions on your PC or Mac. The maker has made it Projects, Learn, and Installs. I’ll touch on Projects of Unity. later, but this is where your games will live. As mentioned earlier, the Learn section has some great resources. Finally, we’ll choose the heading Installs, and on the top right-hand side, click on Add. Next, choose the 2019.2 version of Unity and select Next. Once it’s complete, you’ll be able to launch Unity and your projects from the Hub. TAKE CONTROL OF THE EDITOR Now you have the Unity Hub, it’s a simple process of selecting New from the top-right set of icons, and then giving your project a name and set a location for it to live on your drive; by default, the version of Unity we downloaded is selected. We’ll leave the Templates options 8 Unity FPS Guide Building the basic engine Taking your first steps in Unity The default view from the Unity editor. We can easily customise the layout to suit your needs as a developer. set to 3D, and then complete the process by selecting Create. When you start up into the Unity Editor, you’ll see a bunch of windows – this This is my setup for our can be daunting to someone who hasn’t used representation of the a games editor before. Again, Unity has some mechanics in a programming language that is character. I have moved up the camera, and you can see brilliant starter guides at wfmag.cc/unity-tut, easy to understand. So let’s get going and make the positional difference for but I’ll take you through the process anyway. our first-person character.