O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Building an RPG with Unity 5.x

Book Description

Unleash the full potential of Unity to build a fully playable, high-quality multiplayer RPG

About This Book

  • Learn to build a multiplayer real-time strategy game from scratch using Unity
  • Gain knowledge of Unity’s UI system to build complex user interfaces
  • See how to build and customize your framework for your RPG games

Who This Book Is For

If you have always wanted to create a high-end RPG using Unity, then this book is for you. Prior knowledge of game development is required and experience working with Unity will be beneficial.

What You Will Learn

  • Construct a framework for inventory, equipment, characters, enemies, quests, and game events
  • See how to load and unload scenes and assets
  • Create multiplayer game settings for our RPG
  • Design a UI for user input and feedback
  • Enhance Game Master to handle all aspects of the RPG
  • Develop a custom pathfinding system
  • Implement AI for character and non-character players

In Detail

Unity is one of the most cutting-edge game engines in the world. Developers are looking for the best ways to create games of any genre in the engine. This comprehensive guide on building an RPG with Unity teaches you high-end techniques currently used in developing modern games - the tips, tricks, and techniques can be applied to your own role RPG.

We begin with an introduction to, and the fundamentals of, RPG games. Moving further, you will learn the necessary parts of building an RPG, such as structuring the game environment, customizing characters, controlling the camera, and designing other attributes like inventory, weapons, and so on.

We also cover designing levels of the game by adding more features to it and making the game more interesting. You will also learn how to get around the obstacle of networking in Unity and be able to implement Multi-Player mode for your RPG games.

By the end of the book, you will be able to build upon core the RPG framework elements to create your own game experience.

Style and approach

This step-by-step tutorial will teach you how to build a multiplayer RPG. In this book you will explore the core concepts of what typical strategy one might need to build a complete game.

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

Table of Contents

  1. Building an RPG with Unity 5.x
    1. Building an RPG with Unity 5.x
    2. Credits
    3. About the Author
    4. About the Reviewer
    5. www.PacktPub.com
      1. Why subscribe?
    6. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    7. 1. In the Beginning
      1. A brief history
      2. Characteristics of an RPG
        1. Story and setting
          1. A glimpse at our cRPG story
        2. Exploration and quests
          1. A glimpse at our exploration and quests
        3. Inventory system
        4. Character development
        5. Experience and levelling
        6. Combat system
        7. User interface and graphics
      3. Existing or upcoming RPG games
        1. Dark Souls 3
        2. Fallout 4
        3. Divinity: Original Sin
      4. Patterns in RPG
        1. Terminology
        2. Contest Tree
        3. Last Man Standing
        4. Negotiated Contest
      5. Summary
    8. 2. Setting the Atmosphere
      1. Building our RPG
      2. The story of the Zazar Dynasty
        1. Plot
        2. Exploration and quests
          1. Awakening
          2. The village
          3. Broken forest - the horizon
          4. The kingdom
      3. Asset inventory
        1. Environment assets
        2. Character assets
      4. Level design
        1. Setting the stage
        2. Terrain toolkit in a nutshell
        3. The awakening
      5. Testing the level
      6. Creating the Main Menu
      7. Creating the Game Master
      8. Summary
    9. 3. Character Design
      1. Character definitions
      2. Base character class attributes
      3. Character states
      4. Character model
        1. Rigging your model
      5. Character motion
        1. Animator Controller
          1. Animation states
        2. Character controller
          1. Modification to animations
      6. Inverse Kinematics
      7. Summary
    10. 4. Player Character and Non-Player Character Design
      1. Customizing the Player Character
        1. Customizable parts
          1. User interface
          2. The Code for character customization
          3. Preserving our character state
        2. Recap
      2. Non-Player Characters
        1. Non-Player Character basics
          1. Setting up the Non-Player Character
          2. NPC Animator Controller
          3. NPC attack
        2. NPC AI
      3. PC and NPC interaction
      4. Summary
    11. 5. Game Master and Game Mechanics
      1. The Game Master
        1. Managing game settings and audio
        2. Managing scenes
      2. Improving Game Master
        1. Level controller
        2. Audio controller
      3. Player data management
        1. PC class enhancements
        2. Character customization class update
      4. Changes to UI Controller
      5. Testing
      6. Summary
    12. 6. Inventory System
      1. Inventory system
        1. Weighted Inventory
        2. Determining item types
      2. Creating inventory item
        1. Creating the Prefab
        2. Adding Inventory Item Agent
        3. Inventory Items Defined as Prefabs
      3. Inventory Interface
        1. Creating the inventory UI framework
        2. Designing a Dynamic Item Viewer
          1. Adding a Scroll View
          2. Adding Elements to PanelItem and Scroll View
          3. Adding txtItemElement Dynamically
        3. Building the Final Inventory Item UI
      4. Integrating the UI with the actual inventory system
        1. Hooking the category buttons and displaying the data
        2. Testing the Inventory System
      5. Inventory items and the Player Character
        1. Applying inventory items
        2. How It Looks
      6. Summary
    13. 7. User Interface and System Feedback
      1. Designing a Heads Up Display
        1. Basic information for a HUD
        2. Our design
        3. HUD framework
      2. Completing HUD design
        1. Panel character Info
        2. Panel active inventory items
        3. Special items panel
      3. Integrating the code
      4. Enemy stats in the HUD
        1. NPC stats user interface
        2. Creating the NPC canvas
        3. NPC health
      5. Enhancing the code
      6. Summary
    14. 8. Multiplayer Setup
      1. Challenges of a Multiplayer Game
      2. Initial Multiplayer Game
        1. Fundamental Networking Components
        2. Networking Project
        3. Adding Player Character
          1. Variable Synchronization
          2. Network Callbacks
          3. Sending Commands
          4. Client RPC Calls
          5. Creating the Canon Ball for the Tank
          6. Creating Tank Prefab and Configuring NetworkManager
        4. Adding the Enemy Tank
        5. Building and Testing
      3. Network Enabling RPG Characters
        1. Creating a Scene for RPG
        2. Networked Player Character
        3. Networked Non-Player Character
        4. Synchronizing Player Customization and Items
        5. Spawning NPC and Other Items
      4. Testing Our Network-Enabled PC and NPC
      5. What's Next
      6. Summary