Search icon
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

$15.99 per month
Book Oct 2015 326 pages 1st Edition
eBook
$39.99 $27.98
Print
$48.99
Subscription
$15.99 Monthly
eBook
$39.99 $27.98
Print
$48.99
Subscription
$15.99 Monthly

What do you get with a Packt Subscription?

Free for first 7 days. $15.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details


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

Estimated delivery fee Deliver to United States

Premium 6 - 9 business days

$21.95
(Includes tracking information)

Economy 10 - 13 business days

$6.95
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

What do you get with a Packt Subscription?

Free for first 7 days. $15.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details


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

Estimated delivery fee Deliver to United States

Premium 6 - 9 business days

$21.95
(Includes tracking information)

Economy 10 - 13 business days

$6.95

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

Filter icon Filter
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%

Filter reviews by


No reviews found
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.