Blueprints Visual Scripting for Unreal Engine - Second Edition

Book description

Publisher's note: This edition from 2019 is based on Unreal Engine 4 and does not make use of the most recent Unreal Engine features. A new third edition, updated for Unreal Engine 5 blueprints including new topics, such as implementing procedural generation and creating a product configurator, has now been published.

Key Features

  • Design a fully functional game in UE4 without writing a single line of code
  • Implement visual scripting to develop gameplay mechanics, UI, visual effects, VR and artificial intelligence
  • Deploy your game on multiple platforms and share it with the world

Book Description

Blueprints is the visual scripting system in Unreal Engine that enables programmers to create baseline systems and can be extended by designers.

This book helps you explore all the features of the Blueprint Editor and guides you through using Variables, Macros, and Functions. You'll also learn about object-oriented programming (OOP) and discover the Gameplay Framework. In addition to this, you'll learn how Blueprint Communication allows one Blueprint to access information from another Blueprint. Later chapters will focus on building a fully functional game using a step-by-step approach. You'll start with a basic first-person shooter (FPS) template, and each chapter will build on the prototype to create an increasingly complex and robust game experience. You'll then progress from creating basic shooting mechanics to more complex systems, such as user interface elements and intelligent enemy behavior. The skills you will develop using Blueprints can also be employed in other gaming genres. In the concluding chapters, the book demonstrates how to use arrays, maps, enums, and vector operations. Finally, you'll learn how to build a basic VR game.

By the end of this book, you'll have learned how to build a fully functional game and will have the skills required to develop an entertaining experience for your audience.

What you will learn

  • Understand programming concepts in Blueprints
  • Create prototypes and iterate new game mechanics rapidly
  • Build user interface elements and interactive menus
  • Use advanced Blueprint nodes to manage the complexity of a game
  • Explore all the features of the Blueprint editor, such as the Components tab, Viewport, and Event Graph
  • Get to grips with object-oriented programming (OOP) concepts and explore the Gameplay Framework
  • Learn Virtual Reality development with UE Blueprint

Who this book is for

This book is for anyone who is interested in developing games or applications with UE4. Although basic knowledge of Windows OS is required, experience in programming or UE4 is not necessary.

Table of contents

  1. Title Page
  2. Copyright and Credits
    1. Blueprints Visual Scripting for Unreal Engine Second Edition
  3. About Packt
    1. Why subscribe?
  4. Contributors
    1. About the authors
    2. About the reviewers
    3. Packt is searching for authors like you
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Conventions used
    4. Get in touch
      1. Reviews
  6. Section 1: Blueprint Fundamentals
  7. Exploring the Blueprint Editor
    1. Installing Unreal Engine
    2. Creating new projects and using templates
    3. Blueprints Visual Scripting
      1. Opening the Level Blueprint Editor
      2. Creating a Blueprint class
    4. The Blueprint Editor interface
      1. The Toolbar panel
      2. The Components panel
      3. The My Blueprint panel
      4. The Details panel
      5. The Viewport panel
      6. The Event Graph panel
    5. Adding Components to a Blueprint
    6. Summary
  8. Programming with Blueprints
    1. Storing values in variables
    2. Defining the behavior of a Blueprint with Events and Actions
      1. Events
      2. Actions
      3. Execution path
    3. Creating expressions with operators
      1. Arithmetic operators
      2. Relational operators
      3. Logical operators
    4. Organizing the script with Macros and Functions
      1. Creating Macros
      2. Creating Functions
      3. Macros versus Functions versus Events
    5. Summary
  9. Actors and the Gameplay Framework
    1. OOP concepts
      1. Classes
      2. Instances
      3. Inheritance
    2. Managing Actors
      1. Referencing Actors
      2. Spawning and destroying Actors
      3. Construction Script
    3. Exploring the Gameplay Framework classes
      1. Pawn
      2. Character
      3. PlayerController
      4. Game Mode Base
      5. Game Instance
    4. Summary
  10. Understanding Blueprint Communication
    1. Direct Blueprint Communication
    2. Casting in Blueprints
    3. Level Blueprint Communication
    4. Event Dispatchers
    5. Binding Events
    6. Summary
  11. Section 2: Developing a Game
  12. Object Interaction with Blueprints
    1. Creating a project and the first Level
      1. Setting a template for a new project
      2. Making sense of the project settings
      3. Creating the project
    2. Adding objects to our Level
    3. Exploring Materials
      1. Creating Materials
      2. Material properties and Blueprint nodes
      3. Adding substance to our Material
    4. Creating the target Blueprint
      1. Exploring the Event Graph panel
      2. Detecting a hit
      3. Swapping a Material
      4. Improving the Blueprint
    5. Adding movement
      1. Changing the Actor's Mobility and Collision settings
      2. Breaking down our goal
      3. Storing data with variables
      4. Readying direction for calculations
      5. Getting relative speed using delta time
      6. Translating the existing location
      7. Updating location
    6. Changing direction
      1. Testing moving targets
    7. Summary
  13. Enhancing Player Abilities
    1. Adding the running functionality by extending a Blueprint
      1. Breaking down the Character Movement
      2. Customizing control inputs
      3. Adding a Sprint ability
    2. Animating a zoomed view
      1. Using a timeline to smooth transitions
      2. Increasing the projectile's speed
    3. Adding sound and particle effects
      1. Changing target states with branches
      2. Triggering sound effects, explosions, and destruction
    4. Summary
  14. Creating Screen UI Elements
    1. Creating simple UI meters with UMG
      1. Drawing shapes with Widget Blueprints
      2. Customizing the meter's appearance
      3. Creating ammo and enemy counters
      4. Displaying the HUD
    2. Connecting UI values to player variables
      1. Creating bindings for health and stamina
      2. Making text bindings for the ammo and goal counters
    3. Tracking the ammo and eliminated targets
      1. Reducing the ammo counter
      2. Increasing the targets eliminated counter
    4. Summary
  15. Creating Constraints and Gameplay Objectives
    1. Constraining player Actions
      1. Draining stamina while sprinting
      2. Using looping timers to repeat Actions
      3. Blocking Actions with branches
      4. Regenerating stamina
      5. Preventing firing Actions when out of ammo
    2. Creating collectible objects
      1. Setting up collection logic
    3. Setting a gameplay win condition
      1. Displaying a target goal in the HUD
      2. Creating a WinMenu screen
      3. Displaying the menu
      4. Triggering a win
    4. Summary
  16. Section 3: Enhancing the Game
  17. Building Smart Enemies with Artificial Intelligence
    1. Setting up the enemy Actor to navigate
      1. Importing from the Marketplace
      2. Expanding the play area
      3. Making the Level traversable with a NavMesh
      4. Setting the stage for intelligence with AI assets
    2. Creating navigation behavior
      1. Setting up patrol points
      2. Enabling communication between assets
      3. Teaching our AI to walk with the Behavior Tree
    3. Making the AI chase the player
      1. Giving the enemy sight with Pawn Sensing
      2. Adding conditions to the Behavior Tree
      3. Creating a chasing behavior
    4. Summary
  18. Upgrading the AI Enemies
    1. Creating an enemy attack
      1. Making an attack task
      2. Updating the health meter
    2. Making enemies hear and investigate sounds
      1. Adding hearing to the Behavior Tree
      2. Setting up the investigating tasks
      3. Interpreting and storing the noise Event data
      4. Adding noise to the player's Actions
    3. Making the enemies destructible
      1. Saving time by reusing existing Blueprint content
    4. Spawning more enemies during gameplay
      1. Choosing a spawn point where enemies will appear
      2. Managing spawn rates and limits with variables
      3. Spawning new enemies in the Level Blueprint
    5. Creating enemy wandering behavior
      1. Identifying a wander point with a custom task
      2. Adding wandering to the Behavior Tree
    6. Summary
  19. Game States and Applying the Finishing Touches
    1. Making danger real with player death
      1. Setting up a lose screen
    2. Creating round-based scaling with saved games
      1. Storing game information using Save Game Object
      2. Storing and loading the saved data when starting the game
      3. Increasing the enemy target goal
      4. Creating a transition screen to be shown between rounds
      5. Transitioning to a new round when the current round is won
    3. Pausing the game and resetting the save file
      1. Creating a pause menu
      2. Resuming and resetting the save file
      3. Triggering the Pause menu
    4. Summary
  20. Building and Publishing
    1. Optimizing your graphics settings
    2. Setting up our game to be played by others
    3. Packaging the game into a build
      1. Build configurations and packaging settings
    4. Summary
  21. Section 4: Advanced Blueprints
  22. Data Structures and Flow Control
    1. Containers
      1. Arrays
      2. Sets
      3. Maps
    2. Other data structures
      1. Enumerations
      2. Structures
      3. Data tables
    3. Flow control nodes
      1. Switch nodes
      2. FlipFlop
      3. Sequence
      4. ForEachLoop
      5. DoOnce
      6. Do N
      7. Gate
      8. MultiGate
    4. Summary
  23. Math and Trace Nodes
    1. World and relative transforms
    2. Points and vectors
      1. Vector operations
    3. Traces
      1. Traces for objects
      2. Traces by channel
      3. Shape traces
      4. Debug lines
      5. Example of vectors and trace nodes
    4. Summary
  24. Blueprints Tips
    1. Blueprint Editor shortcuts
    2. Blueprint best practices
      1. Blueprint responsibilities
      2. Managing Blueprint complexities
    3. Miscellaneous Blueprint nodes
      1. Select
      2. Teleport
      3. Format Text
      4. Math Expression
      5. Set View Target with Blend
      6. AttachToComponent
      7. Enable/Disable Input
      8. The Set Input Mode nodes
    4. Summary
  25. Introduction to VR Development
    1. Exploring the VR template
    2. The Pawn Blueprint
    3. The Motion Controller Blueprint
    4. Object grabbing
    5. Teleportation
    6. Summary
  26. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product information

  • Title: Blueprints Visual Scripting for Unreal Engine - Second Edition
  • Author(s): Marcos Romero, Brenden Sewell
  • Release date: August 2019
  • Publisher(s): Packt Publishing
  • ISBN: 9781789347067