Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Building an RPG with Unity 2018
Building an RPG with Unity 2018

Building an RPG with Unity 2018: Leverage the power of Unity 2018 to build elements of an RPG. , Second Edition

eBook
$39.99
Paperback
$48.99
Subscription
Free Trial
Renews at $19.99p/m

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
Table of content icon View table of contents Preview book icon Preview Book

Building an RPG with Unity 2018

Chapter 2. Planning the Game

In the previous chapter, you were given a good overview and historical background of RPG, and hopefully, it also sparked your imagination. In this chapter, we will start to lay the groundwork for our own RPG. We will start by defining the story of our game, as well as the plot and the quests that will make the game playable. We'll look at the assets that will be required to create our environment, characters, and finally, we'll design the levels.

The following is a breakdown of the topics we will be covering in this chapter:

  • Building our RPG
  • The story of the Zazar dynasty
  • Asset inventory
  • Level design
  • The awakening
  • Testing the level
  • Creating the main menu

Awaken your creativity and let your imagination go wild!

Building our RPG


As discussed, building a role-playing game is no small task, but once you start down the path, you will come to the realization that it is not as difficult as it seems initially. The idea is to get started, and as you put your ideas down on paper and start the design process, more and more ideas will come into perspective.

As we have learned, there are some key elements that we will need to establish for our RPG. Let's recall them, and maybe even fine-tune them as we go along.

Our game's key elements are as follows:

  • Story and setting
  • Exploration and quest
  • Items and inventory
  • Character action and abilities
  • Experience and levels
  • Combat system
  • User interface

The story of the Zazar dynasty


The premise of most role-playing games tasks the player with saving the world. There are often twists and turns as the story progresses, such as the surprise appearance of an estranged relative, or enemies who become friends and vice versa. We will create our story and game based on such a story.

Backstory

Once upon a time, there was a great kingdom, ruled by the great King Zazar. The ruler of the kingdom was a generous lord to his subjects. The kingdom under the rule of Zazar was peaceful and prosperous; however, over time, internal family rivalries and struggles caused cracks in the strong bond that kept the kingdom intact.

Due to mysterious events, the great king decided to move his family away from the kingdom and trust his son—who will become the player character—with one of the wise elders that he trusted. The kingdom was never the same... Until now!

Exploration and quests

Now that we have defined the setting for our game, we can start working on developing...

Asset inventory


Now is a good time to discuss some of the basic assets that will be required for the development of our RPG. Our game assets are defined by the scenes we describe for our game. For our RPG, we have described four unique scenes. Each one has been described in enough detail for us to get an idea of the types of assets we will require.

Environment assets

The general theme of our game will be medieval. There are several ways to go about this. The first and preferred way is to either create the environment models by yourself or a with a teammate; the second is to find a freely available model that has been created by a third party; and the third is to purchase 3D models created by a third party.

The Asset Store is a great place for you to start hunting for great content if you do not have the ability to create your own 3D models. You can use the Asset Store to search for medieval-themed environments that can be used for the game.

One of my favorites is called Medieval Environment...

Level design


Now that we have our game story on paper and have an idea of what we want to achieve, it is time to apply our skills to actually making it happen.

Note

Since this book targets an audience that is already familiar with the basics of Unity, we will not cover the fundamental aspects of the software.

To get started, we need to launch Unity. I am using the 64-bit edition of Unity 2017.x Pro. You do not need to have the Pro version of Unity to complete the project in this book. See the following screenshot:

Go ahead and select a location and a name you desire for your project, and click the Create project button. At this point, Unity will create an empty project for you and display the Unity IDE. It should look something like the following:

New project

Note

For better quality of images, download the graphics bundle from https://www.packtpub.com/sites/default/files/downloads/BuildinganRPGwithUnity2018_ColorImages.pdf

Your view might be a bit different, depending on how you have configured...

Testing the level


At some point, you will want to test out the level and look at it through the eyes of the camera. We can use the built-in third-person character controller that comes in the Standard Assets and do a quick walk-through of the level.

Note

If you did not import the Standard Assets when you created the project, you will need to import them by selecting Assets followed by Import Package|Characters.

In your Project window, you will see a folder called Standard Assets; there is a subfolder called Character Controllers. You will need to select the 3rd Person Controller Prefab and drop it somewhere on the current scene. A good location is next to the shack. Make sure that the 3rd Person Controller (3rdPC) is above the terrain so it does not fall through!

You will have to attach a Rigidbody component to the 3rdPC GameObject. This is needed to make sure that our player-character (PC) uses the built-in physics for collision detection.

Before you run the level, let's make sure the camera...

Creating the main menu


Now is a good time to create the starting point for our game. Go ahead and save the current scene. We will make a new scene that will be used as the starting point of our game. To create the new scene, you will need to select File | New Scene. Go ahead and save the scene. I called my scene MainMenu.

Now we have a clear canvas that we can work with to create our Main Menu. In the Hierarchy window, right-click and select UI | Panel. This will create a Canvas GameObject and an EventSystem GameObject, and place them in your Hierarchy window. You will notice that the Panel UI Object is a child of the canvas. All UI elements will be a child of a canvas. Your Hierarchy should look something like the following screenshot:

There are several key aspects that we want to make sure are set properly. These are namely on the Canvas GameObject. Select the Canvas GameObject and look at the Inspector Window.

For this particular canvas, make sure that the Render Mode is set to Screen Space...

Creating the GameMaster script


As discussed in Chapter 1, What is an RPG?we will need a way to manage our game. We will create a script called GameMaster. This will be the core of the game that glues everything together. As we progress with the book, you will see how we will modify the core to meet our needs.

For now, we are just going to create a simple C# script and name it GameMaster.cs. We will then create the code that will be used to handle some of the basic events we want to perform at this point, namely, navigating from scene to scene.

From your Project Window, under your scripts folder, right-click and select Create | C# Script. Name it GameMaster.cs. Double-click your script to start your code editor and place the following code in there:

using UnityEngine; using UnityEngine.SceneManagement; namespace com.noorcon.rpg2e { 
   public class GameMaster : MonoBehaviour 
   { 
 
// Use this for initialization 
      void Start() 
      { 
 
      } 
 
      // Update is called once per...

Summary


In this chapter, we have established a good sense of the RPG. We have defined our levels and the settings for each level, and defined clear objectives for each level and the outcome for each level. We also took the first level, called Awakening, and created the environment. We looked at how to use our assets and the Asset Store to incorporate 3D models in our scene. We also looked at how to plan the layout of the level. We introduced a third-person character controller into the scene to help us visualize how the level looks from the player's perspective and help us fine-tune it as needed.

Here is a list of the assets that were used for the design of this level:

  • For the terrain, I used the Terrain Toolkit 2017 asset
  • For the models within the level, I used the Medieval Environment Pack asset

By the end of the chapter, we also developed our Main Menu scene and our initial GameMaster script that will be used to glue the core of the game together. In the next chapter, we will start creating...

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • •Get insights into Unity's user interface (UI) system and and build UIs for your RPG
  • •Implement artificial intelligence (AI) to build intelligent entities that take your game to the next level
  • •Develop multiplayer features for an RPG using Unity 2018

Description

In a role-playing game (RPG), users control a character, usually in the game's imaginary universe. Unity has become a top choice for developers looking to create these kinds of immersive RPGs. Building an RPG with Unity 2018, based on building some of the most common RPG features, teaches you tips, tricks, and techniques that can be applied to your own game. To start with, the book guides you through the fundamentals of role-playing games. You will learn the necessary aspects of building an RPG, such as structuring the game environment, customizing characters, controlling the camera, and designing other attributes such as inventory and weapons. You will also explore designing game levels by adding more features. Once you have understood the bigger picture, you will understand how to tackle the obstacles of networking in Unity and implement multiplayer mode for your RPG games. By the end of the book, you will be able to build upon the core RPG framework elements to create your own immersive games.

Who is this book for?

Building an RPG with Unity 2018 is for you if you are a programmer interested in developing and further enhancing your skills when developing RPGs in Unity 2018. This book does not cover the basics of Unity, and so is for intermediate or more advanced users.

What you will learn

  • •Construct a framework for inventory, equipment, characters, enemies, quests, and game events
  • •Understand how to load and unload scenes and assets
  • •Create multiplayer game settings for your RPG
  • •Design a UI for user input and feedback
  • •Implement AI for non-character players
  • •Customize your character at runtime

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jul 30, 2018
Length: 366 pages
Edition : 2nd
Language : English
ISBN-13 : 9781788626996
Vendor :
Unity Technologies
Languages :
Tools :

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

Product Details

Publication date : Jul 30, 2018
Length: 366 pages
Edition : 2nd
Language : English
ISBN-13 : 9781788626996
Vendor :
Unity Technologies
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 146.97
Building an RPG with Unity 2018
$48.99
Unity 2018 Artificial Intelligence Cookbook
$48.99
Unity 2018 By Example
$48.99
Total $ 146.97 Stars icon

Table of Contents

8 Chapters
What is an RPG? Chevron down icon Chevron up icon
Planning the Game Chevron down icon Chevron up icon
RPG Character Design Chevron down icon Chevron up icon
The Game Mechanics Chevron down icon Chevron up icon
GameMaster and Game Mechanics Chevron down icon Chevron up icon
Inventory System Chevron down icon Chevron up icon
User Interface and System Feedback Chevron down icon Chevron up icon
Multiplayer Setup Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.8
(9 Ratings)
5 star 55.6%
4 star 11.1%
3 star 0%
2 star 22.2%
1 star 11.1%
Filter icon Filter
Top Reviews

Filter reviews by




Kristin Dragos Sep 10, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The book is a great overview of the RPG genre! Covers all the core aspects of an RPG and how to build them - from planning to implementation. It even recommends some assets to jump start your development!
Amazon Verified review Amazon
S. Isayan Sep 16, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
1. Well written easy to follow step by step guide.2. Practical examples.3. Low cost.4. Just buy it already.
Amazon Verified review Amazon
Jeff Sep 12, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Does a great job going from 0-100 on everything you need to know to get started. A chapter is dedicated on how to plan building your game. Too many times people skip this important step to plan all the little details and then have to make changes later and pushing back your release date. This book covers just about everything you need to get your feel wet and learn, including lots of code, illustrations, pictures, and examples.
Amazon Verified review Amazon
NeverRight Sep 08, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
If you are looking for a beginners guide to the development of Role Playing Games then this is the perfect book for you.1- Has good explanation on what a role playing game is and how many types of patterns you can follow to design one.2- Step by step explanation of different modules of a Role Playing Games with real life examples.3- Nice introduction to environment design.4- One of the best implementation of locomotion and combat systems.5- Easy to follow instructions for structing your code and making the game multiplayer.This book let you master the fundamentals of developing a Role Playing Game. Highly Recommended.
Amazon Verified review Amazon
Nemesis Dec 13, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book is best for young biginers who are new to game dev code .
Amazon Verified review Amazon
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.