Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
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
₹799.99 ₹2919.99
Paperback
₹3649.99
Subscription
Free Trial
Renews at ₹800p/m

What do you get with a Packt Subscription?

Free for first 7 days. ₹800 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
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 : 9781788623469
Vendor :
Unity Technologies
Languages :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. ₹800 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 : Jul 30, 2018
Length: 366 pages
Edition : 2nd
Language : English
ISBN-13 : 9781788623469
Vendor :
Unity Technologies
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
₹800 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
₹4500 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 ₹400 each
Feature tick icon Exclusive print discounts
₹5000 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 ₹400 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 10,949.97
Building an RPG with Unity 2018
₹3649.99
Unity 2018 Artificial Intelligence Cookbook
₹3649.99
Unity 2018 By Example
₹3649.99
Total 10,949.97 Stars icon
Banner background image

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

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.