Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Building an FPS Game with Unity
Building an FPS Game with Unity

Building an FPS Game with Unity: Create a high-quality first person shooter game using the Unity game engine and the popular UFPS and Probuilder frameworks

Mex$803.99 Mex$561.99
Book Oct 2015 326 pages 1st Edition
eBook
Mex$803.99 Mex$561.99
Print
Mex$1,004.99
Subscription
Free Trial
eBook
Mex$803.99 Mex$561.99
Print
Mex$1,004.99
Subscription
Free Trial

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Buy Now
Table of content icon View table of contents Preview book icon Preview Book

Building an FPS Game with Unity

Chapter 1. Getting Started on an FPS

Welcome to Building an FPS Game with Unity! This chapter is dedicated to offer a brief overview, from a beginner's point of view, of the exciting world of Unity development for the creation of a First Person Shooter (FPS) title, leveraging the powerful Ultimate First Person Shooter (UFPS) framework by VisionPunk and Prototype/ProBuilder 2.0 by ProCore3D. But, before we get started, we first need to get all of the resources we'll need and set up our project for success.

Over the course of this book, we will be creating a 3D FPS game similar to the popular games in the market such as Call of Duty: Black Ops III and Halo 5: Guardians.

We will learn how we can create custom weapons of our own as well as how we can create interior and exterior environments. After creating our environments, we will populate them with different combat encounters for players to fight as well as include intractable objects such as exploding barrels. We'll then customize our user interface using Unity's new GUI system before we package our game and create an installer to get the game out into the world!

This project will be split into a number of tasks. It will be a simple step-by-step process from the beginning to the end. Here is the outline of our tasks:

  • Project creation

  • Getting started with Unity's Asset Store

  • Installing UFPS

  • Installing Prototype

  • File organization

  • Customizing Unity's layout

Prerequisites


Before we start, we will need to get the latest Unity version. You can always download it from http://unity3d.com/unity/download/. At the time of writing this book, the page looks like this:

Once you get to this page, click on the CHOOSE YOUR UNITY + DOWNLOAD button (this page onward, I will be using the PERSONAL EDITION version). Then, click on the DOWNLOAD INSTALLER option.

The download assistant should be installed from your default downloads directory. Once it is installed, double-click on the file to open it.

Once there, go through the installation using the default properties. At the time of writing, we are using Unity 5.0.0f4, but most things should work with minimal changes but be sure to check out the book's website to check for any errata.

Since it needs to download Unity, this process may take some time.

Project creation


At this point, I assume that you have freshly installed Unity and have started it up. Follow these steps to create a new project in Unity:

  1. With Unity started, go to New Project. Enter a Project Name value such as FPS Game - Chapter 1 as that's what we are making and the chapter we're making it for, or whatever you want to call your project. Select Location of your choice somewhere on your hard drive and ensure that you have your game set to 3D. Once completed, select Create project. At this point, we do not need to import any packages as we'll be doing it manually.

  2. Here on, if you see the Welcome to Unity pop up, feel free to close it as we won't be using it. At this point, you will be brought to the general Unity layout, which should look as follows:

Note

I'm assuming you have some familiarity with Unity before you read this book. If you want more information on the interface, please visit http://docs.unity3d.com/Documentation/Manual/LearningtheInterface.html.

Getting started with the Asset Store


Since Unity 3, the Asset Store has been similar to Apple's/Android's app stores, except, instead of apps, you can buy prebuilt assets that can be imported directly into your project. We will be using this in our project; but, before we do so, we will need to have an account, that can be created using the following steps:

  1. To open the Asset Store via Unity, we can go to Window | Asset Store from the top toolbar.

    Note

    You may also open the panel by pressing Ctrl + 9 (command + 9 on Mac). If nothing happens, make sure Unity is focused on window by clicking on the program and trying again. If you prefer working outside Unity, you may also go to the Asset Store website at https://www.assetstore.unity3d.com/. However, you'll need to download assets from Unity via the Download Manager, which you can learn about from the link given later in this chapter.

  2. Next, go to the top-right corner of the panel and click on the Create Account button. Fill out your information and click on Create account at the bottom of the screen.

  3. You should receive an activation e-mail shortly after you submit the form. Open it and click on the activation link provided to verify your account.

  4. Once this is done, go to Log In from the top-right corner of the panel and enter the information you put in when you created the account. If all goes well, the top-right corner of the window will change to reflect that you are logged in.

With this, we can download and purchase assets from the Asset Store!

Note

Do not be concerned if you do not see 11 by your account, it just shows that I have a Unity Pro account.

For more information on the Asset Store and how to navigate using it, visit http://docs.unity3d.com/Manual/AccessNavigation.html.

Installing UFPS

Creating a game completely from scratch takes a considerable amount of time. Creating a first-person shooter relies on having a lot of knowledge as well as problem solving with things such as physics, mathematics, graphics, and programming. Now, books of each of these subjects could have been written based on it; but we are assuming that you want results in the fastest amount of time possible.

Rather than taking the tens of thousands of hours it would take to create it from scratch, we will leverage the very popular Unity add-on UFPS (Ultimate FPS) from VisionPunk. It will give us a solid foundation to create our own project with hundreds of parameters, which we can customize to create a project exactly the way we want it to be.

It's important to note that UFPS does cost money. But considering that a solid game programmer generally makes $50 or more an hour, the amount of time saved really makes it a worthwhile investment.

Now that we are logged into the Asset Store, let's purchase and install UFPS:

  1. Now, from the search bar directly below the login information, search for UFPS. You should see an icon that looks similar to the following:

  2. Click on the first option, which will bring you to the following page:

  3. Now, click on the Buy button and purchase the asset. Once it is purchased, the screen will change the Buy button to a Download button. You can click on it to download the asset and bring it into your project.

  4. Once it is downloaded, an Importing package window will open, giving you the option to choose which parts of the package you wish to import. We want everything, so just click on the Import button.

    Note

    If, for some reason, you get an error (the bottom bar, or Console, in the Unity interface) while importing that says something like 'Fatal error! getManagerFromContext:…". This is a bug in Unity due to the large file size UFPS has. Just Quit and continue with the import once again, when you restart Unity.

  5. Once the project is imported, close the Asset Store window and go back into the Unity Editor. From there, go down to the Project tab in the bottom-left corner of the screen and double-click on the UFPS folder. Go to Base\Content\Levels\SkyCity and double-click on the SkyCity file to open an example level. Then, press the Play button at the top-center of the project to start the project!

With this, we know that UFPS is installed correctly!

Installing Prototype


In general, creating levels in Unity is a painful experience. You have to type in the values for each piece that you want to add or you have to create everything inside a modeling program and import it, which will require you to have 3D modeling skills.

Other game engines have tools like Binary Space Partitioning (BSP) or Constructive Solid Geometry (CSG), which allow you to build geometry from scratch and apply materials to it to create areas for play. Filling in the gap that Unity has, ProCore3D has created a toolkit that allows for in-editor construction.

We will later on use ProBuilder to polish up our final product; but, in the meantime, we will use Prototype, their free version to build the basic structure and flow of our levels without wasting time, thus making things visually appealing until we polish it. Perform the following steps to install Prototype:

  1. Open the Asset Store once again by going to the toolbar, searching for Prototype, and looking for the following icon:

  2. Click on the first option in the top-left corner and you should be brought to a page like the following one:

    Tip

    After the writing of this book, Prototype will in the near future be replaced by ProBuilder Basic which is still 100% free but has additional features. I've talked with the creators about this, and they've confirmed with me after reading the book that everything discussed here should still work with the new version. For more information on this, check out http://www.protoolsforunity3d.com/probuilder/.

  3. Click on the Download button and wait for it to finish. Then, import the entire package by clicking on Import.

  4. We will now test it out to see whether everything is imported correctly. Create a new scene inside Unity by going to File | New Scene. Once there, press Ctrl + K to create a new cube using Prototype.

With this, we know that it was installed correctly! It may look pretty simple now, but we will be diving even more into using these tools later on.

Note

For more information on Prototype, check out http://www.protoolsforunity3d.com/prototype/.

File organization


Keeping your Unity project organized is incredibly important. As your project moves from a small prototype to a full game, more and more files will be introduced to your project. If you don't start organizing it from the beginning and keep planning to tidy it up later on, things may get quite out of hand as the deadlines keep coming.

Setting up a project structure at the start and sticking to it will save you countless minutes in the long run. It will only take a few seconds and is what we'll be doing now.

  1. Go to the Assets folder from the Project tab in the bottom-left corner of the screen. Once there, click on the Create drop-down menu. Click on Folder and you'll notice that a new folder has been created inside your Assets folder.

    Tip

    Similarly, you can right-click on the negative space within the Project window to create a folder.

  2. After the folder is created, you can type in the name of your folder. Once it is named, press Enter. Let's now create a folder called MyGame. We also need to create folders for the following directories inside the MyGame folder:

    • Prefabs

    • Scenes

    • Scripts

Note

If you happen to create a folder inside another folder, you can simply drag and drop it from the left toolbar. If you need to rename a folder, just simply click on it once and wait, you'll be able to edit it again. Alternatively, on the keyboard you can press F2.

Your project should now look like this:

Customizing Unity's layout


While working with Unity in this book, I will mostly be using its default layout. If, for some reason, your layout does not look like the earlier screenshot, you can reset it by going to the top-right corner of the window and selecting Layout | Default.

You can customize the layout by clicking and dragging any tab to wherever you want it to be. There are also additional options such as making the Project tab use a one-column layout by right-clicking on the tab and selecting One Column Layout. Sometimes, I like to split the center with the Scene tab on one side and the Game tab on the other, so I can see how things change from a different angle. For those of you with multiple monitors, you may use a monitor just for the game. It's all up to your preferences, but keep your changes in mind, as I'll assume that you'll be using Default.

Note

For more information on customizing your Unity layout, check out http://docs.unity3d.com/Manual/CustomizingYourWorkspace.html.

Summary


Hopefully, you've enjoyed taking the first few steps toward becoming an FPS game developer with Unity! In this chapter, we learned how to create a project inside Unity 5. We then learned how to create an account and navigate the Unity Asset Store. After this, we learned about UFPS and Prototype and installed them. Finally, we touched upon file organization and customized Unity's layout.

In the next chapter, we will delve deeper into using Unity Editor and UFPS by creating our own custom weapons!

Left arrow icon Right arrow icon

Key benefits

What you will learn

Use UFPS to build custom weapons with custom meshes and behaviors Explore level design as you prototype levels, making use of Prototype to build levels out quickly Build environments that are realistic as possible while keeping peak performance and repetitiveness down Review tips and tricks on how to create environments using both terrain for outdoor areas and a modular workflow for interiors Develop a number of different encounters that your players can fight against, from a simple turret enemy to complex AI characters from Shooter AI Discover how to create unique objects such as exploding barrels and objects you can interact with Create a custom GUI to help your game stand out from the crowd Package your game for release, create an installer, and get your game out into the world

Product Details

Country selected

Publication date : Oct 30, 2015
Length 326 pages
Edition : 1st Edition
Language : English
ISBN-13 : 9781782174806
Vendor :
Unity Technologies
Category :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Buy Now

Product Details


Publication date : Oct 30, 2015
Length 326 pages
Edition : 1st Edition
Language : English
ISBN-13 : 9781782174806
Vendor :
Unity Technologies
Category :

Table of Contents

18 Chapters
Building an FPS Game with Unity Chevron down icon Chevron up icon
Credits Chevron down icon Chevron up icon
Foreword Chevron down icon Chevron up icon
About the Author Chevron down icon Chevron up icon
Acknowledgment Chevron down icon Chevron up icon
About the Reviewers Chevron down icon Chevron up icon
www.PacktPub.com Chevron down icon Chevron up icon
Preface Chevron down icon Chevron up icon
1. Getting Started on an FPS Chevron down icon Chevron up icon
2. Building Custom Weapons Chevron down icon Chevron up icon
3. Prototyping Levels with Prototype Chevron down icon Chevron up icon
4. Creating Exterior Environments Chevron down icon Chevron up icon
5. Building Encounters Chevron down icon Chevron up icon
6. Breathing Life into Levels Chevron down icon Chevron up icon
7. Adding Polish with ProBuilder Chevron down icon Chevron up icon
8. Creating a Custom GUI Chevron down icon Chevron up icon
9. Finalizing Our Project Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Empty star icon Empty star icon Empty star icon Empty star icon Empty star icon 0
(0 Ratings)
5 star 0%
4 star 0%
3 star 0%
2 star 0%
1 star 0%
Top Reviews
No reviews found
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.