0%

Learn the tools and techniques of game design using a project-based approach with Unreal Engine 4 and C++

Key Features

  • Kickstart your career or dive into a new hobby by exploring game design with UE4 and C++
  • Learn the techniques needed to prototype and develop your own ideas
  • Reinforce your skills with project-based learning by building a series of games from scratch

Book Description

Game development can be both a creatively fulfilling hobby and a full-time career path. It's also an exciting way to improve your C++ skills and apply them in engaging and challenging projects.

Game Development Projects with Unreal Engine starts with the basic skills you'll need to get started as a game developer. The fundamentals of game design will be explained clearly and demonstrated practically with realistic exercises. You'll then apply what you've learned with challenging activities.

The book starts with an introduction to the Unreal Editor and key concepts such as actors, blueprints, animations, inheritance, and player input. You'll then move on to the first of three projects: building a dodgeball game. In this project, you'll explore line traces, collisions, projectiles, user interface, and sound effects, combining these concepts to showcase your new skills.

You'll then move on to the second project; a side-scroller game, where you'll implement concepts including animation blending, enemy AI, spawning objects, and collectibles. The final project is an FPS game, where you will cover the key concepts behind creating a multiplayer environment.

By the end of this Unreal Engine 4 game development book, you'll have the confidence and knowledge to get started on your own creative UE4 projects and bring your ideas to life.

What you will learn

  • Create a fully-functional third-person character and enemies
  • Build navigation with keyboard, mouse, gamepad, and touch controls
  • Program logic and game mechanics with collision and particle effects
  • Explore AI for games with Blackboards and Behavior Trees
  • Build character animations with Animation Blueprints and Montages
  • Test your game for mobile devices using mobile preview
  • Add polish to your game with visual and sound effects
  • Master the fundamentals of game UI design using a heads-up display

Who this book is for

This book is suitable for anyone who wants to get started using UE4 for game development. It will also be useful for anyone who has used Unreal Engine before and wants to consolidate, improve and apply their skills. To grasp the concepts explained in this book better, you must have prior knowledge of the basics of C++ and understand variables, functions, classes, polymorphism, and pointers. For full compatibility with the IDE used in this book, a Windows system is recommended.

Table of Contents

  1. Game Development Projects with Unreal Engine
  2. Preface
    1. About the Book
    2. About the Authors
    3. Audience
    4. About the Chapters
    5. Conventions
    6. Before You Begin
    7. Installing Visual Studio
    8. Epic Games Launcher
    9. Code Bundle
    10. Get in touch
    11. Please leave a review
  3. 1. Unreal Engine Introduction
    1. Introduction
    2. Exercise 1.01: Creating an Unreal Engine 4 Project
    3. Getting to Know Unreal
    4. Editor Windows
    5. Viewport Navigation
    6. Manipulating Actors
    7. Exercise 1.02: Adding and Removing Actors
    8. Blueprint Actors
    9. Exercise 1.03: Creating Blueprint Actors
    10. The Blueprint Editor
    11. Event Graph
    12. Exercise 1.04: Creating Blueprint Variables
    13. Exercise 1.05: Creating Blueprint Functions
    14. The Float Multiplication Node
    15. BeginPlay and Tick
    16. Exercise 1.06: Offsetting the TestActor Class on the Z Axis
    17. ThirdPersonCharacter Blueprint Class
    18. Meshes and Materials
    19. Meshes
    20. Materials
    21. Manipulating Materials in UE4
    22. Activity 1.01: Propelling TestActor on the Z Axis Indefinitely
    23. Summary
  4. 2. Working with Unreal Engine
    1. Introduction
    2. Creating and Setting Up a Blank C plus plus Project
    3. Exercise 2.01: Creating an Empty C plus plus Project
    4. Content Folder Structure in Unreal Engine
    5. Working with the Visual Studio Solution
    6. Solution Analysis
    7. The Engine Project
    8. Game Project
    9. Debugging Code in Visual Studio
    10. Exercise 2.02: Debugging the Third Person Template Code
    11. Importing the Required Assets
    12. Exercise 2.03: Importing a Character FBX File
    13. The Unreal Game Mode Class
    14. Game Mode Default Classes
    15. Gameplay Events
    16. Networking
    17. GameModeBase versus GameMode
    18. Levels
    19. The Unreal Pawn Class
    20. The Default Pawn
    21. The Spectator Pawn
    22. The Unreal Player Controller Class
    23. Exercise 2.04: Setting Up the Game Mode, Player Controller, and Pawn
    24. Animations
    25. Animation Blueprints
    26. Event Graph
    27. The Anim Graph
    28. State Machines
    29. Transition Rules
    30. Blend Spaces
    31. Exercise 2.05: Creating a Mannequin Animation
    32. Activity 2.01: Linking Animations to a Character
    33. Summary
  5. 3. Character Class Components and Blueprint Setup
    1. Introduction
    2. The Unreal Character Class
    3. Extending the Character Class
    4. Exercise 3.01: Creating and Setting Up a Third-Person Character C plus plus Class
    5. Extending the C plus plus Class with Blueprints
    6. Exercise 3.02: Extending C plus plus with Blueprints
    7. Activity 3.01: Extending the C plus plus Character Class with Blueprint in the Animation Project
    8. Summary
  6. 4. Player Input
    1. Introduction
    2. Input Actions and Axes
    3. Exercise 4.01: Creating the Jump Action and Movement Axes
    4. Processing Player Input
    5. DefaultInput.ini
    6. Exercise 4.02: Listening to Movement Actions and Axes
    7. Turning the camera around the character
    8. Mobile platforms
    9. Exercise 4.03: Previewing on Mobile
    10. Exercise 4.04: Adding Touchscreen Input
    11. Activity 4.01: Adding Walking Logic to Our Character
    12. Summary
  7. 5. Line Traces
    1. Introduction
    2. Collision
    3. Project Setup
    4. Exercise 5.01: Converting DodgeballCharacter to a Top-Down Perspective
    5. Line Traces
    6. Creating the EnemyCharacter C plus plus class
    7. Exercise 5.02: Creating the CanSeeActor Function, Which Executes Line Traces
    8. Visualizing the Line Trace
    9. Exercise 5.03: Creating the LookAtActor Function
    10. Creating the EnemyCharacter Blueprint Class
    11. Sweep Traces
    12. Exercise 5.04: Executing a Sweep Trace
    13. Changing the Visibility Trace Response
    14. Multi Line Traces
    15. The Camera Trace Channel
    16. Exercise 5.05: Creating a Custom EnemySight Trace Channel
    17. Activity 5.01: Creating the SightSource Property
    18. Summary
  8. 6. Collision Objects
    1. Introduction
    2. Object Collision in UE4
    3. Collision Components
    4. Collision Events
    5. Collision Channels
    6. Collision Properties
    7. Exercise 6.01: Creating the Dodgeball Class
    8. Physical Materials
    9. Exercise 6.02: Adding a Projectile Movement Component to DodgeballProjectile
    10. Timers
    11. Spawning Actors
    12. Exercise 6.03: Adding Projectile-Throwing Logic to the EnemyCharacter
    13. Walls
    14. Exercise 6.04: Creating Wall Classes
    15. Victory Box
    16. Exercise 6.05: Creating the VictoryBox class
    17. Exercise 6.06: Adding the ProjectileMovementComponent Getter Function in DodgeballProjectile
    18. Activity 6.01: Replacing the SpawnActor Function with SpawnActorDeferred in EnemyCharacter
    19. Summary
  9. 7. UE4 Utilities
    1. Introduction
    2. Blueprint Function Libraries
    3. Exercise 7.01: Moving the CanSeeActor Function to the Blueprint Function Library
    4. Actor Components
    5. Exercise 7.02: Creating the HealthComponent Actor Component
    6. Exercise 7.03: Integrating the HealthComponent Actor Component
    7. Interfaces
    8. Blueprint Native Events
    9. Exercise 7.04: Creating the HealthInterface Class
    10. Activity 7.01: Moving the LookAtActor Logic to an Actor Component
    11. Summary
  10. 8. User Interfaces
    1. Introduction
    2. Game UI
    3. UMG Basics
    4. Exercise 8.01: Creating a Widget Blueprint
    5. Anchors
    6. Exercise 8.02: Editing UMG Anchors
    7. Exercise 8.03: Creating the RestartWidget C plus plus Class
    8. Exercise 8.04: Creating the Logic for Adding the RestartWidget to the Screen
    9. Exercise 8.05: Setting up the DodgeballPlayerController Blueprint Class
    10. Progress Bars
    11. Exercise 8.06: Creating the Health Bar C plus plus Logic
    12. Activity 8.01: Improving the RestartWidget
    13. Summary
  11. 9. Audio-Visual Elements
    1. Introduction
    2. Audio in UE4
    3. Exercise 9.01: Importing an Audio File
    4. Exercise 9.02: Playing a Sound When the Dodgeball Bounces off a Surface
    5. Sound Attenuation
    6. Exercise 9.03: Turning the Bounce Sound into a 3D Sound
    7. Exercise 9.04: Adding Background Music to Our Game
    8. Particle Systems
    9. Exercise 9.05: Spawning a Particle System When the Dodgeball Hits the Player
    10. Activity 9.01: Playing a Sound When the Dodgeball Hits the Player
    11. Level Design
    12. Exercise 9.06: Building a Level Blockout
    13. Extra Features
    14. Summary
  12. 10. Creating a SuperSideScroller Game
    1. Introduction
    2. Project Breakdown
    3. The Player Character
    4. Exercise 10.01: Creating the Side-Scroller Project and Using the Character Movement Component
    5. Side Scroller versus 2D Side Scroller
    6. Activity 10.01: Making Our Character Jump Higher
    7. Features of Our Side-Scroller Game
    8. Enemy Character
    9. Power-Up
    10. Collectible
    11. HUD (Heads-Up Display)
    12. Steps in Animation
    13. Character Animation Pipeline
    14. The Concept Stage
    15. The 3D Modeling Stage
    16. The Rigging Stage
    17. Animation
    18. Asset Export and Import
    19. Exercise 10.02: Exploring the Persona Editor and Manipulating the Default Mannequin Skeleton Weights
    20. Activity 10.02: Skeletal Bone Manipulation and Animations
    21. Animations in Unreal Engine 4
    22. Skeletons
    23. Skeletal Meshes
    24. Animation Sequences
    25. Exercise 10.03: Importing and Setting Up the Character and Animation
    26. Activity 10.03: Importing More Custom Animations to Preview the Character Running
    27. Summary
  13. 11. Blend Spaces 1D, Key Bindings, and State Machines
    1. Introduction
    2. Blend Spaces
    3. 1D Blend Space vs Normal Blend Space
    4. Exercise 11.01: Creating the CharacterMovement 1D Blend Space
    5. Activity 11.01: Adding the Walking and Running Animations to the Blend Space
    6. Main Character Animation Blueprint
    7. Animation Blueprints
    8. Exercise 11.02: Adding the Blend Space to the Character Animation Blueprint
    9. Velocity Vectors
    10. Exercise 11.03: Adding the Blend Space to the Character Animation Blueprint
    11. Activity 11.02: Previewing the Running Animation In-Game
    12. Input Bindings
    13. Exercise 11.04: Adding Input for Sprinting and Throwing
    14. Exercise 11.05: Reparenting the Character Blueprint
    15. Exercise 11.06: Coding the Character Sprint Functionality
    16. Activity 11.03: Implementing the Throwing Input
    17. Animation State Machines
    18. Exercise 11.07: Player Character Movement and Jump State Machine
    19. Transition Rules
    20. Exercise 11.08: Adding States and Transition Rules to the State Machine
    21. Exercise 11.09: Time Remaining Ratio Function
    22. Activity 11.04: Finishing the Movement and Jumping State Machine
    23. Summary
  14. 12. Animation Blending and Montages
    1. Introduction
    2. Animation Blending, Anim Slots, and Animation Montages
    3. Exercise 12.01: Setting Up the Animation Montage
    4. Animation Montages
    5. Exercise 12.02: Adding the Throw Animation to the Montage
    6. Anim Slot Manager
    7. Exercise 12.03: Adding a New Anim Slot
    8. Save Cached Pose
    9. Exercise 12.04: Save Cached Pose of the Movement State Machine
    10. Layered blend per bone
    11. Exercise 12.05: Blending Animation with the Upper Body Anim Slot
    12. The Throw Animation
    13. Exercise 12.06: Previewing the Throw Animation
    14. The Super Side Scroller Game Enemy
    15. Exercise 12.07: Creating the Enemy Base C plus plus Class
    16. Exercise 12.08: Creating and Applying the Enemy Animation Blueprint
    17. Materials and Material Instances
    18. Exercise 12.09: Creating and Applying the Enemy Material Instance
    19. Activity 12.01: Updating Blend Weights
    20. Summary
  15. 13. Enemy Artificial Intelligence
    1. Introduction
    2. Enemy AI
    3. AI Controller
    4. Auto Possess AI
    5. Exercise 13.01: Implementing AI Controllers
    6. Navigation Mesh
    7. Exercise 13.02: Implementing a Nav Mesh Volume for the AI Enemy
    8. Recasting the Nav Mesh
    9. Exercise 13.03: Recasting Nav Mesh Volume Parameters
    10. Activity 13.01: Creating a New Level
    11. Behavior Trees and Blackboards
    12. Composites
    13. Tasks
    14. Decorators
    15. Services
    16. Exercise 13.04: Creating the AI Behavior Tree and Blackboard
    17. Exercise 13.05: Creating a New Behavior Tree Task
    18. Exercise 13.06: Creating the Behavior Tree Logic
    19. Activity 13.02: AI Moving to the Player Location
    20. Exercise 13.07: Creating the Enemy Patrol Locations
    21. Vector Transformation
    22. Exercise 13.08: Selecting a Random Point in an Array
    23. Exercise 13.09: Referencing the Patrol Point Actor
    24. Exercise 13.10: Updating BTTask_FindLocation
    25. Player Projectile
    26. Exercise 13.11: Creating the Player Projectile
    27. Exercise 13.12: Initializing Player Projectile Settings
    28. Activity 13.03: Creating the Player Projectile Blueprint
    29. Summary
  16. 14. Spawning the Player Projectile
    1. Introduction
    2. Anim Notifies and Anim Notify States
    3. Exercise 14.01: Creating a UAnim Notify Class
    4. Exercise 14.02: Adding the Notify to the Throw Montage
    5. Playing Animation Montages
    6. Playing Animation Montages in Blueprints
    7. Playing Animation Montages in C plus plus
    8. Exercise 14.03: Playing the Throw Animation in C plus plus
    9. Game World and Spawning Objects
    10. Exercise 14.04: Creating the Projectile Spawn Socket
    11. Exercise 14.05: Preparing the SpawnProjectile() Function
    12. Exercise 14.06: Updating the Anim_ProjectileNotify Class
    13. Destroying Actors
    14. Exercise 14.07: Creating the DestroyEnemy() Function
    15. Exercise 14.08: Destroying Projectiles
    16. Activity 14.01: Projectile Destroying Enemies
    17. Visual and Audio Effects
    18. Exercise 14.09: Adding Effects When the Enemy Is Destroyed
    19. Exercise 14.10: Adding Effects to the Player Projectile
    20. Exercise 14.11: Adding VFX and SFX Notifies
    21. Activity 14.02: Adding Effects for When the Projectile Is Destroyed
    22. Summary
  17. 15. Collectibles, Power-Ups, and Pickups
    1. Introduction
    2. URotatingMovementComponent
    3. Exercise 15.01: Creating the PickableActor_Base Class and Adding URotatingMovementComponent
    4. Activity 15.01: Player Overlap Detection and Spawning Effects in PickableActor_Base
    5. Exercise 15.02: Creating the PickableActor_Collectable Class
    6. Activity 15.02: Finalizing the PickableActor_Collectable Actor
    7. Logging Variables Using UE_LOG
    8. Exercise 15.03: Tracking the Number of Coins for the Player
    9. UMG
    10. Text Widget
    11. Anchors
    12. Text Formatting
    13. Exercise 15.04: Creating the Coin Counter UI HUD Element
    14. Adding and Creating UMG User Widgets
    15. Exercise 15.05: Adding the Coin Counter UI to the Player Screen
    16. Timers
    17. Exercise 15.06: Adding the Potion Power-Up Behavior to the Player
    18. Activity 15.03: Creating the Potion Power-Up Actor
    19. Exercise 15.07: Creating the Brick Class
    20. Exercise 15.08: Adding the Brick Class C plus plus Logic
    21. Summary
  18. 16. Multiplayer Basics
    1. Introduction
    2. Multiplayer Basics
    3. Servers
    4. Dedicated Server
    5. The Listen Server
    6. Clients
    7. Exercise 16.01: Testing the Third Person Template in Multiplayer
    8. The Packaged Version
    9. Connections and Ownership
    10. Roles
    11. Exercise 16.02: Implementing Ownership and Roles
    12. The Server Window
    13. Server Character
    14. Client 1 Character
    15. The OwnershipTest Actor
    16. The Client 1 Window
    17. Variable Replication
    18. Replicated Variables
    19. Exercise 16.03: Replicating Variables Using Replicated, RepNotify, DOREPLIFETIME, and DOREPLIFETIME_CONDITION
    20. The Server Window
    21. The Client 1 Window
    22. 2D Blend Spaces
    23. Exercise 16.04: Creating a Movement 2D Blend Space
    24. Transform (Modify) Bone
    25. Exercise 16.05: Creating a Character That Looks up and down
    26. Activity 16.01: Creating a Character for the Multiplayer FPS Project
    27. Summary
  19. 17. Remote Procedure Calls
    1. Introduction
    2. Remote Procedure Calls
    3. Server RPC
    4. Declaration
    5. Execution
    6. Valid Connection
    7. Multicast RPC
    8. Declaration
    9. Execution
    10. Client RPC
    11. Declaration
    12. Execution
    13. Important Considerations When Using RPCs
    14. Exercise 17.01: Using Remote Procedure Calls
    15. Enumerations
    16. TEnumAsByte
    17. UMETA
    18. DisplayName
    19. Hidden
    20. BlueprintType
    21. MAX
    22. Exercise 17.02: Using C plus plus Enumerations in the Unreal Engine 4 Editor
    23. Bi-Directional Circular Array Indexing
    24. Exercise 17.03: Using Bi-Directional Circular Array Indexing to Cycle between an Enumeration
    25. Activity 17.01: Adding Weapons and Ammo to the Multiplayer FPS Game
    26. Summary
  20. 18. Gameplay Framework Classes in Multiplayer
    1. Introduction
    2. Gameplay Framework Classes in Multiplayer
    3. Exercise 18.01: Displaying the Gameplay Framework Instance Values
    4. The Server Window
    5. Server Character
    6. Client 1 Character
    7. The Client 1 Window
    8. Client 1 Character
    9. Server Character
    10. Game Mode, Player State, and Game State
    11. Game Mode
    12. Constructor
    13. Player State
    14. Game State
    15. Useful Built-in Functionality
    16. Exercise 18.02: Making a Simple Multiplayer Pickup Game
    17. Activity 18.01: Adding Death, Respawn, Scoreboard, Kill Limit, and Pickups to the Multiplayer FPS Game
    18. Summary
13.59.36.203