You are previewing Unreal Engine 4.X By Example.
O'Reilly logo
Unreal Engine 4.X By Example

Book Description

An example-based practical guide to get you up and running with Unreal Engine 4.X

About This Book

  • A unique resource on Unreal with an interactive example based approach that is sure to get you up and running immediately

  • Will feature four unique game projects that increase in complexity which will enable readers to build their game development skills using Unreal Engine 4 and the C++ programming language

  • Will be the most up to date book in the market on Unreal with full coverage of the new features of UE4

  • Who This Book Is For

    Unreal Engine 4.X by Example was written for keen developers who wish to learn how to fully utilise Unreal Engine 4 to make awesome and engrossing game titles. Whether you are brand new to game development or a seasoned expert, you will be able to make use of the engine with C++. Experience with both C++ and other game engines is preferred before embarking on the Unreal by Example journey, but with a little external research into the basics of C++ programming, this book can take a complete game development novice to an Unreal Engine Developer!

    What You Will Learn

  • Use C++ with Unreal Engine to boost the development potential of any Unreal Engine project

  • Vastly improve workflow and content creation with the visual scripting system blueprint

  • Design, test, and implement interesting game worlds using Unreal Engines built-in editor

  • Build a networked, feature-rich first person shooter that you can play with others over LAN

  • Build design-centric game worlds that play to needs of your game ideas

  • Paint your game worlds via the creation and modification of visual shaders called materials

  • Gain knowledge of other game development disciplines through the use of the Animation and Material tool sets

  • Create feature-rich game projects with a sophisticated visual quality and feature set

  • In Detail

    With Unreal Engine 4 being made free to use, for any keen game developer it is quickly becoming the most popular game engine in today’s development industry. The engine offers a rich feature set that can be customized and built upon through the use of C++. This book will cover how to work with Unreal Engine’s tool set all the way from the basics of the editor and the visual scripting system blueprint to the in-depth low-level creation of content using C++.

    This book will provide you with the skills you need to create feature-rich, captivating, and refined game titles with Unreal Engine 4. This book will take you through the creation of four unique game projects, designed so that you will be ready to apply the engine’s rich development capabilities. You will learn not only to take advantage of the visual tools of the engine, but also the vast and powerful programming feature set of Unreal Engine 4.

    Style and approach

    The best resource that any beginner level game developer can dream of with examples on leveraging the amazing graphics engine, beautiful character animation and game world generations etc. by means of exciting real world game generation.This book would be a very unique resource for any game developer who wants to get up and running with Unreal. The unique example-driven approach will take you through the most basic games towards the more complex ones and will gradually build your skill level.

    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. Unreal Engine 4.X By Example
      1. Table of Contents
      2. Unreal Engine 4.X By Example
      3. Credits
      4. About the Author
      5. About the Reviewer
      6. www.PacktPub.com
        1. eBooks, discount offers, and more
          1. Why subscribe?
      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. Introduction to Unreal Engine 4
        1. Navigating this book
          1. Game Projects you say?
        2. Installing Unreal Engine 4
        3. Creating your first project!
        4. Navigating the Unreal Engine UI
        5. Creating a basic actor
          1. Objects, Actors, Pawns, and Characters
          2. Adding components to your Actor
            1. The component hierarchy
            2. Modifying components
            3. 3D transformation and axis
            4. Adding the Unreal factor
        6. Pre-Built projects as a learning resource
        7. Summary
      9. 2. Blueprints and Barrels – Your First Game
        1. Creating your first Blueprint
          1. The Blueprint window
          2. Working with Blueprints
          3. Blueprint elements
            1. Graphs
            2. Functions
            3. Macros
            4. Variables
            5. Event dispatchers
        2. Modifying the Hello Sphere Blueprint
          1. Working with Blueprint graphs
          2. Compiling Blueprints
          3. Using Blueprint variables
          4. Utilizing the Blueprint palette
          5. Blueprint meta-data and string manipulation
        3. Creating the Barrel Hopper project!
        4. Creating our Character
          1. Bringing our character to life
            1. Giving our character a mesh
            2. Creating the character's camera
        5. Game modes and how to make them
        6. Creating and receiving input events
          1. Creating the input Events
          2. Receiving input events
          3. Tweaking the character movement component
        7. Building the level!
          1. Camera tips and tricks
            1. Camera settings
            2. Controlling the camera
          2. Creating the level
          3. Blocking geometry
            1. Geometry Brushes and how to use them
            2. Placing the geometry
            3. Converting a geometry Brush to a static mesh
            4. Applying materials to geometry brushes
            5. Level building and trigonometry!
        8. Getting our barrels rolling
          1. Applying physics to objects
          2. Barrel spawners and Blueprint timers
            1. Creating Blueprint variables
            2. Event tick
            3. Branch nodes
          3. Trigger volumes and destroying Actors
        9. Debugging our Blueprints
        10. Masking our destruction with particles
        11. Respawning the player
          1. Delay nodes
          2. Player controllers
          3. Hit Events
        12. Summary
      10. 3. Advanced Blueprint, Animation, and Sound
        1. Cleaning up shop
          1. Logic flow
          2. Using a sequence
          3. Creating custom cameras
            1. Where do we spawn the camera?
            2. Spawning the camera object
            3. Setting the Target View
          4. Respawning the player with a Blueprint function
          5. Creating the Blueprint function
        2. Animation with UE4
          1. Animation Conventions
          2. Animation Blueprints
          3. Importing and exporting animation assets
          4. Creating your first animation Blueprint
          5. Navigating animation Blueprints
            1. The toolbar
          6. Populating the Animation graph
          7. Working with state machines
            1. State nodes
            2. Transition Rules
            3. Playing animations from within states
          8. Finishing our state machine
          9. The Animation Blueprint Event graph
          10. Getting our character running
          11. Working with Blendspaces
            1. Creating the running Blendspace
            2. Utilizing the running Blendspace
        3. Creating your first sound scape
          1. Importing sounds and sound cues
          2. Working with sound cues
            1. Sound modification
          3. Playing sounds via animation notifications
          4. Working with animation assets
            1. Notifies
            2. Curves
            3. Additive layers
            4. Statistics bar
          5. Placing the animation notifies
          6. Finishing our soundscape
            1. Exploding barrels
            2. Players death rattle
            3. Looping level sound
        4. Adding the finishing touches to Barrel Hopper
          1. Ragdolls and Event dispatchers
          2. Creating a basic HUD
            1. Making the HUD object
            2. Drawing the in game HUD
            3. Making the font
            4. Parsing information to and setting the HUD
            5. An end goal for the player, the chapter, and the project
        5. Summary
      11. 4. Unreal Engine, C++, and You
        1. UE and C++
          1. Why use C++
          2. Polymorphism, virtual inheritance and templates
        2. Hello World for C++
          1. Exploring your first code class
          2. Accommodating for the Unreal Build Tool
            1. Pre-Compile macros and you
          3. Breaking down the rest of the header file
            1. The default constructor and include list
            2. Virtual functions and calling the parent
          4. Adding components and object creators
            1. Construction helpers and object finders
          5. Building the code
          6. Adding Fire Particles and Hot Compilation
            1. Setting the sphere on fire
            2. Hot Compilation
          7. Hello world text and receiving events through delegates
            1. Adding the 3D text
            2. Delegates and Events
          8. Polishing the sphere
            1. Changing materials via C++
        3. Extending C++ into Blueprint
          1. Extending a class with no macro specifier support
          2. Extending a class with macro specifier support
            1. Defining a class with macro specifiers
            2. Working with code created components
        4. Blueprint native events and you!
          1. Overriding a BlueprintNativeEvent
        5. Summary
      12. 5. Upgrade Activated – Making Bounty Dash with C++
        1. Creating a C++ character
          1. Create the C++ project
          2. The UE4 object hierarchy
        2. Creating the Character
          1. What we have been given
          2. What we are going to need
            1. BountyDashCharacter's members
            2. BountyDashCharacters methods
          3. Constructing the Character
            1. Borrowing from the old to make the new
            2. Assigning Blueprints in code with generated classes
            3. Setting up the components
            4. Assuming default control
          4. Writing the begin Play function
            1. Getting In-Editor objects using the Game World
            2. Sorting TArrays with Lambdas
          5. Setting up inputs in C++
            1. Binding actions
          6. How our Character is going to Tick
          7. Compile time
        3. Creating the C++ world objects
          1. Converting BSP brushes to a static mesh
          2. Smoke and mirrors with C++ objects
          3. Modifying the BountyDashGameMode
            1. BountyDashGameMode class definition
            2. BountyDashGameMode function definitions
            3. Getting our game mode via Template functions

          4. Coding the floor
            1. Floor class definition
            2. Floor function definitions
              1. AFloor::AFloor() constructor
              2. AFloor::Tick()
            3. Placing the Floor in the level!
          5. Creating the obstacles
          6. Spawning actors from C++!
            1. Obstacle Spawner class definition
            2. Obstacle Spawner function definitions
            3. Getting information from components in C++
          7. Ensuring the Obstacle Spawner works
          8. Minting the coin object
            1. Coin class definition
            2. Coin function definitons
            3. Making the coin Blueprint!
          9. Making it rain coins, creating the coin spawner
            1. Coin Spawner class Definition
            2. Coin Spawner function definitions
          10. Testing what we have so far!
        4. Creating the interactions between the world objects
          1. Pushing the Character
            1. ABountyDashCharacter Collision functions
            2. Pushing the character back
          2. Picking up coins
            1. Coin collision
        5. Summary
      13. 6. Power Ups for Your Character, Power Ups for the User
        1. Cleaning up shop and object hierarchies
          1. BountyDashObject
          2. Modifying existing objects
        2. Creating a Plug-in with C++
          1. Modules and code files
          2. The anatomy of a plugin
            1. Describing a plugin
            2. PowerUpPlugin.uplugin
        3. Working with our first plugin module
          1. PowerUpPlugin.Build.cs
          2. Declaring the PowerUpPlugin code module
          3. Adding the PowerUp object
          4. Using our plugin in engine
            1. Creating the BountyDashPowerUp object
        4. Incorporating power-ups into Bounty Dash
          1. Modifying the Coin Spawner
          2. Build, run, and test!
          3. Colliding with power ups
          4. Powering up the character
            1. Reducing the game speed
            2. Making the coin magnet
            3. How to create, load and smash Destructible Meshes
        5. Creating HUDs using C++
          1. ABountyDashHUD
          2. Getting information from our objects
          3. Setting the HUD class in the game mode
          4. Implementing a custom DrawHUD function
        6. Completing the Bounty Dash game loop!
          1. The beginning of the end and pausing the game
            1. Pausing the Game
          2. Restarting the game
          3. Drawing the game over text
        7. Finishing the wall of death and polishing the project
          1. Making the wall of death
            1. Making the new floor mesh
            2. ADestroyedFloorPiece
            3. Modifying the AFloor object
          2. Bells, whistles and explosions
            1. Playing sound from C++
            2. Playing particles from C++
          3. Getting the character to run
          4. The last bit of concealer
        8. Summary
      14. 7. Boss Mode Activated – Unreal Robots
        1. Setting up the project
        2. The first-person character
          1. Importing what we need
          2. Beginning the FPC
            1. Establishing a FPC aim/movement
            2. Defining the FPC constructor
            3. Defining the FPC move and aim functions
            4. Creating the input bindings
            5. Binding the inputs
          3. Abstracting a BM character into Blueprint
          4. Setting a Blueprint object as the default pawn in a C++ game mode
          5. Testing what we have!
        3. Adding a custom HUD and drawing a cross hair
          1. BMHUD class definition
          2. Defining the BMHUD
        4. Creating the projectile
          1. Defining the Projectile
          2. Initializing the Projectile
          3. Colliding with the Projectile
          4. Subclass templates and firing the projectile
            1. Modifying BMCharacter accommodate for the projectile
          5. Creating the FPProjectile Blueprint
          6. Modifying FPCharacter
        5. Unreal Robots
          1. AI breakdown
          2. Preparing your project for AI intergration
          3. Creating the AI character base class
          4. Creating your first AI controller
          5. Behavior tree breakdown and logic flow
          6. What are blackboards?
        6. Creating a basic behavior tree and black-board!
          1. Setting up the blackboard
          2. The behavior tree Editor
          3. Setting up the behavior Tree
        7. Creating a custom task via blueprint
        8. Creating a custom decorator using blueprint
        9. Creating a custom service using C++
          1. Defining the BMArgoCheck class
        10. Advanced collision in UE4
          1. Defining the service tick
          2. Adding the C++ service to the BossBT
        11. Integrating the AI Character
        12. Creating a custom object collision channel
        13. Modifying the level to support AI
          1. What is a navigation mesh
          2. Adjusting the NavMesh generation settings
          3. Placing a NavMesh in the scene
        14. Placing the AI in the level and testing
        15. Summary
      15. 8. Advanced AI and Unreal Rendering
        1. Expanded AI and tracking projectiles
        2. Tracking projectiles and you
          1. Creating the line trace
          2. Preparing the projectile
          3. Creating the custom channel and testing the tracking!
        3. Expanded AI
          1. Damage in UE4
          2. Boss state and enums in blackboard!
            1. Interpreting our C++ enum in Blackboard
          3. Modifying the BossBT to support Boss States
            1. Debugging BossBT to check Blackboard values
          4. Upgrading the ABMIController
            1. Tracking to the player
          5. Testing what we have so far
          6. Arming the boss
            1. Adding the Turret boss state
          7. The Final Behaviour State
            1. BMRandomMoveTo
            2. Finishing the BossBT
          8. AI Complete
        4. Rendering in UE4
        5. UE4 Materials
          1. What are materials
          2. Physically Based Rendering
          3. The Material editor
            1. The Toolbar
            2. The Viewport
            3. The Graph and Base material node
            4. The Details panel
            5. The stats panel
            6. The Palette
          4. Starting the Boss outer material
            1. Your first material expression and color channels
            2. Applying a Normal Map and the texture viewer
            3. Emissive color and masks
          5. Adding more detail and advanced material use
            1. Texture UV's and adding normals
            2. Functions of time within materials and pulsing glow
          6. Making the Boss inner material
            1. Setting up what we know
            2. Masking values based on UV
          7. Applying the material to the Boss
        6. Summary
      16. 9. Creating a Networked Shooter
        1. Creating the project
          1. Adding a marketplace package
        2. Network multiplayer theory
          1. Networking patterns
            1. Peer to Peer (P2P)
            2. Client/server
        3. UE4 Networking
          1. Dedicated or listen servers
          2. UE4 replication
          3. Network role
          4. Remote Procedure Calls (RPCs)
            1. Types of RPC
            2. Defining RPCs
          5. Net ownership, player controllers and game modes
        4. Starting the networked First Person Shooter
          1. Preparing the NS project
          2. Making a networked player character
            1. NSCharacter visual and audio assets
          3. Player states and networking
          4. Finishing the Player class definition
          5. Writing the ANSCharacter RPCs
          6. Defining the ANSCharacter functions
            1. Dynamic materials and material parameters
            2. Getting the player to shoot… online
            3. Taking damage and UE4 timers
            4. Cleaning up shop
        5. Preparing the ANSCharacter blueprint
          1. Preparing the third-person Mesh
          2. Creating the force feedback asset
          3. Custom collision channel
          4. Highlighting the VectorParameter that drives team color
          5. Making the fire montage assets
          6. Tying it all together
          7. Testing the multiplayer with a PIE session!
        6. Spawn points and spawning the players
          1. Defining the ANSSpawnPoint class
          2. ANSSpawnPoint function definitions
        7. Game modes and servers
          1. Game mode class definition
          2. Construction the Game mode and Finding Spawn points
          3. Ending the Game and ticking the game mode
          4. Connecting players
          5. Spawning the players
          6. Respawning the player
        8. Preparing our game map
          1. Testing our game functionality
        9. Drawing the HUD and preparing the lobby
          1. Creating the GameState
          2. Drawing in the HUD
        10. Testing our Game
        11. Summary
      17. 10. Goodbyes and Thank yous
        1. Packaging a project
          1. Build Targets
          2. Build configuration
            1. Compiler specific building to configuration
          3. Packaging NS
        2. Testing the NS package
          1. Creating the listen server instance
        3. Console commands
          1. Connecting to the local host
          2. Profiling using the console commands
          3. Console visualizations
            1. Wrapping up the NS project
        4. What we have learned so far
          1. The Editors
            1. Blueprints
          2. Unreal animation
          3. C++
          4. Artificial Intelligence
          5. Unreal Rendering
          6. Unreal networking!
        5. Summary
      18. Index