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 Unreal 4.x

Book Description

Get to grips with building the foundations of an RPG using Unreal Engine 4.x

About This Book

  • Utilize a mixture of C++, Blueprints, and UMG to create a role playing game (RPG) efficiently
  • Create reusable code chunks and elements that can easily be integrated into other games
  • A cost effective, step-by-step guide to building and customizing an entire framework for your RPG

Who This Book Is For

If you are new to Unreal Engine and always wanted to script an RPG, you are this book’s target reader. The lessons assume you understand the conventions of RPG games and have some awareness of the basics of using the Unreal editor to build levels.

What You Will Learn

  • Program gameplay elements in C++ in Unreal
  • Create custom game data for entities such as players and enemies
  • Create a turn-based combat engine
  • Design menu systems and blueprint logic
  • Create an NPC and dialog system
  • Integrate equipment and items
  • Develop the foundations of a saving and loading system

In Detail

Now that Unreal Engine 4 has become one of the most cutting edge game engines in the world, developers are looking for the best ways of creating games of any genre in the engine. This book will lay out the foundation of creating a turn-based RPG in Unreal Engine 4.12.

The book starts by walking you through creating a turn-based battle system that can hold commands for party members and enemies. You’ll get your hands dirty by creating NPCs such as shop owners, and important mechanics, that make up every RPG such as a currency system, inventory, dialogue, and character statistics. Although this book specifically focuses on the creation of a turn-based RPG, there are a variety of topics that can be utilized when creating many other types of genres.

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

Style and approach

You will follow a series of lessons detailing the elements that contribute to an RPG. By the end of the book, you will have considerably leveled up your ability to make your own 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 Unreal 4.x
    1. Table of Contents
    2. Building an RPG with Unreal 4.x
    3. Credits
    4. About the Authors
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
    7. 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
    8. 1. Getting Started with RPG Design in Unreal
      1. Tools for game design
        1. Google Drive
        2. Google Docs
        3. Google Spreadsheets
        4. Pencil and paper
      2. The design and concept phase
        1. Concept
        2. Design
      3. Describing the game's features and mechanics
      4. Tropes in existing role-playing games
        1. Stats and progression
        2. Classes
        3. Special abilities
      5. RPG design overview
        1. Setting
        2. Exploration
        3. Dialogue
        4. Shopping
        5. Gold
        6. The pause screen
        7. Party members
        8. Equipment
        9. Classes
          1. Soldier
        10. Combat
        11. Combat stats
        12. Combat actions
          1. Attack
          2. Ability
        13. After combat/victory
          1. Loot
          2. Experience
        14. Experience and leveling
          1. Stat increases
          2. Learning abilities
        15. Game over
      6. Choosing the right formula
      7. Summary
    9. 2. Scripting and Data in Unreal
      1. Downloading Unreal
      2. Downloading Visual Studio
      3. Setting up Visual Studio for Unreal
        1. Adding the Solution Platforms drop-down list
        2. Disabling the Error List tab
      4. Setting up a new Unreal project
      5. Creating a new C++ class
      6. Blueprints
        1. Creating a new Blueprint
        2. Adding a Blueprint to the scene
        3. Blueprints for Actor classes
      7. Using Data Tables to import spreadsheet data
        1. The spreadsheet format
        2. A sample spreadsheet
        3. The Data Table struct
        4. Importing the spreadsheet
        5. Querying the spreadsheet
      8. Summary
    10. 3. Exploration and Combat
      1. Creating the player pawn
        1. The Pawn
        2. The GameMode class
        3. Adding the skinned mesh
      2. Defining characters and enemies
        1. Classes
        2. Characters
        3. Enemies
      3. Party members
        1. The GameInstance class
      4. Turn-based combat
        1. Performing actions
        2. Making decisions
        3. Target selection
        4. Dealing damage
        5. Combat UI with UMG
        6. UI-driven decision making
        7. Creating the game over screen
      5. Summary
    11. 4. Pause Menu Framework
      1. UMG pause screen initial setup
      2. UMG background color
      3. UMG text
      4. UMG buttons
      5. The UMG inventory submenu
      6. The UMG equipment submenu
      7. Key binding
      8. Button programming
      9. Summary
    12. 5. Bridging Character Statistics
      1. Getting character data
      2. Getting player instances
      3. Displaying stats
      4. Summary
    13. 6. NPCs and Dialog
      1. Creating the NPC Character Blueprint
      2. Interacting with the NPC
      3. Dialog box setup
      4. Creating an NPC welcome box
      5. Adding an NPC talk box
      6. Summary
    14. 7. Gold, Items, and a Shop
      1. Setting and getting gold instances
      2. Item data
      3. The shop screen framework
      4. The item button framework
      5. Linking the item data
      6. Summary
    15. 8. Inventory Population and Item Use
      1. Creating the FieldPlayer Booleans
      2. Determining whether the inventory screen is on or off
      3. Logical difference between the inventory and shop items
      4. Finishing the inventory screen
      5. Buying items
      6. Using items
      7. Summary
    16. 9. Equipment
      1. The weapons Data Table
      2. Setting the weapon and equipment screen variables
      3. Creating the weapon button
      4. Revisiting the equipment screen
      5. Setting the equipment screen Text Blocks
      6. Correcting the character stats when equipping
      7. Summary
    17. 10. Leveling, Abilities, and Saving Progress
      1. XP and leveling source code
      2. Data Table starting values
      3. Displaying levels and experience in the pause menu
      4. Applying the correct damage in combat
      5. Setting up the abilities array
      6. Abilities logic
      7. Saving and loading game progress
        1. Saving
        2. Loading
      8. Summary
    18. Index