41,99 €
An example-based practical guide to get you up and running with Unreal Engine 4.X
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!
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.
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.
Sie lesen das E-Book in den Legimi-Apps auf:
Seitenzahl: 688
Veröffentlichungsjahr: 2016
Copyright © 2016 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: July 2016
Production reference: 1260716
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78588-553-2
www.packtpub.com
Author
Benjamin Carnall
Reviewer
Matt Matte
Commissioning Editor
Amarabha Banerjee
Acquisition Editor
Reshma Raman
Content Development Editor
Parshva Sheth
Technical Editor
Gebin George
Copy Editor
Joanna McMahon
Project Coordinator
Ritika Manoj
Proofreader
Safis Editing
Indexer
Tejal Daruwale Soni
Graphics
Abhinash Sahu
Production Coordinator
Aparna Bhagat
Benjamin Carnall is an enthusiastic and dedicated programmer whose love for problem solving led him to the world of game development. He relishes opportunities to learn new and interesting ways to create gameplay experiences for others. Ben began his journey with Game Development in 2012, after he graduated from Media Design School with a diploma in interactive gaming. He then went on to graduate from the same university with a bachelors of software engineering in 2014. Since then, Ben has immersed himself in the Game Development community of New Zealand—starting out as a programming contractor and working on various titles around Auckland. He then began to work as a lecturer at Media Design School and taught Graphics programming for games, Physics programming for games, and Sony PlayStation development at the bachelors level. Most recently, Ben has been working as a programmer for the studio Aroura44, developing a title called Ashen.
I would like to thank so many people for supporting me during the authoring of this book. Thanks to the wonderful people around me, I remained fed and happy while endeavoring to put into words the jumble of information that knocks around in my head.
Thank you to my parents for making sure I stayed healthy and well fed. Thank you to my lovely Emily, for keeping my morals high and my smile wide. Thanks to the team at Epic for making such an awesome engine! Without them I would not be writing this now. Thanks to my editor, Parshva Sheth, for working through this with me, we made it! And finally, I'd like to thank you, the reader, for taking a chance with this book and for jumping into the world of game development!
Matt Matte is the founder of Full Metal Jacket Games, and he was recently featured on Unreal Engine's Spotlight Projects section with their Tron- inspired VR game. Matt is the official Seattle Unreal Engine Rep and the organizer of the largest Unreal Engine Meetup in the world, with over 800 members. He's published three games with Unreal Engine. The latest game released in August 2016 is Monkey Land 3D: Reaper Rush.
Matt has over 10 years of experience in Unreal Engine, starting with building mods in the Unreal Engine 3 editor and then moving on to UDK and UE4 to build completely original titles. He's an expert Unreal developer and technical artist that specializes in setting up characters, both controlled by a player and Artificial Intelligence, including rigging and creating animations, setting up physics with the PHAT editor, animation blueprints, and blending, AI behavior trees, and synchronized special effects. He's created games with Blueprints only and a hybrid of both C++ and Blueprints.
His primary focus is on virtual reality games. F.M.J. Games has won two Seattle VR Hackathons for best graphics and experience. They also won the Peoples Choice Award for NASA's 2015 Space Apps Challenge, all with UE4 and its powerful real-time rendering. They've been awarded new VR hardware by Epic, Oculus, and Valve for their accomplishments in VR design.
Matt has reviewed the blueprints and code in this book and tested that they work and are fully functional. Contact Matt through www.fmjgames.com for anything Unreal Engine game development related.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at <[email protected]> for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.
Unreal Engine 4 is a cutting-edge game development engine that has revolutionized the way developers pay for engine licenses. Instead of forking out millions of dollars to access this first class engine, developers can use it completely free of charge, until they find themselves with a profitable product on their hands.
Unreal Engine 4 provides a rich AAA development toolset with cutting-edge technical features to anyone who is keen to develop great games. The engine has been developed in C++, and not only are we able to leverage the power of C++ for our projects, but we also have access to the entire engine source! This book will start you on your journey toward mastering UE4's toolset and becoming a proficient C++ UE4 developer!
Chapter 1, Introduction to Unreal Engine 4, takes you through the installation of UE4, creating new UE4 projects, and an introductory overview of the main engine editor.
Chapter 2, Blueprints and Barrels – Your First Game, introduces you to the world of Blueprint Visual Scripting. You will leverage the Blueprint system of UE4 to create your first UE4 game project, called Barrel Hopper.
Chapter 3, Advanced Blueprint, Animation, and Sound, covers some of the more advanced Blueprint concepts, and it also concludes the development of the Barrel Hopper project by showing you how to include animation and sound in your projects.
Chapter 4, Unreal Engine, C++, and You, introduces you to the concepts and syntax that will be encountered when working with C++ and Unreal Engine 4.
Chapter 5, Upgrade Activated – Making Bounty Dash with C++, will expand on your knowledge of C++ with UE4, by taking you through the development of a purely C++ implemented game project!
Chapter 6, Power Ups for Your Character, Power Ups for the User, guides you in creating a UE4 C++ plugin, and it also introduces you to some advanced UE4 C++ concepts. This chapter concludes the development of Bounty Dash!
Chapter 7, Boss Mode Activated – Unreal Robots, will introduce you to UE4's extensive AI toolset by taking you through the creation of the Boss Mode game project.
Chapter 8, Advanced AI and Unreal Rendering, covers some of the advanced concepts of UE4's AI system; it will also introduce you to UE4's material editor and rendering system!
Chapter 9, Creating a Networked Shooter, breaks down and explains all the networking systems included in UE4. This chapter will have you create your own networked First Person Shooter, which you will be able to play over LAN with your friends.
Chapter 10, Goodbyes and Thank yous, will show you how to package your project for distribution and testing, and it also covers a brief summary of what has been learned before concluding the book!
Unreal Engine by Example was written for keen developers who wished to learn how to fully utilize 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 this engine with C++. Experience in 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 make a complete game development novice into an Unreal Engine developer!
In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "It is now time for the famous Hello World."
A block of code is set as follows:
New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Then create a new Blackboard asset from the same category."
Warnings or important notes appear in a box like this.
Tips and tricks appear like this.
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.
To send us general feedback, simply e-mail <[email protected]>, and mention the book's title in the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
You can download the example code files for this book 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 files e-mailed directly to you.
You can download the code files by following these steps:
You can also download the code files by clicking on the Code Files button on the book's webpage at the Packt Publishing website. This page can be accessed by entering the book's name in the Search box. Please note that you need to be logged in to your Packt account.
Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:
The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Unreal-Engine-4X-By-Example. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/downloads/UnrealEngine4XByExample_ColoredImages.pdf.
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.
To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.
Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]> with a link to the suspected pirated material.
We appreciate your help in protecting our authors and our ability to bring you valuable content.
If you have a problem with any aspect of this book, you can contact us at <[email protected]>, and we will do our best to address the problem.
Welcome to Unreal Engine 4 by Example! During the course of this book you are going to learn how to utilize Unreal Engine 4 (UE4) to create high-quality games using C++. This chapter will show you how to install the engine, introduce you to the engine's User Interface (UI), show you how to create new projects, and give you a rundown of what to expect from this book. The purpose of this chapter is to give you a general idea of how this book will be formatted and how to get the most out of your Unreal Engine 4 by Example experience.
The chapter will cover the following points:
First off, it should be stated that the use of C++ features heavily in the later stages of this book. It is strongly advised that you already have some experience with writing in C++ or a similar low-level language before embarking on this journey.
This is a By Example book, meaning that you will be taught how to use UE4 via the breakdown and explanation of previously created UE4 game projects. These projects have been created specifically for this book with your education in mind! Each project will be taught over two chapters, the first will include the core concepts and features needed to implement the title. The second will delve into the advanced or more complicated components of each project. By the end of each project you will have learnt core UE4 functionality plus some very interesting polish techniques.
By the end of this book you should find yourself well on your way to becoming a skilled Unreal Engine developer capable of using C++ and the provided Blueprint system to utilize Unreal Engine's rich feature set to create polished game titles.
Yes, game projects! By the end of this book you will have created four unique game projects that will all include their own polish features. These projects culminate with the creation of your very own multiplayer first-person shooter!
During the course of this book you will create the following game projects:
The version of Unreal Engine we will be using for this book is Unreal Engine 4.11.0. You may use any 4.11.# engine version as long as your version number exists within the 4.11 family. If you have already installed Unreal Engine 4.11 you can skip this section and jump straight to Creating your first project. First things first, you need to sign up as an Unreal Engine developer. Navigate to https://www.unrealengine.com in your browser and select the GET UNREAL option located in the top right-hand corner of the web page.
This will then redirect you to the login/sign-up page for a UE account. If you do not have an account, follow the steps presented in the page to create one. This account will integrate you into the Unreal Development community. Through this account you can get Unreal Engine news, updates, and developer support.
Once this is done you will be directed to the downloads page, choose the OS that you will be developing on (MAC, Windows) and you should see the download begin for an Epic Games Launcher installer. The Epic Game Launcher is the portal for all Unreal Engine versions and you will use this application to install, manage, and launch the engine version you wish to use.
Once the Epic Games Launcher has been successfully installed, run it and it will prompt you to log in with the account credentials you previously set up with Epic. If everything has gone according to plan you should be presented with the Unreal Engine launcher. From the launcher you will need to navigate to the Unreal Engine tab located in the top left-hand side of the window. From here you can see News, Learning Resources, and Marketplace Content for the engine. I advise you to take your time to explore each of the options available to you, however we will be focusing on the Library section.
By selecting the Library element on the list on the left-hand side of the window you will be presented with any currently installed engines as well as any Unreal projects you have already created. There will be an Add Versions button near the top of the window.
Pressing this button will present you with a light-colored engine node, click the drop-down arrow next to the engine version number and be sure to select 4.11.0. Once this is done, hit Install. The launcher will now handle downloading and installing your new engine version!
While the engine is installing I would strongly suggest you spend some time exploring https://www.unrealengine.com. The website is a great place to find video tutorials, learning resources, and the Unreal Engine Wiki. You do not need to utilize these resources to follow this book, however the content they have provided is very informative and will definitely help you on your journey to becoming a proficient Unreal Engine developer. Once the engine has been installed, hit Launch and you are ready to go!
Tip: If you hit the drop-down arrow next to launch you can create a shortcut for the engine version.
It is now time for the famous Hello World, but this time it will be Hello Unreal. With your engine version launched you will be presented with the Unreal Project Browser. This browser features two tabs, Projects and New Project, select New Project. The first thing you can see in this tab is a large selection of icons under two more tabs, Blueprint and C++. We will be selecting the Blueprint tab and we will be creating a Blank project, your selection should appear as follows:
Under this section you will see three dropdown boxes titled Desktop / Console, Maximum Quality, and With Starter Content. We will leave these as they are for now but this is where you can swap your target platform for the project, change the graphics quality, and whether or not you would like to use the starter content provided by Epic. Below these options you will see fields to populate the directory where you wish to create the project and what the name of the project will be. We shall title this project Hello Unreal. Once this is done, click the green Create Project button and the engine will finally launch.
Welcome to the Unreal Engine User Interface! It can be a bit overwhelming at first but, fear not, all will be explained. By the end of this book you will be very familiar with the layout and workings of this engine view. Now, for the sake of brevity, I will hand your Unreal education over to the Epic team for a short moment. In the top right-hand corner of the window next to the name of the project you should see a grey academia cap flashing green.
Clicking this cap will start a short tutorial that will familiarize you with the engine's layouts and panels. I am leaving this up to Unreal as the introductory tutorials are succinct and efficient at bringing you up to scratch with the editor layout and camera controls. This gives us more time to get to the juicy learning!
Once you have completed this introductory tutorial you will be guided to the tutorial home panel. Here you will be able to find a list of simple tutorials that will help familiarize you with the different features of the engine, could you please complete the two tutorials under the Basics category. Feel free to utilize the other tutorials during the course of the book. I will likely be covering almost all of the topics covered in the tutorials but they may prove useful as an additional learning resource. Now that Epic has taught you how to view its engine, it is now time to teach you how to use the engine!
At this point you should have a world that looks similar to this:
What we are going to do now is remove the table, statue, and chairs from our level and replace them with our own actor. The purpose of this is to show you how we can create new actors and add components from within the editor without having to navigate to other areas of the engine. You can remove actors by clicking on them and hitting the Delete key, right-clicking on them and selecting Edit | Delete from the dropdown menu, or by finding the actor in the World Outliner and performing the same steps.
Once the table and chairs have been removed, we need to add an actor to the world that we wish to build upon. To do this we need to place an element from the Modes Panel in the top left-hand side of the window. As stated in the introductory tutorial, the Modes Panel is where you can find all of the tools that you will need to perform construction actions within the editor. The five tabs you can interact with are Place, Paint, Landscape, Foliage, and Geometry Editing.
These options will be explored during the course of this book but, for now, we are concerned with the Place tab. The Place tab is where you can find all of the editor objects that can be dragged and dropped into the level. Here you can find things such as basic geometry primitives, BSPs, visual effects, and numerous processing volumes.
If you wish to see detailed documentation for each of the editor objects, click the small question mark on the right-hand side of the object name.
From the list on the left-hand side of the panel, select Basic; this will show you a selection of simple objects that can be dragged into the world. We want to drag an Empty Actor into the world.
Unreal Engine utilizes a specific naming convention for the objects that can be created and built upon within the editor. There are Objects, Actors, Pawns, and Characters. Each name represents an expanded level of functionality. In general, you can think of Actors as whole items or entities such as a power up or boost pad, where an object is usually a small part or Component with specialized functionality. For example, a whole car could be an Actor but the engine within the car would be considered an Object. Pawns and Characters I will detail in later chapters. The term object(s) will be used to refer to things in our levels but when required I will use the capitalized Actor or Object when specification is required.
Select our new actor now by clicking on it within the viewport. With the Empty Actor selected in our world we are presented with a few new visual elements. The first is the transform widget; the transform widget provides us with the ability to translate, rotate, and scale objects within our world. You can swap the functionality of your transform widget by pressing the W key for translation, the E key for rotation, and the R key for scale. Alternatively, in the top right-hand side of the Viewport panel you can click and select the appropriate transform icon. We can also select the globe icon in the same corner to swap between world and local space transformation. Simply put, world space transformation will present a transform axis in line with the world. Local space will present a transform axis in line with the object (based on the objects arbitrary forward).
If you are ever curious to see the world space axis, it can be found in the bottom left-hand side of the screen, denoted by a simple line widget. This can be used to orient yourself while using the 3D camera/building levels.
You will notice that, if you try to scale or rotate the empty actor, nothing happens. That is because, at this point, the empty actor only contains a DefaultSceneRoot component. A component is an Object that is owned by other Unreal Engine 4 objects (usually Actors, Pawns, or Characters) that provide different functionalities/features to the object. In this case our actor owns a DefaultSceneRoot component allowing us to translate, rotate, and scale the object.
Why then does scaling and rotating do nothing? Well, right now we have no 'visual' components included in our actor and by that I mean any components that contain geometry that will visually represent the object in the game world. Without a visual reference, the orientation or size of the empty actor has no context, only the location of the object in 3D space could be of any use, thus we have the ability to translate.
This brings me to the second visual element; on the right-hand side of the window is the Details panel. This panel is used to show all information about any selected object within our world. From the Details panel we can manipulate exposed member data, add and remove components, and edit component properties. There are a few other tricks the Details panel offers us but I will expand upon those later on in the book.
You can also change the name of objects in the details panel. Right now our object is called Actor, we should change this to a more specific name, let's use Hello Sphere. Now we need to add a visual reference to our Hello Sphere. Under the Details panel you can see a green Add Component button; clicking this button will bring up a list of pre-built components we can add to our actor. We would like to add a Sphere to our actor, it can be found under the Basic Shapes section of the dropdown. You can either use the search bar provided to find specific components or scroll down the list until you find what you require.
Once you have added the sphere mesh to our Hello Sphere actor you will see a new element in the Details Panel, component hierarchy. We still have our DefaultSceneRoot component but now, directly under it, we have our sphere mesh. This brings up a very important point: Component parenting.
Within the Details panel you will notice that the sphere mesh component is indented slightly and directly beneath our DefaultSceneRoot component.
This is called parenting; our sphere mesh is now a child component of our DefaultSceneRoot component. This means that any scaling, rotation, or translation we apply to our DefaultSceneRoot will be applied to our sphere as well. However, any transformations we enact on our sphere mesh will not be applied to our DefaultSceneRoot. You can change the hierarchy of an object's components by clicking and dragging them up and down the list. The top-most component will be the Root Component and will dictate the transform of all subsequent components.
Ignoring this can lead to disjointing of child components and can be fairly troublesome. I encourage you to now translate the Hello Sphere with the Sphere component selected in the details panel, then again with the DefaultSceneRoot component selected instead. You will notice that, upon the second translation, the Sphere Mesh maintains its relative distance from the location of the DefaultSceneRoot component. It is because of this that I would strongly advise to only apply transformations to child objects when you wish those transformations to remain constant, relative to the parent.
If you wish to move everything within an object instance you may select the ObjectName (Instance) element within the hierarchy.
Now translate the Hello Sphere to the same location that the table and chairs originally occupied. We are going to add some Flash to our Hello Sphere. We are going to add two more components to the actor; a Text Render component and a Particle System component. We will then use the Details panel to modify the properties of these components to achieve our desired visual result.
First, let's modify the text. After adding a Text Render component, select it in the component hierarchy. You will see that the bottom section of the Details panel will change. This section is where you can modify the component's properties. You will notice that you can also get access to the component's transform properties here, this is so you can perform exact transformation changes to an object without having to use the transform widget.
Underneath the Transform and Materials sections we will see a section titled Text. It is here that the main properties for our Text Render component exist. The first thing we need to do is change the text so it says something meaningful. Let's change the Text field to Hello World then change the Horizontal Alignment field to Center.
Your Text section of the details panel should look something like this:
Unfortunately the 3D text is partially penetrating the sphere mesh. To fix this we will be applying a translation to the Text Render component. We wish to apply this translation to the Text Render child component as we want this translation to remain the same regardless of the position of our actor. Instead of using the widget we can use the Transform section of the Details panel. You will notice a 3x3 field matrix under the Transform section. The top row represents the location of the component in 3D space, the second row the rotation, and the bottom row the scale. We want to move our 3D text vertically by a small amount and reduce the scale of our sphere so that our text sits above our sphere mesh.
3D game engines will use an arbitrary 3D co-ordinate system to accurately gauge the transformation of objects in 3D space. These co-ordinate systems are made up of three axis—X, Y, and Z. We gauge the direction of the co-ordinate axis by the direction in which the axis increases in a positive manner.
To better understand how axis work, we will take your position as a developer as a reference. If you were to see your own Unreal axis set, you would see a red axis (the X axis) extend outwards from your chest towards the screen. This is because the X axis in Unreal Engine increases in a positive manner forwards into the screen. In a similar fashion you would see a green axis extend out of your right-hand side (the Y axis), and finally you would have a blue axis extending upwards from your head (the Z axis). As an example, imagine the chair in the following screenshot is the chair you are sitting in:
We need to translate the text component 30cm positively along the Z axis. To do this, ensure that you have the Text Render component selected in the component hierarchy and simply change the third field in the top row of the Transform section of the Details panel to 30.0. However, our text render component is still intersecting with the sphere, we now need to scale down or shrink our sphere mesh component.
To scale down the sphere, make sure the Sphere Mesh component is selected in the component hierarchy, then press R to bring up the Scale Transform widget. You'll notice, as you hover your mouse over the different sections of the widget, that they will change to a yellow color. This means that if you were to press and hold the left mouse button, any movement of the mouse will result in a scale change on that axis. To scale the sphere along all axis uniformly, there is a small white box in the widget where all the axis meet. If your mouse is situated over this box, all of the axis will change to a yellow color. With this white box selected, click and drag the mouse to scale the sphere to half the size it was before. Or, alternatively, change all of the values in the bottom row of the transform matrix to 0.5.
This will move our text render component up and out of our smaller sphere mesh, resulting in something that looks like this:
Our little sphere has come a long way, however we need to add something to our actor to make it stand out. This brings our other new component into focus, the Particle system. Particle systems are components that allow us to attach previously created particle effects to our actors. The creation of these particle effects and a more in-depth description will be detailed in the Boss Mode Activated chapter.
For now, we can use the new component's Details panel to modify which particle effect we would like to use and how it is transformed. With the Particle System component selected in the hierarchy, select the Template dropdown field in the Particles section and select P_Fire. This will use the P_Fire particle system template for the particle component. You may notice that the particle system is quite large initially; I scaled the system to about 1/3 of the original size. You can do this by using the scale widget or the transform field in the Details panel with the particle system component selected.
We are not done yet, Unreal Engine boasts a very flexible and feature-rich renderer. One of the most commonly used features is theMaterial system. Materials are pre-built visual effects we would like to apply to our surfaces. Materials encompass all surface details such as textures, color, and physical properties such as roughness and luminescence. The creation of Materials along with an in-depth description is covered in the Boss Mode Activated chapter. For now we can use a pre-made material for our Sphere Mesh. With the Sphere mesh component selected, click the dropdown field under the Materials section of the Details panel. Search in the list for M_Metal_Burnished_Steel. You'll notice that when the material is selected, the appearance of the sphere will change. You now see something similar to this:
And that is it! We are done setting up our game world for the Hello World project. Now you can click the large play button in the Toolbar at the top of the Editor window and fly around your new game world! You will notice at the top of the screen there are a few options, these in-editor play options will be explained in the next chapter Blueprints and Barrels. Congratulations on making your first Unreal Engine project Hello Unreal! All of the concepts presented in this project will be expanded on in much more detail in the following chapters. What you have learned here is only the beginning; there are many more interesting features and techniques yet to come.
Now that you are comfortable creating and modifying your own projects, it is important to learn how to interact with the Unreal Learning tools to download pre-built projects so you may learn from other people's work.
Epic releases example projects that you can navigate and explore to learn about the different faces of the engine. If you open the Epic Games Launcher application and return to the Unreal Engine tab, you will notice in the list on the left-hand side of the screen a Learn element. Selecting this element will open up the Learn page of the Epic Game Launcher. From this page you can get access the engine documentation, video tutorials, community wiki and, most importantly, the example projects. If you scroll down, you will see a section titled Engine Feature Samples. This section holds all of the example projects that you can download to see how Epic Games implements the different feature sets of the Unreal Engine. The one in particular I would like to draw your attention to is the Content Examples project.
The Content Examples project features a set of levels that demonstrate the use of many of the Engine's features. If at any point the uses of the Engine's components seem unclear, you may be able to find an example of that component's implementation in this project. Once the project has been downloaded it will appear in the Library section of the Unreal Engine tab.
Well done on taking your first steps towards becoming an Unreal Engine developer! I hope you look forward to learning from this book and continuing your game development adventures with Unreal Engine 4. In this chapter you have learned how to install the engine, navigate its unique interface, and you have made your first Unreal Actor! The next chapter Barrels and Blueprints will expand on the skills you just have learned to create your first UE4 game project! You will be recreating a version of the classic arcade game Donkey Kong©. The chapter will have you learn more about interfacing with the engine editor, how to create a workflow with Unreal Engine, and how to work with the Blueprint visual scripting system.
Welcome to Blueprints andBarrels! During this chapter, you will be introduced to the visual scripting system called Blueprint. This system will be your first entry point toward creating customized functionality and content, using UE4. This chapter will show you the basics of how to create and work with Blueprints to achieve the same level of freedom that any other text based scripting language can provide. You will also expand on the engine navigational skills you learned in the previous chapter as we delve into the more complicated facets of the Editor panel and how you can communicate between the different components of the engine. You will learn all this by creating your very first UE game project, Barrel Hopper.
This chapter will cover the following points:
Now, it is time to create your first Blueprint. Instead of jumping straight into a new project, I can't think of a better place to create your first Blueprint than our Hello World project. It is time to give our Hello Sphere an upgrade! The first thing we need to do is create a Blueprint from our actor. To do this, we need to select the HelloSphere actor by clicking on the Actor in the viewport or selecting the HelloSphere name in the World Outlier. This will populate our Details Panel with the appropriate options. Just next to the Add Component button, there is a Blueprint/Add Script button, click on this now:
You will be prompted to save the Blueprint we are about to create in some folder within our Content Browser. For now, save the blueprint in the Content folder directly. Name this Bluerpint HelloUnrealBP and press the green Create Blueprint button.
You will have been presented with an entirely new window, the Blueprint window. This will be your work area whenever you are editing or creating Blueprints. The Blueprint window boasts a new layout of panels and visual sections:
When creating Blueprints, you are frequently going to want to test your recent changes and additional functions as intended. You will also want to make sure that you have minimal errors, warnings, or bugs. The way you will do this is by interfacing with the previously mentioned Toolbar. The buttons featured on the Toolbar allow you to perform varying actions that assist with having your Blueprint execute in a test environment. Each button performs the follows:
All of these options provide you the ability to debug and run your Blueprints while working on them in your project.
Once you are familiar with the engine and you no longer need the tabs describing the title of each panel. You can right-click on the tab and select the Hide Tab option, so you can maximize available screen space.
Each Blueprint will include and be composed of certain elements, these elements can be found under the My Blueprint panel. Each of these elements will be used by you to create the custom functionality that you require from your Blueprint.
Blueprint Graphs are the canvas with which you work to create blueprint functionality. It is within these graphs that you will place and connect your Blueprint nodes. Event Graphs house the Events that will be fired during a Blueprint's application lifetime. These events can be things like the Tick event that will be called every frame or the ActorBeginOverlap event that will be called when the Blueprint object is overlapping another. Blueprint functions and Macros will also be constructed using the graph system; however, these graphs will be independent.
Blueprint functions are a means of wrapping frequently used functionality or functionality that you wish to expose to other objects These functions act in a very similar way to standard C++ functions. You may also specify an encapsulation level when working with Blueprint functions (public, protected, and private). Blueprint functions allow you to specify both input and return parameters.
Similar to functions but are only internally facing, meaning that they can only be called from within the Blueprint itself. Macros are predominantly used for grouping sets of simple instructions that will be called very frequently. The major difference between Blueprint functions and Blueprint macros is that macros are inlined when the Blueprint is compiled. As UE4 is a C++ based engine, all blueprints are eventually compiled down into generated C++ that can be then again compiled into executable binary. When I state that the Macros are inlined, I am speaking of traditional C++ inlining to the macro function itself it its generated C++ form.
Blueprint variables allow you to create data types that can store information. These variables are very similar to Class Member Variables in C++. You can specify an encapsulation level and default values for Blueprint variables. It is also important to note that, for every component included in a blueprint, there will be a corresponding variable that will act as a reference to the component. This allows you to access components form within your blueprint graphs.
Event dispatchers allow you to bind events to one another. For example, if you wanted some functionality to
