SlideShare a Scribd company logo
1 of 85
The world’s your oyster.uasset
Introduction 1.0
Hi, welcome to my UE4 notes starting from the the beta version, ‘Rocket’, now available to all from Epic Games.
This is not a textbook. It is a personal log of learning UE4 that I hope will also help others. I’m trying to be systematic
in terms of keeping a clear and consistent presentation style but the topics are more blog-like and pretty much follow
whatever occurred to me, with a little housekeeping if the googledocs application allows it. This document was made
with GoogleDocs and some formatting may shift depending on the view mode you choose. I aim to balance it for Full
Screen.
How I format things
Names of files, asset names or user entered text will be in Italics, like this: YourFileName.umap
Hotkeys will also be in italics.
Names of editor keywords or key concepts will be in bold, like this: Look in Edit > Settings > Hotkeys.
Weblinks look like this: http://forums.epicgames.com/forums/366-UDK
Comments I added after filling up a whole page look like this and should be found in the margins:
To make future editing easier, no series of steps will be numbered or bulleted Code will be formatted as shown next..
Introduction 1.1
Code in UDK is a little different to unrealscript in that it’s C++ through and through. Also there’s a sort of markup syntax
for Slate (UI) designers that looks quite different and I’m not sure I can recreate it here the way it’s done on the UDN.
For in-line code like this TAttribute<T> I’ll use Consolas font.
For a block of code, as shown above, settings are:
Color of backdrop in the Text Window will be 255, 245, 205 [Googledocs: set Text Highlight and Text Colour.]
Color of commented text will be 40,80,20
Color of highlighted code, as above will be 255, 0, 0 while normal code will be black.
The code text window is jammed up against the red margin guide.
To learn more about Slate log on to UDN then go here:
https://docs.unrealengine.com/latest/INT/Programming/Slate/index.html
Epic doesn’t offer a C++ head start so for that go here: Beginning C++ through Game Programming
http://www.doc.ic.ac.uk/~af909/Beginning_C++_Game_Programming%5B1%5D.pdf
As I understand this book is freely available, but you may want to buy a copy, or get a book like C++ for Dummies.
http://www.dummies.com/how-to/computers-software/programming/cplusplus.html
TAttribute<T>
// This example of code will do for now
Installing UE4 1.0
UE4 installs easy enough, like UE3 … An important difference you’ll notice VStudio 2015 Express is heavily supported
via the full source code being available on github. See the Zak Parrish video on how to set up that. You will need a
subscriber account for UE4 and a github account and to register VStudio via a Microsoft account. The editor can be
launched from within VStudio after the solution is loaded, by pressing F5. You can then load Sample Content via the
Launcher after login, or start a new project based on various templates such as Top Down C++ or Top Down Blueprint.
UE4 has a launcher but can also open straight into whatever project was active last time, into the map (or scene) active
last time in that project. This can be changed in the settings. You can revert changed settings using the yellow icon
Reset to Default. Typically values in properties fields that are not the defaults are emphasised in bold.
You can switch projects by choosing File > Recent Projects (a fly out with radio buttons showing what’s currently
active). If you begin a new map it will exist within the scope of the current project. For instance, you might have a
launcher.umap and a mainlevel.umap and a bonuslevel.umap. Note that .udk map files are now called .umap files.
If you begin a new project, you must establish a folder location for it and the editor will create certain folders within it.
Day 1 - Resolution
Those familiar with UE3 will notice the the package file (.upk) is now called an asset (.uasset). Old packages can’t be
imported as such, but you can bring over the asset contents, like meshes and textures. You cannot import a given
.uasset from within the editor, you have to first place them into the Project folder somewhere then restart the editor to
refresh its library.
becomes
Likewise, if you create a new map (MyLevel.umap
replaces MyLevel.udk), you will notice that if you save
to a new folder, say Custom, the folder won’t show in the editor
under Game in the content browser till next time you
fire up the editor.
But you can create folders for assets internally, which show
up straight away.
Getting Started 1.0
Getting Started 1.1
To create a new project choose File > New Project.
A template pops up with preset gametype frameworks such as the following:
Once you create a new project the editor will close and relaunch itself.
I have not used the C++ variants. I use (Blueprints only) which assumes you either don’t know how to code or that
your project and all its map feature content where custom C++ code is not required. Blueprints are a bit like visually
scripted class files:
Level blueprint (the scene eventgraph, variables and defaults). This is a lot like the Main kismet in UE3.
Actor or class blueprint (per actor blueprints, a lot like custom prefabs including Kismet snippets in UE3)
Getting Started 1.2
The Content Browser is more compact than in UE3. There is now also a more prominent Scene browser (the Scene
Outliner) which is a lot like the Outliner in Maya.
G
The marked icon shows the folder structure of the project. Custom content should go into the Developer section.
The icon above New also reveals the folder structure.
The icon creates new assets internally. It’s a flyout, so don’t click-release on it or you’ll create more or less a
random result. Instead, click-hold and choose from the pop-up list. Get in the habit of using the Search field in the
editor; in this version of the editor this really pays off, with intelligent suggestions in every case where you use a search
field.
Getting Started 1.3
A welcome addition to UE4 that’s not in UDK is the ability to name instances of assets (actors) placed in the level via
the new Scene Outliner. It is also now possible to drag and drop assets onto each other to attach them in a hierarchy.
This is akin to the old Properties - Lock - Assign version of making attachments, which was clunky. To reverse an
attachment via the Scene Outliner, RMB on the attached actor and choose Detach. These attachments can be
changed during a game.
In UDK Kismet to detach an attached actor you could use Attach to
Actor with a ‘Detach’ tickbox turned on in its properties, but this
was potentially visually misleading. In UE4 there is a specific
Detach Actor from Actor function, which can be used to
detach attached actors even if that was done via the Outliner.
For eventgraph attachments, use an Attach Actor to Actor (this
function is akin to the Attach to Actor action in UDK). Functions
need to be fired by an event like ReceiveBeginPlay (akin to Player
Spawned in UDK). Assign the variables by selecting a relevant
actor in the scene then choosing RMB > Add Reference To … from the eventgraph menu.
Getting Started 1.4
Like Maya, the editor now offers a Scene Outliner useful to locate actors placed in the level. This has a Search field.
It will quickly become apparent that users can now drag and drop panels in the UI so they stack together or tab
together.
You can drag the edges of panels and viewports to resize them, as shown in the image, above right.
You can toggle panels from the Window menu. Note that the Details panel is labelled as Selection Details in the
Window menu.
To save these layout changes, use Window > Save Layout. There is no Saved Layouts browser, however you can
choose Edit > Settings > Editor Preferences > Backup and Reset > Reset UI Layout to restore defaults for the
layout.
Getting Started 1.5
One preference of note that differs from UE3 is that you can assign your own hotkeys to editor commands, such as
PIE.
These settings can be found using Edit > Settings > Keyboard Shortcuts and expanding the appropriate section. In
this version of the editor there are more ways to Play and Simulate gameplay, so it’s a good idea to establish these
hotkeys early and get used to the differences.
Getting Started 1.6
Viewport controls are much like in UE3. LMB drag wanders around, RMB free looks, and both together tracks sideways
or vertically depending on mouse drag direction. Many users will prefer WASD to move and RMB to free look. Q & E
track up and down respectively.
Camera travel speed has 8 settings as opposed to the 4 in UE3; the icon location has changed location and style.
Likewise the movement, rotation and scale snapping tools have changed location to the upper right corner of the UI.
The tilde key ` (the same key as ~ without holding Shift) is still used to swap
World and Local relative Transform mode. In-game it opens the console.
TIP: The ` key is also used in unrealscript to preface the logs like `Log(“Boo!”)
but I didn’t check yet how that is done in UE4.
Viewport labels are sleeker than in UE3, having semi-transparent rollout labels, a bit
like 3ds Max. Apart from the UI most of the functionality remains the same as UE3.
In UE3, to lock an actor (freeze its location) you would RMB and choose from the pop
up menu. In UE4, you use the upper left viewport icon and choose
Actor Locking > Selected Actor.
In the new UI look, if you touch the orange triangle in the upper left corner of the view, it
will display a tab, and if you RMB on the produced tab you can choose Hide or Close.
Exposing the tab allows you to nest viewports just like any other panel.
Getting Started 1.7
Cameras, when they are selected, show a cool floating preview of what they see, as shown below:
Notice the selected camera gets an orange highlight. This color can be adjusted or even turned off in Edit > Settings >
Preferences > Viewport Look and Feel if desired. I notice that if the Camera Preview Size value is set below 3.11
then the preview will flash and flicker, which is pretty unpleasant.
TIP: Enable Use Small Tool Bar Icons. Big icons are obtrusive and before long you won’t need that kind of hand
holding.
A common issue for students of UDK is figuring out why they can’t select some actors. They don’t immediately spot
that an actor may have a transparent component in its material settings. The icon for this in UE3 has been removed
and now you have to choose the View Settings icon (the cog eye) rollout and tick Allow Translucent Selection. You
can also press T.
In that top row of icons, we’ll all grow to enjoy the Samples feature which lets you selectively download additional
content, demonstrations that highlight various editor features. These download as .zip filse and once extracted can be
placed in the UE4 projects folder, right next to Engine and Templates, and so on, and they’ll be exposed after editor
restart.
Transforming objects is slightly different than in UE3. In UE3 you had to specifically set a mode for non-uniform scale,
which isn’t the case in UE4. You just drag the axis you want to pull in.
In the Details panel, you’ll find Transform values, much like the Movement properties in UE3. Now you can lock scale
values using a padlock icon to force uniform scale for all directions (alternatively, you can scale using the white center
box on the gizmo with viewport scale snapping enabled and set to an increment that’ll give the value step you’re after).
Spacebar toggles transforms, or you can use the Move, Rotate and Scale icons in the upper left icon tray as in UE3.
For those who like it, in Edit > Settings > Preferences > Level Editing you can still choose Enable Combined
Translate/Rotate Widget, which saves a mouse click or two when laying out objects. This adds an icon to the UI tray
when enabled.
Getting Started 1.8
Tip : In UDK the Home key (or Goto Actor) icon framed
the selected object in the view. In UE4 this has been
replaced by the F key. The object will be centered but
other things may get in between, so use it along with
LMB vertically to zoom to the actor smoothly.
Getting Started 1.9
World Settings display in the Details panel in UE4, much as they take over the Properties panel in UE3 when
exposed. If the Details panel happens to be nested in a tab behind another panel, it won’t jump to the foreground.
Changes to the layout of Game Type, Damage (formerly Zone Info) and Physics are shown below. Note that
MyGame is the default and if expanded shows the assigned Pawn, Replication, HUD, and Controller for that Game
Type.
A Quick Review
UE4 uses Projects, which is a new concept for project organisation that may require some workflow adjustment for
UE3 users. By and large, a project is defined according to its game type (third person vs platformer vs RTS for
example).
The user interface layout of UE4t is highly modular (and darker than UE3). Navigation and display functionality remains
the same, but unsurprisingly you’ll have to spend a short time figuring out where some commands are to be found.
Learning to set certain hotkeys and preferences early will make using the editor a bit nicer.
Editing objects in the scene is much the same as in UE3, apart from the new style of object highlighting and the
transform widgets. Some of the viewport UI icons have been shifted around, but by and large you can access viewport
settings and modes from the top of each viewport.
Most panels include a Search field at the top, which filters while you type. Panels can be dragged around, resized,
arranged in nested tabs or stacked or even turned off. Mostly, control of panels is through the Window menu.
In UE3 a dominant style approach was to expose many settings (like filters in the content browser or icons for the
viewport) whereas in UE4 these have been deferred into roll-down menus. Existing UE3 users may find these changes
to be at first a little weird, but after some exposure to the new methods it should be apparent that most changes do help
get things done faster or take up less space. For example ticked filters from the drop down list are exposed with color
highlights which act as ‘quick filters’ till unticked.
In the default project, the Starter Content, there is a lot less provided content in UE4 than in the UT3 friendly UDK.
This is good for those not wanting to be influenced by UT settings, but can make getting underway in a new project
somewhat daunting. Having said that, you now download a library of sample projects which via the MarketPlace in the
Launcher.
TIP: Learn how the editor works by building simple scenes using the source
content from the Engine folder, but don’t edit the Engine content directly.
Make copies into your own folder.
Getting Used to New Features 2.0
This document is mostly aimed at those who enjoyed using UE3. The actual UDN documentation is growing fast, so
my main motivation is to point out things I struggled with and to suggest a learning path for my students.
Tip: If you want to learn UE4 and don’t read the UDN documentation you’ll likely drown fast, in terms of getting anything
made. Learn to keep UDN handy (bookmarks), and even have it open in your browser while working. You can get
there from the UDK Help > Documentation menu. Do this now! You can also open it by pressing F1.
Make a list of things you already know how to do in UE3 and try to reproduce those in UE4. This will expose to you a
lot of things where change requires some re-learning. It won’t be long before you run into Blueprints, EventGraph, C++,
VIMs, Slate and even provoke some crashes where you try to do things they way you used to do. For example, the
Convert > Convert StaticMesh to InterpActor operation, in UE4t’s early beta versions, would crash it. This has been
removed currently, and instead you choose Find in Content Browser (Ctrl + B) then choose Replace With
InterpActor. An important difference to UE3 is that UE4 no longer has a separate Actor Classes catalog. Instead
you’ll find blueprints under Class in the Content Browser, and also a Tools menu with many new object presets,
including geometry great for grey-boxing (besides BSP).
Getting Used to New Features 2.1
This shot shows my first ten minute stab at a scene in UE4 made from Engine base meshes only (with the Third Person
project). Everything has a default material. So this is just transforms and cloning - ten minutes just to get used to that
here.
Note: the third person camera default goes through walls indiscriminately. Unbuilt objects tend to go black.
[Edit: I’m informed on the forum that if you add a second UV channel in the mesh editor for a given asset and choose
Generate UVs this will solve the black mesh problem, but I haven’t tried it yet].
This comment is out of date, but it matches up to the images: The Sample Content icon from the beta is now replaced
by the MarketPlace in the Launcher, and you can see all kinds of examples to inspect. In the version I’m using the
Launcher seems to be a little wobbly in connecting to the editor.
EventGraph (Blueprints) 3.0
UE3 to UE4 feels to me a lot like going from a down-hill racer cart to a super charged muscle car. In UDK there was Kismet, visual scripting at
the scope of the level (and through Prefabs at the scope of actors). In UE4 the blueprint works at the scope of the actor and is very flexible.
There is also a scene blueprint. The mental jump is to figure out what belongs in the scene scope and what should be passed to an actor. If
actions and events will always affect an actor in a certain way in any level, that should be written into the actor blueprint.
The organisation of a blueprint is like this:
Defaults (properties preset for this type of blueprint, ie Hidden in Game)
Variables (anything defined by name, ie CurrentScore = 5, bAlive = true)
Components (add content to this blueprint, ie = TriggerBox, Mesh, Sprite)
Construction Script (operations that set up and initialize the blueprint when placed as an actor in the game level)
Eventgraph (operations that influence the blueprint during game play)
Click on each tab to switch between those panels. Variables are found in both the Component and Graph views.
Construction Script and Eventgraph are tabbed together in the Graph window.
EventGraph (Blueprints) 3.1
What in UDK is called an action is now called a function in UE4 to closer match the terminology of C++ programmers.
Kismet in UDK has nodes under the actions. The eventgraph in UE4 has nodes down the sides but otherwise things are much
the same in terms of hooking a Target to a Variable.
A big difference is you can give the final value for a target via a chain of operators feeding into a target in the eventgraph function.
In the image, the event is ReceiveTick (time passing in CPU time, not in frames per second). Delta Seconds which feeds Delta
Time is the duration of the last tick, so far as I understand.
In UDK an action called Get Actor Location and Rotation outputs vector variables from an assigned target. In UE4, since the
blueprint is mostly likely referring to itself as an actor placed in the scene (bundled with components like meshes or collision
volumes), the Target defaults to ‘self’.
Blueprints are created and stored like a regular asset in the content browser and placed in the scene like a regular asset. An
asset placed in the scene, including blueprints can be located in the browser using Ctrl+B.
You can then right-click on the browser asset to modify it in the eventgraph editor. Choose Open in Full Editor.
EventGraph (Blueprints) 3.2
Next to ‘self’ in a Target variable you’ll see a circle. It may be colored to indicate what type of variable it accepts. In the example below, there’s
both an unfilled Target [self] and a filled Target linked to a variable Background representing a StaticMeshComponent in the world (as the pop
up info below shows). On the right side of the function there are outputs, which are yellow in this case as they represent vector values. A vector
is an XYZ or RGB value.
What the second side shows is the Location of ‘self’ (the object this blueprint represents) being subtracted from the location of Background,
which is then fed into a Break Vector function. This is equivalent to the Get Vector Components action in UDK Kismet. What it does is let the
flow access any or all of the XYZ values separately so they can be modified further along in another function. In the image, just the Y value is
sent out. The Y value is a Float, represented by a slime green color.
String - Vector - Integer - Float - Object
NB: In UDK an Object variable was purple and a String was green and a Float was dark blue.
You also will come across Rotators, Transforms and XY values.
EventGraph (Blueprints) 3.3
DISPLAYING TEXT ON SCREEN
This example shows how to log an event as a function fired from the eventgraph.
Log was the action to use in UDK. This has been replaced by a function called PrintString.
In the example below we assume a TriggerBox is placed somewhere in the level via RMB > Add Actor > Trigger > Trigger(Box). This will
show up in the Scene Outliner as TriggerBox and that’s how we’ll see it in Kismet naming too.
Select the TriggerBox actor and in the eventgraph RMB and choose Add Event for TriggerBox > Add OnActorBeginOverlap. To get who is
touching it, add a Get Player Pawn function and then add an Equals function and a Branch function. A Branch function is like the Compare
Bool condition in UDK. These can all be found by typing their names in the new Search field (RMB in eventgraph). The PrintString, likewise,
can be searched, and placed as shown. The connections show that if the actor touching the trigger is the pawn then the branch will fire as true,
and do the PrintString. Any other overlapping actor will not fire the branch as true, so nothing would happen in that case.
In the PrintString function itself, the In String is typed by the user Trigger Attached. The default is Hello.
The ticked Print to Screen checkbox allows the text to draw on the screen during gameplay.
The Text Color has been set to 0,0,0 (black). I’m assuming there are config files that determine the default text location.
EventGraph (Blueprints) 3.4
This example is from the samples, for toggling a light. Understanding this may come as an Aha! moment for some, so I explain it below.
Point Light Static 119 is just an actor in the scene, affected here by a Set Brightness function. Each time we press Enter (the InputKey
event), we switch between firing the Flip Flop outputs A and B. Each affects the bool output (is A). It’s set by A to true, and by B to false. The
bool value is converted to a Float value (True = 1, False = 0). The bit that confused me at first is the Subtract function which follows.
If A is true, we subtract the bool 1 from the Subtract node’s value, also 1, which gives us 0 (1-1=0) ... 0 x 500 (the next node is a Multiply
Float) gives us 0, which feeds into the New Brightness of the Set Brightness function, resulting in ... no brightness. Anything times zero is
zero. So A represents lights out.
If B is true, we subtract the bool 0 from the Subtract node’s value of 1, which gives us 1 (1-0=1) ..., 1 x 500 (the Multiply node) gives us 500,
which feeds into the New Brightness of the Set Brightness function, resulting in a pretty bright light intensity.
In Kismet, I wouldn’t have fed both A and B into the same function (or action). I would have had a different Set Float action for each, and
probably a Modify Property for each accordingly. The point here is ‘why use more functions than you need’?
EventGraph (Blueprints) 3.5
CONTINUAL ACTOR ROTATION TO FACE THE PLAYER
On every tick, if the player camera location does not equal 0,0,0 (meaning, if the player is not in the scene) then set the
current actor (a turret) to smoothly rotate till its rotation matches the current ‘look at rotation’ or direction needed to be
facing the player. The ‘current rotation’ is obtained from the Get Actor Rotation calling ‘self’ since this graph goes with
the turret, not in the scene (UDK uses scene based event flow and UE4 can do that, but favours per actor event flow).
EventGraph (Blueprints) 3.6
PARENT / CHILD CLASS EXPLANATION 1/3
This is a brief account of how one blueprint can be established and then a child version of it can inherit what’s in it and add more stuff of their
own the parent doesn’t share. A case would be a goblin template with as many unique goblin variations produced from it as you want. It is a
bit like Parent material > Material Instance Constant in principle, but with blueprints.
1. Create a new class in a Custom folder under Game. Call it MyParent and set up some events as shown below.
Optionally, create a mesh component in the Components panel using the roll down Add Component > Static Mesh and grab one from the
content browser: I used the info mesh: StaticMesh'/Game/Assets/Meshes/SM_TextBox_Icon_Info.SM_TextBox_Icon_Info’.
Whatever components are set in the parent blueprint will be sent into the child blueprint, but you can always override them, turn them off, or
swap in different materials on a mesh or whatnot.
EventGraph (Blueprints) 3.7
PARENT / CHILD CLASS EXPLANATION 2/3
Now we have a parent class, we can create a child of it.
2. In the content browser, RMB on the MyParent blueprint and choose Create blueprint based on this.
3. Call it MyChild and add a BeginPlay event, the right-click on it and choose Add Call to Parent Function. This is the important part … it
gives you the brown Parent: Begin Play node. Add a string to show something happening for the child, as shown below.
4. Place the child in the scene, and see what happens on Play (Alt+P). Mine worked … and thanks to the brown function call, we get both the
string from the parent and, after a 1s delay, the string from the child.
EventGraph (Blueprints) 3.8
PARENT / CHILD CLASS EXPLANATION 3/3
Now we have a parent and child, lets look at changing something set in the parent where it gets inherited within the child.
5. In the EventGraph of the child blueprint MyChild, go to the My Blueprint panel and look for the tickbox Show inherited variables.
By default this is off, and if we turn it on we can see the StaticMesh component reference (if you added one in step 1).
6. Drag the Static Mesh 1 variable
onto the graph and when
prompted choose Get. This lets
us refer to that variable and set it
as the target for a new Set
Material function.
7. For the Set Material function,
just click the textfield entry to pop
up a list of textures available and
choose one you like, or you can
highlight one in the content
browser like in UDK and click the
assign arrow. If you click on the
textfield you not only get a
scrolling list of assets you also get
a search field to filter the list.
8. Play and verify the Info mesh is
actually changing material.
EventGraph (Blueprints) 3.9
EVENT DISPATCHERS AND PARENT / CHILD BLUEPRINTS
Now we have a parent and child let’s look at the Event Dispatcher commands. Event Dispatchers are like Remote Events in UDK. Well, a
bit…
In the parent class MyParent, in the My Blueprint panel, create a new Event Dispatcher, shown below (it might be >> out of view).
Name it Do Stuff and drag it out onto the graph. You’ll see a command list, as shown below:
Call means look up the dispatcher, from wherever we happen to be,
which is cool because we might be in another blueprint entirely.
In the blueprint you made in the last steps called MyParent, drag from
the Do Stuff event dispatcher into the canvas and choose Call.
Hook this up with your Event Begin Play event.
Be sure to compile and save.If you don’t, you won’t see the new
addition in other blueprints.
Open the child blueprint MyChild. Check that
Show inherited variables is ticked. Then
check that Actor > Event Dispatchers
shows Do Stuff.
Drag Do Stuff onto the child blueprint’s graph
and choose Assign. This adds two
connected nodes which are automatically
named, shown below. In the above steps the
Do Stuff dispatcher was called in the parent
as soon as the player touches an added Box
component in the parent blueprint.
Blueprint Interfaces 1.0
An interface is a list of function names and parameters which exist in one spot. Other blueprints can take those and implement them. Don’t
worry what ‘implement’ means ... Essentially the functions exist elsewhere from where they are used in order to save redoing the functions
often.
To create an interface, go to the content browser and RMB and choose Miscellaneous > Blueprint Interface. Call it BPI_MyInterface.
When you open it you’ll only see the +F function icon.
Create a new function called IF_MyFunction (NB: the IF_ stands for Interface Function, not if statement … you could just leave it off).
In the Details section, click on the New button in Inputs, and create two parameters, a bool and an int. Called them IF_INT and IF_BOOL.
These are examples only. Notice these will show up in the function icon in the graph.
How to handle the interface in another blueprint?
Check this out: https://answers.unrealengine.com/questions/4964/how-to-have-blueprints-pass-variables-to-each-othe.html
The broad idea here is you are making a really open functionName (parameterNames){ … }; situation which lots of blueprints can call on.
You can also add Outputs, and this creates a ReturnNode in the graph with
the variable name and a channel to hold a value. Note: I made an output
Integer (shown below) called MyReturnedInt.
This gives us a basic function and a couple of parameters to feed later on.
Creating
Interface
On the left we see the node you can drop into
any blueprint once you’ve compiled and saved
your Blueprint Interface. See how the
MyBOOL and MyINT (with friendly names) are
shown in the node on the left as inputs. And
the output is MyReturnedInt on the right, that I
added to the interface too.
Blueprint Communication 1.0
Without using an interface we can still get blueprints to talk to each other.
The steps are possible to shorten and re-use, but it takes a little while to set up.
1. Make an object variable in Variables that points to the class you want to talk to, or target, for instance MyActor targets MyPlayerController.
2. Initialise the value for the variable … this is a bit of weird process in my opinion, but we’re going to show it over the next few pages.
3. Call a function in the blueprint you’ve targeted using the object variable to look up what’s available there.
In this example we will make a PickMeUp actor blueprint that contains a ball mesh and when we Hit it by running into it with the Pawn, then this
will call a function in the GameMode class blueprint PickUpGameMode (this exists in order to let you establish rules like scoring).
The first step is to create the PickMeUp actor in the content browser. Put it in a new folder under Game.
The second step is to create a mesh component for it and give the component a name (or you could just use StaticMesh1, the default).
Set the Z value to about 48 so it sits on the ground when placed (its Root is still at 0,0,0). I used an Arrow component for the Root component.
Add any material you like in the Rendering panel from the content browser.
Place a number of these around the scene. Keep count of how many there are. Then save the map in your project and save the PickMeUp
actor.
In the same folder, RMB and choose New Blueprint and from the pop up window, choose GameMode. Call this new asset PickUpGameMode.
This is where we will do the calculation and comparison for the player actually picking up the items. In the GameMode Defaults set the Pawn
as MyCharacter, so you have a third person pawn that can collide with things in the scene, not just a floaty default camera.
Once you have created it, open up again PickMeUp actor and in its Graph > My Blueprint panel, click on +V to add a new variable.
Call this GameModeVar in the Details panel and set the Variable Type as Object, looking up PickUpGameMode_C. Make it Editable and
write a Tooltip. That takes care of creating the variable which will allow us to look up any custom event, function, variable from our actor to our
gamemode class.
Blueprint Communication 1.1
The object variable in the PickMeUp blueprint should look like this: Now in the My Blueprint panel click on the +F button to create a
new function. Call the function UpdateGameModeVar, or
something like that. You can see mine in the image on the left.
Double click on it to open it. Use the RMB contextual menu to
add Get All Actors of Class, and in its Actor Class field choose
the blueprint you made called PickUpGameMode, which should
be in the list (if you saved and compiled it before).
From the Out Actors output, which produces an Arrray type,
RMB and choose Get, and connect the Array icon as shown
below.
Be sure to drag from the blue output of Get to look up Cast To
PickUpGameMode … if you just RMB and search for it via the
regular contextual list it won’t be found. Once you have that, drag
GameModeVar from your variables list in My Blueprint and when
you drop it you can choose Set, and hook up the wires as shown
below. What this sequence does is ensure that when we refer to
GameModeVar later it will be populated instead of being ‘None’.
Blueprint Communication 1.2
That function, to really be complete, needs to actually call some function in the PickUpGameMode blueprint. First we have to make it there.
Open up the PickUpGameMode blueprint and make an Integer variable called PickedUpItems. This will store a value for how many items have
been picked up during the game. After that, create a Function called UpdateItemInt. This is what we’ll call in the PickMeUp blueprint.
Here’s the UpdateItemInt function - it’s just incrementing the item count and displaying it on the screen.
Everything in this sequence can be added by
dragging out from the variable Get PickedUpItems.
The + operation is called Integer + Integer.
The one that looks like a dot is a condensed
conversion node To String (Int). But you can add it
automatically just be dragging from the Int variable to
the In String of the Print String node.
Before we go back and call this function, let’s add to
the PickUpGameMode blueprint’s eventgraph the
following loop. What this does is every half a second
compares the value of the int variable
PickedUpItems to 5. So when our function increments
to five, it stops!
Blueprint Communication 1.3
The magic part, so to speak, is just to call the function UpdateItemInt we just made in PickUpGameMode from the actor blueprint PickMeUp.
Everything we set up before should enable this to happen smoothly.
Before, we made the function UpdateGameModeVar in PickMeUp.
To complete it, just drag the GameModeVar variable to the end and choose Get when dropping it.
From the output of the variable, choose Call To Function > UpDate Item Int, which is the function in the PickUpGameMode blueprint.
Set the object variable GameModeVar as the Target of the function call, as shown below (and add a Destroy Actor node to get rid of the
picked up item). The ReturnNode shown is probably optional. It was added for me because I set up all this in the eventgraph and selected the
whole chain and chose Collapse to Function.
Blueprint Communication 1.4
Having done all that, we just need to set up the event for when the player touches the actors in the scene.
In the eventgraph of the PickMeUp blueprint, add a Collision > Hit event (which is a physical impact or collision between two meshes).
The Other output is whatever thing hit the actor. We want to check and make sure that’s the Pawn, so we use a Get Player Pawn, and
compare its Return Value with Other. If they’re the same, the True condition (a local bool) in the Branch executes. If not, nothing happens.
To add the comparison, RMB on the graph and type Object in the field, and you’ll see Equal (Object) in the list, which displays as the == node
Lastly we call the function UpdateGameModeVar, which is what we built before in this blueprint (so Self is the Target). Easy, eh?
When you play you should see logs that display a number incrementing up to 5 and then a final string *** All Done *** when all five actors are
hit.
Using Arrays 1.0
Arrays in Blueprints in UE4 are a lot like Object Lists in Kismet in UDK. So far as I can see, they’ve just updated the nodes to have more C++
sounding titles, as you can see in the image below. Here’s what you can do with a list of actors, or do with the actors in the list:
Create an array - Add items to the array - Remove an item - Clear the entire array - Get the number of items in the array - Check if a specific
item is already in the array - Set an item into a particular index or slot in the array - Resize the array to include only items up to a certain index.
So what’s an example? Let’s say you want to get all the actors of a certain Blueprint (or Class) in the entire scene, or even within a certain
distance of the player, and you want to sequentially hide them. Get All Actors of Class is an event graph node which returns an array filled
with whatever actors that matched.
That’s the easy part. Now you’d need to operate upon each actor in the array until each one was hidden (or whatever you wanted to do) until
the array had been totally hidden. In UDK, the easy way to do this was to use ‘Access Object List’, then ‘Modify Object List’ using Remove.
You’d access each item and hide it and then remove it from the list, and then do the same thing again on whatever items were left. You’d then
use a ‘Compare Int’ against 0 for the total number of items still left in the list, so you’d know to stop looping back through the list when it was
empty.
When you want to affect a lot of things together as a set you
need to use an array.
Using Arrays 1.1
The example we’ll use comes from the UE4 Answers Hub, where someone was asking about toggling on/off a lot of lights with one switch. An example of this
can be found in the Content Examples, but I thought I’d try it myself based on how I’d go about it in UDK, more or less.
It sounds easy to turn on/off lights from a switch. I was surprised by the bulky graphs I ended up with (see previous page). Probably there’s an easier way.
But at least I figured out Arrays in UE4.
What we need to do is make an actor blueprint called MyLamp and an actor blueprint called MySwitch. You’ll also need a custom gamemode and custom
PlayerController blueprint based on the defaults, all of which should be saved in a Custom or YourName folder under Game in the Content Browser, as above.
In my project I don’t have a pawn with a mesh to Hit or Overlap the switch, so I decided to use a distance comparison as a way to tell if we’re at the switch or
not, then make a keystroke event in the PlayerController activate the lights if we’re close enough to the switch.
Why put the input event in PlayerController? Well, input kind of comes from a controller like a keyboard, mouse or joystick or touch screen. Also, the event
being there makes it free to send out to any blueprint you want, as you’ll always have access to the PlayerController in any level.
If you’ve read the previous sections on blueprint communications you’ll remember we set up an object variable, in this case MySwitchVar which represents
the blueprint MySwitch_C, and the above sequence sets up that. Remember to correctly set the object variable properties. Note that in the image we call a
function in MySwitch called SwitchPress. You cannot call it before you’ve added it there of course and the blueprint must be placed in the scene to find any
actors of this type. It’s important to know that the array in question here consists of the obtained MySwitch blueprint actors (out actors) and we Get the entry 0.
0 is the Index of the 1st entry in the array, 1 is the 2nd and so on. That’s just how it is.
Starting steps
Using Arrays 1.2
The MyLamp actor needs a mesh component and a light component. I also added a TextRender component so I could flip the light on and off
and display text for that - you could do a lot of things such as adding sound or changing the color of the switch. I wound up using the text string
in the TextRender component to check for whether or not the light was currently on or off, but a bool could also be used. The default
properties for the PointLlight and TextRender are shown in the image below. You might to add walls around the scene so you can really see
the lights are shining when they are on. Once you have compiled and saved the MyLamp actor, place them as you wish in the level, as many as
you wish.
The MySwitch actor needs a mesh component - I chose a gold pyramid, and put it on the table. Notice that each component is represented by
an object var created for you in the My Blueprint panel so you can reference it in the eventgraph. You can name these yourself.
Using Arrays 1.3
Let’s look at the custom function you’ll next add called SetBrightness for the MyLamp blueprint (which we’ll call from MySwitch).
SetBrightness will either brighten or dim the light via a Branch (hold b and click). The condition for the branch could be based on the
brightness value, or a bool value, but I chose to use the string of text in the RenderText component. There’s a string comparison Equal
(String) that looks like == where the current displayed text is either ON or OFF, so we can use that to figure out which branch to execute.
From the RenderText variable we can produce a node called Set Text which flips the current string. And from the variable TheLight, we can
produce a node called Set Brightness which takes a Float value. 0 is no light, and 5000 is a lot (it is also the default set in the blueprint
defaults). Effectively we’ve created a Switch or Flip Flop.
Next we’ll look at what fires our new SetBrightness function. Note - there is nothing in the eventgraph part of MyLamp. The function by itself
is all we need.
Using Arrays 1.4
In MySwitch, the graph is probably the most complicated so far, and this is where we really test out using the array functions.
Just remember: to create many of the nodes shown below you need to drag from the blue variable outputs to expose relevant nodes by context.
This graph is explained in the next slide too. The gist is that from any array of MyLamp actors we chain through the entire bunch, calling the Set
Brightness function in MyLamp only if the player pawn is near the MySwitch actor, within 99 units. After each distance check we remove the
obtained actor from the array and start over with what’s left until nothing is left. The CompareInt (against 0) checks the Length of the array to
establish whether the array has been emptied out. Note that later on when we call the SwitchPress event (from MyPlayercontroller, everything
resets). So this process is a loop that dies out if you are too far away from the switch or if SetBrightness has been called on all the array items.
The calculation is super fast, so even if you had dozens of MyLamp actors in the scene, they’d all turn off at once. (Add a Delay to slow it
down).
Using Arrays 1.4
So what nodes are relevant to affecting the array?
The first thing is we get all the actors of a certain blue print type.
Then we use Last Index to return the entry number (or index) of the last in the list, and we Get that in order to cast it to our object variable
MyLampVar.
Then we get from the array its Length, or how many items are in it. This value is obtained when we capture that actors, but it also updates (I
guess) when we Remove from the array the particular item we set as MyLampVar. This ability to get the last item in a list, do something to it,
remove it, then check the new last item is super handy in visual scripting.
The Clear node is used when we press T (via MyPlayerController and call the SwitchPress event). Clear strips out everything from an array,
which is just a safety measure since we next use Get All Actors of Class again, allowing us to cleanly repeat all of this whenever we wish.
Look back to Using Arrays 1.1 for the T input event, and how it calls the custom event SwitchPress.
Basic Coding in Blueprint - Making a 24 hour clock 1.0
This is a demo I did for students in about their third hour using the graph editor.
It requires understanding what is a String variable, and that there are some string functions like Append (joining or concatenating them) and
LEN (return the number of characters in a given string). It also requires understanding of an Integer, and how a CompareInt works to check
whether two numbers are equal or which is greater or lesser.
The case is to make an actor (the clock mesh is entirely optional) which includes a Draw Text component, and update it every second via a
function we create in it.
Challenges include
- making numbers less than ten look like 01, 02, and not look like 1, 2 etc.
- making seconds and minutes reset after reaching 60, and hours after 24.
- toggling visibility for a second text display of the number of days and adding sounds (chimes) to notify the change of each hour or day …
although in practise it’s unlikely you would continually run the game for longer than an entire day.
The example could be used not only for a functional clock but for counting the total playing time in days, hours, minutes and seconds, if the
results were saved and loaded .. but for now, let’s just do the blueprint graph to update and display the time as shown in the image above.
The first step is to create a new Actor blueprint in your folder under Game in the content browser. You could opt to execute this whole
process as a HUD blueprint feature instead, rather than within an actor placed in the level. You’d just use the HUD function Draw Text instead
of the Set Text function for Render Text component added to an actor.
The cute mesh I made for the clock is available totally free as a 2k triangle FBX you can import into UE4 from your project’s Content folder.
Dropbox location: https://dl.dropboxusercontent.com/u/9344219/FreeClockModel.FBX
Once you have the model in UE4 you can double click on it and choose Generate Unique UVs in UV Channel 1 to get a nice texture
distribution on the model. I didn't UV it externally since I only needed to apply some flat colours. With or without UVs, it will need materials
assigned to its 4 material channels within the editor (in the Details > LOD0 settings).
Basic Coding in Blueprint - Making a 24 hour clock 1.2
The actor components looks like so:
The Arrow on the Root is just for a direction indicator. We don’t use it here.
Next we add and name a Render Text component as TimerText, and add another and named DaysText. Naming the components is important
because they are automatically added as object variables in the event graph panel (My Blueprint).
The ClockMesh variable is a StaticMesh component using the imported mesh provided on the previous page. This is optional really. If you
want to have the clock face surround the displayed time, then you’d adjust the location, rotation and scale settings of the components so they
line up in the preview window. Make sure the Timer text would fit. Try it with 24 : 24 : 24
That’s it for components. Now we’re ready to start editing the Graph to add functionality. You can drag and drop the actor in the scene and
save both the scene and actor just to be sure.
In the example we’re doing, we won’t set or reset the time. It will always start from 00 : 00 : 00 when the game begins. If you did want to
access the time value during gameplay, you could obtain the time result in your GameState class for example by making an Object Variable that
looks up this actor’s class (See Blueprint Communications).
To edit the actor blueprint, just select it in the content browser and double click it, or in the scene and choose Ctrl + E.
Basic Coding in Blueprint - Making a 24 hour clock 1.3
The first part of the graph to set up is a function, and a set of variables to carry the time values.
In the main event graph, RMB and grab a Custom Event, and call it UpdateTimer.
In the My Blueprint panel, create a Function (+f icon) and call it Timer.
This will throw you into a new tab for this function. For now, just go back to the event graph tab.
Add the variables shown on the right. Notice the components we already added are showing too.
Seconds, Minutes, Hours and Days are all Integer type variables. Add them, compile and then set the
Default Value for each of them to 0.
DisplaySeconds, DisplayMinutes, DisplayHours, and Zero are all string type variables. They will hold
text to be put into the Render Text components of the actor. The integer values are used in the
incrementation math each second, and we convert the results into strings to display.
To change the Default Value for any variable, scroll to the bottom of the compiled variable’s Details.
If you plan to access the time via other blueprints or classes, then you may want to set the integers to be
Public by clicking the eye icon.
In the event graph hold P and click to add an Event Begin Play node. This fires when the game begins
and gets things rolling.
So we have these two events so far:
Basic Coding in Blueprint - Making a 24 hour clock 1.4
Next, drag the component variable DaysText onto the canvas and when prompted choose Get. This lets us reference that component and do
stuff to it. What we want to do is hide it when the game starts, as when the clock starts off, we’re still in Day 1. Of course, you could make it
display something instead if you prefered that. After a day, this gets unhidden.
The function to hide the component can be obtained by dragging off from the blue output pin of DaysText and searching Set Hidden. This will
produce Set Hidden in Game. Connect up its Target to the DaysText pin.
From the UpdateTimer custom event connect to a Delay (hold D and click). Set the Duration float value to 1 as this delay is what will provide
us with the passing of time effectively.
Since in the first steps we already created a function called Timer, we can now call that, by RMB and expand the Call Function category to
reveal it there.
Basic Coding in Blueprint - Making a 24 hour clock 1.5
Now we need to populate our Timer function with incrementation of the seconds, minutes, and hours, as shown below (hopefully it’s readable)...
The highlighted node are CompareInt functions. This check is running so that, as we add 1 to the Seconds each second, if the Seconds value
gets to 60 we’ll be able to reset it to 0. The entire Timer function we’re building now will loop,as the last node we’ll be adding will fire the
CustomEvent we put in the actor’s event graph, called UpdateTimer.
The additional node shown is a Play Sound Attached function. I added a custom beep cue, but you can import any WAV to your project folder
and RMB on it aftering importing and choose Create Cue, and then assign it to play when the Hours value increments (when minutes = 60).
Basic Coding in Blueprint - Making a 24 hour clock 1.6
You will have noticed the previous image shows execution wires shooting off from the CompareInt which I commented with 24 HOUR CLOCK.
The next part of the graph handles the updating of the day changing - though bear in mind to test this part out it will take all day of playing.
What happens here? Once we reset Hours after 24 have passed, we unhide the RenderText component DaysText which was hidden in the
actor event graph. To do this, use a Set Hidden in Game function again, but this time set the New Hidden bool off (or false). We then display
either the integer values Days + “ Day” if Days is equal to 1, otherwise it will display the integer value Days + “ Days” if Days is greater than 1.
To add the node called Set Text you just need to drag off from the component variable's blue pin, in this case DaysText.
And again we play a SoundCue on the change of each day, which could be a cockadoodle sound I guess.
At the end of this chain, you’ll see a new CompareInt commented Digits. In the next section, we make sure that if seconds, minutes, and hours
is less than 10 it will display as 01, 02, etc instead of displaying as just integers 1,2, etc.
Basic Coding in Blueprint - Making a 24 hour clock 1.7
The final block starts from the CompareInt commented as DIGITS (from the previous page). The Input to it is the LEN (length) of Seconds as
a string, where the integer value is converted to characters. LEN returns how many characters are in a string. Our CompareInt compares with
2, so if the Seconds value is 0,1,2,3,4,5,6,7,8 or 9 then its LEN value as a string would be 1. 1 would fire the < pin on the CompareInt and lets
us Append (in input A, as prefix) a string Zero (which has its default value set to 0), so “1” becomes “01”. For higher integers, if the LEN
produces two characters, we don’t need to append anything. We run this check on Seconds, Minutes, and Hours. We don’t need Days.
Once we have the correct digits in the string produced from the current value of Seconds (01 instead of 1 if needed) we store it in a string called
DisplaySeconds, and we do the same for minutes and hours. We then get TimerText, the component of the actor in which we Set Text to be
the combined time, 05 : 11 : 38 for instance. After that, we call the custom event UpdateTimer. This makes the Timer function repeat after 1
second.
Character Animation 4.0
Open existing blueprints and study them to see how they work, particularly those used in the default game-type templates.
Blueprints are found in the content browser (in UDK it would have been the Actor Classes tab and you’d have to inspect them externally via
unrealscript). In UE4 you just double click on them to open the blueprint editor.
A good starting point would be the /Game/Blueprints/MyCharacter blueprint in the third person project. It handles movement, turning and
jumping. The InputAxisTurn, Lookup, and MoveForward events are established in code. They receive controller input (keystrokes like
WASD and mouse motion). In the graph, they wire up to the appropriate functions and execute them. The code equivalent is Event
activated(). In this example the event InputAction Jump receives a button press from the player and feeds out to the Jump function.
To be fair, the function graphs in this blueprint are all pre-coded for the particular game-type
template ThirdPerson and they are hard to expose.
Properties that relate to a function may be found under the Defaults section - ie Jump Z = 500 (I say jump, you say how high?)
Tip: To enable character crouching, search crouch in the Defaults to expose the tickbox for Can Crouch. Note - this does not actually make
the character crouch, it just enables it. For that you have to add an input key, and graph functions related to crouching (and specify mesh
animation). In the next slide, we’ll set up the ThirdPerson character so it can crouch and uncrouch.
Character Animation 4.1.1
MAKING THE THIRD PERSON TEMPLATE CHARACTER CROUCH
First set up a hotkey. To do this go to Edit menu > Project Settings > Input. Within Action Settings press the + icon.
Then scroll down to the new entry and specify the Action Name Crouch and the Key as C.
Now in the MyCharacterBlueprint add the following (don’t worry about the fact you’re editing default content - you can always remove this
later).
Right click on empty space to show the function list, and type in the
search field: crouch as shown in the upper right image.
This will expose the Input > Action Events >
Crouch event and the Call Function > Character > Crouch action
as well as the Un Crouch function. Add them all.
Next add a Flip Flop, which can be found the same way, using RMB
and search. This is a Flow Control function which takes an input wire
then feeds out first A when fired, then B the next time, and so on. The
Flip Flop is equivalent to the Switch action (with two links) in UDK.
The comment box can be added last. Select all the nodes and RMB
and choose Create Comment From Selection.
If you were to play now, you’d notice only the camera drops when you
press C. The character mesh doesn’t change, because we haven’t
told it to yet. We’ll do next using the character’s VIM asset.
Tip: If you wanted to do a blended change from standing to crouch and back, you’d use an InterpTo function. We’ll try that out here.
Character Animation 4.1.2
EDITING THE THIRD PERSON TEMPLATE CHARACTER VIM TO INCLUDE A CROUCH ANIMATION
In the previous section we set up crouching input and the crouching functionality for the player camera. Now we need to animate the character.
Back in UDK, we’d use an AnimTree and call an animation from the AnimSet library. In UE4, this has been rebranded as Persona and VIM.
The problem is there is no Crouch animation in the UE4 assets to add to the existing set of animations for the character skeleton we’re using.
We could use a direct bone translate down on the Pelvis and a two-bone translate up on the feet, but that would only be a marginally useful
approach as the relative offsets probably wouldn’t sit well with the animation of the character moving.
We have to digress a bit and reproduce the assets ourselves, import them, and create a new Character blueprint, and assign it to the game
type.
https://www.dropbox.com/s/gqi5fwe9lwe8wmc/ManMesh_Idle.max
The 3ds Max file is provided so you can subsequently add your own motions. It’s 2mb. Note that while the model is the same, the rig is
different, so the default UE4 character’s animations can’t be extended with your own. You’ll have to replace them all from scratch, a somewhat
daunting task perhaps, particularly given that, from game to game, animations required may differ.
I did my example by knocking up a 3ds Max FBX version, but it’s probably a better idea to use the Jeremy Ernst rigging tool ART (Automated
Rigging Tool for Maya which comes with the editor in the Extras folder). From ART you can quickly style biped character meshes that are auto-
skinned to the rig. See the Jeremy Ernst videos on the Unreal Engine youtube channel.
PERSONA
This refers to the editor you use to set up animation blueprints (VIMs) . It is actually a collection of editors nested together. The official
documentation at this point is definitely a necessary read. Go to it, settle in with a mug of cocoa or whatever, and read it carefully.
https://docs.unrealengine.com/latest/INT/Engine/Animation/index.html
Character Animation 4.3
IMPORTING ANIMATION
In the previous section we mentioned assets need to be created externally (a set of animation clips to represent the possible moves a character
can make).
To import these, first import the FBX which represents the bind pose,
without animations as such, just the skinned mesh.
In the Content Browser, right click and choose Import to Game.
For the first case, click the SkeletalMesh radio button.
Save that asset.
After that, import one by one the FBX files which include animation
and set them to be governed by the already imported skeletal mesh.
For the animations, click the Animation radio button and then click
Select Skeleton > None and replace that with the desired skeleton.
Skeletal Mesh assets are light blue and Animation Sequence
assets are green in the content browser and in the Persona asset
browser.
Having imported the character assets, right click in the content
browser and choose Other Assets > Animation > Animation
Blueprint (which will show as a dark brown icon).
Character Animation 4.4
BLEND SPACES
To begin describing how certain clips relate to each other we can create an asset
called a BlendSpace in the content browser (RMB pop up menu > Other Assets >
Animation > BlendSpace. When you create it, you have to pick from available
skeletal meshes to base it on, as we did when importing animation FBX files.
An example is the RunTPP BlendSpace for the default third person player.
Double clicking the new asset will open up the Persona editor, ready to edit this asset.
The UI for the blend space area is not very well distributed - best to have two monitors.
The Asset Browser in the Persona editor will show all the available clips (green) that
may be used by the BlendSpace. Drag clips onto the canvas (which very likely you’ll
have to first expand to view properly).
Here’s a little video of me setting up a BlendSpace, with explanatory captions:
https://www.dropbox.com/sh/on05lf81upn28u8/Tmw9HNC_AN
The main idea is that points located on a grid form a kind of aim space (like the Aim
Offset in UDK’s animtree). Each point represents the ‘100% on’ state for an animation
clip, and any point in between is blending. The nearer the mouse is to the points the
stronger that point will play.
Key input can then be mapped to the points in the BlendSpace, with a timer doing the
graduation in between. For instance, if someone is running and they release the run
key the BlendSpace transitions to a stop (not an immediate jolt). Parameters for speed
and input would be set in the character blueprint.
Character Animation 4.5.1
STATE MACHINES 1
Today I am looking at State Machines, used in the Persona graph of the ThirdPersonPlayer character, and I am wondering what these are for.
So far as I can see a State Machine visualises animations via a flow or schematic a bit like the AnimTree in UDK, but the direction of flow can
be all over the place in UE4. The flow uses conduits affected by transition rules. This is new UE4 terminology.
https://docs.unrealengine.com/latest/INT/Engine/Animation/StateMachines/index.html
This page has some illustrations which clarify things … somewhat but you have to plan for yourself how to implement them for your case.
I guess an example of flow would be as follows: Going from a lie down on the bed pose you have to stand up before you can play a standing
greeting, but from a stand up pose you can also flow to many other standing actions, as well as lying back down on the bed. But you never
want to play ‘standing to lying down on the bed’ if you are already lying down … and so it goes.
All State Machines start with an Entry icon. A State is kind of like a marker for an animation or set of animations that typically play under
certain conditions. A rule determines how that state may be activated or turned off in favour of another.
Here’s a State in the schematic, followed by the eventgraph that state represents (from UDN documentation). Play Idle_Ready is equivalent to
a Play AnimSequence in UDK’s AnimTree. Rolling the mouse over a State shows a floating preview of its content.
In the schematic view States have no pins. They are intended to have a more freeform layout. To connect a state to any other state, simply
drag a wire from its outer border. Dragging off a State into empty space allows you to create a new State linked to it. You can also auto-create a
State by dragging an animation clip from the Asset Browser into the State Machine editing canvas. It gets named after the animation clip.
Character Animation 4.5.2
STATE MACHINES 2
Today I am looking at State Machines, which are created by right clicking the Animation graph, and it seems they are there to provide a way to
relate different clumps of animation performance using flow rules, driven by use created variables (think, bPlayer1InCombat, bPlayer1Dead).
A Transition Rule is represented as arrows flowing along the links between States. They are icons representing a graph which sets its rules.
Here’s an examples from the UDN documentation. It shows a Rule icon and the graph establishing the requirement of the transition at hand:
Only if the speed variable is greater than 10 will the conduit permit flow (from Idle to Moving in this example). It’s a little bit like using a
Compare bool or Compare Integer to control a Gate. A different rule can be added for a link flowing back from the Moving state to the Idle state.
The next concept to introduce is that of a Conduit. Imagine you
have a sports car in GTA and you’re going to walk to it before
getting inside. You’d flow your Walking movement state into a
conduit and then from the conduit link to either one of
DriverDoorEntry, PassengerDoorEntry, BootOpen or alternatively
flow to GetRunOver if the car happens to be moving really fast at the
time and you are in front of it. The documentation example show on
the right is for handling death using a Killed conduit. Note there is no
reverse flow out of these rather final states.
Character Animation 4.6.1
SETTING UP ANIMATION BLUEPRINTS
So, when do we actually define or call a State Machine (or a BlendSpace for that matter) in our Animation Blueprint?
An animation blueprint’s Eventgraph updates values used by BlendSpaces (and other blends) within the AnimGraph to drive animation
changes.
“For example, the EventGraph of an Animation Blueprint could use the velocity of the owning Pawn to determine direction and speed. These
two values can then be used as inputs into a Blendspace within the AnimGraph to blend between an idle animation and various directional
movement animations. Similarly, the pitch and yaw of the owning Pawn can be used as inputs into another Blendspace to blend between
various aiming poses applied additively in order to cause the mesh to aim where it is looking while still maintaining the previously mentioned
movement animations.”
https://docs.unrealengine.com/latest/INT/Engine/Animation/AnimBlueprints/index.html
To create a new Animation Blueprint (to reverse engineer the setup of the TTP one) RMB in the content browser and choose New Animation
BP.
Specify the Parent Class (AnimInstance) and Target Skeleton asset. Name the new blueprint and right click on it and go to Properties.
Character Animation 5.6.2
SETTING UP ANIMATION BLUEPRINTS
In the new Animation Blueprint properties, we can view and set up variables it will use.
Speed (Float), Direction (Float) and bIsInAir (Bool) are the ones we need to add to match the TPP version.
Variables can be added in the Properties of the blueprint, or in the My Blueprint palette of the opened blueprint (as shown below on the right).
In properties, the + icon lets you add additional variables (as shown below on the left).
Speed and Direction are used in the character’s BlendSpace - these automatically blend to the eventgraph’s updated values during the game.
Character Animation 5.6.3
SETTING UP ANIMATION BLUEPRINTS
When we created our blueprint we used the TPP skeleton (the ThirdPersonPlayer asset that comes with UE4). There’s a BlendSpace called
TPPRun that relates Direction and Speed variables it includes to a set of animation clips, determining which clip to play based on variable
value. So, all we have to do is drive Direction and Speed values and, because the TPPRun BlendSpace belongs to the TPP skeleton, they will
be used.
Character Animation 5.6.4
SETTING UP ANIMATION BLUEPRINTS
When we created our blueprint it created for us an AnimGraph with a Final Animation Pose node. It took me a while to figure out this part and I
may be wrong (as always). Right click next to the node and expand Animations and choose Blendspace ‘RunTPP’ (or your own if you have
one).
Now I’m not sure what to do.
I tried RMB > Variables > Default > Get Direction, followed by Get Speed.
I connected these to the Direction and Speed inputs into the Blendspace node. Then I compiled and it seems to work. But I feel something is
missing as there’s nothing to tell it to jump. Maybe I need to instead add a State Machine with the blendspace part in one state, make an Idle
and make a Jumping state and a Walking state., and put the RunTPP blendspace in the Walking state. The next page shows the internals.
Character Animation 5.6.5
SETTING UP ANIMATION BLUEPRINTS
A new State Machine is created from the right click menu. Hook it up to the Final Animation Pose and then double click on it to edit it.
The image below shows what we’re aiming for:
Entry is there by default. Drag and drop the Idle animation for the Asset Browser tabbed under the graph editor. This will auto-populate a new
Idle State on the canvas, as shown above. You can roll the mouse over it to see the playing clip inside the State.
Right click and add a Walking State. In here add the BlendSpace ‘RunTPP’ and the Get Variables for Direction and Speed as on the previous
page. Add a Jumping State, and inside that put a 1D Blend State (create a new asset and drop the Jump clips into it Start-Looping-End).
Between the states drag connecting wires in both directions.
These are the required transition rules for each wire direction.
Idle to Walking : Speed > 0
Walking to Idle : Speed == 0
Walking to Jumping : bIsInAir
Jumping to Walking : Not bIsInAir
Character Animation 5.6.5
SETTING UP ANIMATION BLUEPRINTS
A way to double jump.
The bool bIsInAir exists in the animgraph of the HeroTPP asset. As we saw on the previous page we can use bIsInAir to drive a
Transition Rule (or gate essentially) for the character’s Jumping animation. We add a bool caled bPermitDoubleJump and an Integer variable
called PressedJumpCount. Each time the jump button (Spacebar usually) is pressed AND bIsInAir is true, we increment the value of
PressedJumpCount. If it’s greater than 1 we set bPermitDoubleJump to false. When bIsInAir is false when we press jump, we reset the
integer to zero and set bPermitDoubleJump = true.
Notice that the variable names are written in friendly format in the graph. bPermitDoubleJump reads as Permit Double Jump.
Character Animation Input 6.0
MAKE THE CHARACTER WALK IN THE DIRECTION OF THE CURSOR SCREEN LOCATION
In the character blueprint we can launch the character in the direction of the mouse cursor. Usually the launch function launches the character
by a velocity relative to the map. In this case when the player presses LeftMouseButton they’ll move relative to the cursor position.
To accomplish we modify the Character blueprint to cal Get Player Controller, from which we can drag off the Return Value into the Convert
Mouse Position to World Space function. That function returns World Position and World Direction. World Direction is what we're looking
for to combine with a Magnitude, which we’ll feed into a Launch Character function. Simply connect the World Direction * Magnitude result
into the Launch Velocity vector input and connect an Input Event (LeftMouseButton for this example) to the Launch Character execution pin.
f
The Magnitude value determines the speed of the character. Ideally you’d set it in a global fashion to affect WASD movement too.
Note that this doesn’t specify any particle method to orient the character to face that direction or play a mesh animation. It just kicks the player
along the vector, which would work well if the character was a flying saucer or some other round or uniform shape. We could use an RInterpTo
method similar to the one we did earlier with the billboard in order to make the character face the cursor location when the player clicks.
Character Animation Input 6.1
MAKE THE CHARACTER WALK IN THE DIRECTION OF THE CURSOR SCREEN LOCATION
Here is how the ‘move to mouse’ functionality is laid out in the Top Down game template.
User Interface (Slate) 7.1
Slate is a mark up language used to create widget-based UI interfaces (ie, drown down menu, chat windows, tabbed panels). The entire GUI of
UE4 is written in Slate.
If you want to learn to use Slate these are suggestions for things you should research:
- Draw a panel on the screen
- Permit mouse control (custom cursor, detect clicking, mouseover, mouseout, click outside etc)
- Permit game paused in background while cursor is active (to freeze camera look and player movement)
- Make a button (with states) that opens and closes the panel
- Create an event to show and hide buttons
- Create a toggle to pause gameplay when a certain panel is exposed
- Create a toggle to pause gameplay when a certain panel is selected
- Embed a button on a panel that allows it to be closed
- Create an event that sets a button to be enabled/disabled
- Create an event that preserves its pressed state until another is pressed
- Make the panel draggable in the viewport
- Add text to the panel
- Add a slider to scroll the text in the panel
- Add a graphical image to the panel content
- Add a graphical icon to the button
- Add drop down, tooltip, and roll out features to buttons
- Make sliders, steppes, tickboxes, input text, radiobuttons and other CLIK style widgets
User Interface (Slate) 7.2
Slate currently has sparse documentation.
Macros are used to create and populate widgets:
SLATE_BEGIN_ARGS( SSubMenuButton )
: _ShouldAppearHovered( false )
{}
/** The label to display on the button */
SLATE_ATTRIBUTE( FString, Label )
/** Called when the button is clicked */
SLATE_EVENT( FOnClicked, OnClicked )
/** Content to put in the button */
SLATE_NAMED_SLOT( FArguments, FSimpleSlot, Content )
/** Whether or not the button should appear in the hovered state */
SLATE_ATTRIBUTE( bool, ShouldAppearHovered )
SLATE_END_ARGS()
This Slate example is from the UDN documentation.
User Interface (Slate) 7.2
Slate can be understood by looking at examples. You can at least see the names of the widgets available using an inspector within UE4 found
in the Window menu > Developer Tools > Widget Reflector.
When the Widget Reflector is running a new window opens (itself ‘reflectable’)
that shows whatever UI elements the user has their cursor over, which highlight
with green frames, as shown below, in the case of the Compile button content.
To enable highlighting click on the Pick Widget button:
The UI elements reveal what .cpp class they can be found in and the widget type.
User Interface (Slate) 7.3
Slate commonly used widgets:
SWindow - Kind of a top level element that can contain any number of other UI elements
SVerticalBox - Kind of a container or panel in which you place other widgets. Used for icons, for example.
SHorizontalBox - As above, but more often used for text backdrop
STextBlock - Container for text
SEditableText - User input textfield (such as Search field)
SButton - Button
SComboButton - A flyout or drop down button type, similar to SMenuAnchor
SBorder - For making things pretty
SSpacer - For making things pretty, buddy of SSplitter (a divider)
SImage - A graphic, for example the picture content of an icon
SAssetThumbnail - A specialised graphic getting the image component from an actor
SListPanel - Contains other widgets (such as the content brower or an inventory panel)
SOverlay - ?
SScrollPanel- The main element of a slider, more or less the same as SScrollBar
SScrollBarTrack - The range of a slider (Note: the bar in a slider is just a SVerticalBox), more or less the same as SSlider
SDockTab - A dockable tab panel (such as the Scene Outliner in the editor)
SComboMenuContent - Used to create drop down menu entries along with SListPanel
SComboRow - The entry in a SListPanel
SCheckbox - for flagging a property on or off
SNumericEntryBox - for entering a number
Troubleshooting 0.0
I was rumbling along and … What happened just now? I couldn’t get the eventgraph window to show up.
It’s likely a display setting fault with my laptop. I generally run the editor with a second monitor, but today I wasn’t.
To fix the issue, I went to Windows Task Manager (Ctrl+Alt+Delete) and looked at the UE4 process.
Two running process are shown when both the editor and an additional window like the eventgraph are open.
To expose the eventraph I right-clicked on one of the processes and chose Maximise.
Nothing happened, so I did that again for the other one. And the missing eventgraph popped up. Yay.
This hadn’t worked from the operating system’s taskbar icons (like it does with the Log in UDK for instance).
Task manager process tab:
UE4 - FLYING GAME CONTROLS 1/4
Important: This demo was constructed using the github UE4 4.2 preview.
If you turn off the default controls, you can make your own game controls as follows.
Turning off the defaults.
1. Go to your Pawn class and in its Defaults panel, type bindings in the search field.
2. Turn off Add Default Movement Bindings.
Note: This will disable them, so you won’t be able to move around in your game for now. We’ll implement our own movement instead.
In your Pawn class, add an Event Tick and promote its Delta Seconds to a new float variable PawnTickDelta. Set that as shown in the image.
Create a Sequence node, with seven pins (you’ll probably wind up with more eventually). These give you a way to flow out to up, down,
strafeleft, straferight, forward and backward motions.
I’ve also added FreeLook: http://goo.gl/2Cld0G to handle turning.
Create the Custom Event nodes for those first, then call them
from the Sequence pins, as shown on the right.
My pawn blueprint is called Flying_ParentPawn as I want to first
make an abstract parent blueprint and then derive various child
pawns from that, later on. In the demo, we just use the parent.
Make sure you add your pawn and your playercontroller to the
level’s gamemode. If you don’t none of this will be active.
The other thing you’ll want to do is make blueprint casts when play
begins. This is shown in earlier sections, and here:
http://goo.gl/PU66jx
In my case, the playercontroller variable used for casting is
FlyingPlayerControllerVar in the pawn class.
In pawn, to prevent too fast movement, set Max Speed to 30.
UE4 - FLYING GAME CONTROLS 2/4
The Cast to Controller function follows an Event Begin Play (p) and notice it calls Enable Input so we can establish hotkeys in the pawn
class.
Having dealt with that, we can create the functionality for the player motion (remembering this is camera movement, nothing to do with a
character model or its animation).
This part relies on the Movement Component that comes for free with the pawn blueprint. Notice the World Vector values may need
tweaking.
Note: the Gate bool Start Closed is on by default, because Tick enters continually, so we use the Up and Down keys for flow control only.
The small image on the right shows, in your playercontroller blueprint, a quick way to toggle the onscreen cursor, which you may find handy
when checking the movement controls are doing what you want them to do (for the FreeLook or turning camera part).
UE4 - FLYING GAME CONTROLS 3/4
For Forward and Backward motion,set the next part of the Pawn eventgraph as shown below:
The key inputs you set for controlling each Gate are up to you. I used [ and ] and found it comfortable to use when the Up and Down arrow keys
are being used for up and down motion, for flying. I guess many people would use WASD with up and down as Q and E perhaps.
The regular nodes to complete this are: Get Control Rotation, added to a Make Transform, and then passed through a Transform Direction,
finally added to the movement of the player. Notice the Direction value for forwards is X positive or 1.0 and backwards is X minus or -1.0.
You then use a Scale Value float to multiply that vector. My default value for Thrust Scale was 20.0 but make it whatever works for you.
UE4 - FLYING GAME CONTROLS 4/4
What works well for forward and backward motion (on the previous page) works well for sideways camera motion too, in this case, strafing.
Using the Y axis for Direction instead of X axis is all we’ve changed.
I mapped the strafing keys to both Left arrow == comma, and Right arrow == fullstop.
Having set up basic motion, we need turning. My FreeLook steps, added to this pawn blueprint are shown here: http://goo.gl/2Cld0G The
example uses Math Expressions, which have been introduced in 4.2 version of the editor, but can also be set up with regular Math nodes.
On the UE4 Answer Hub, Tim Sweeney commented “This is awesome, Thanks for Sharing”. I should record a video of it all working. (To Do).
UE4 - “Fun with Blueprints” - Zak Parrish on Unreal Engine (youtube)
The video by Zak Parrish: http://youtu.be/9-7SmkasS_A shows how to spawn many objects in random locations in a volume.
The pic is a bit large, just zoom in the doc and use the sliders to pan.
Instead of using a Class reference directly, you could create a named variable SpawnedActor. This would let you use children of this parent to
set the variable SpawnedActor to be different classes, using the same parent blueprint graph for many cases.
The actor spawned should include a mesh or emitter so you can see it. If you want the spawned actors to fall to the ground from wherever they
spawn, you’ll need to set Transform > Mobility > Movable in the spawned actor’s mesh component. Set the mesh component’s properties so
it has ticked values for : Simulate Physics and Simulation Generates Hit Events and Generate Overlap Events and Collision Presets =
PhysicsActor. You’ll also need to tick Start Awake if it isn’t already. Possibly the ground will need to generate hit events too.
You can use Hit Events to generate sounds on collision, to get the hit location to spawn emitters, and so on. These can be in the spawned
actor.
You can also operate on the returned object produced by the SpawnActor function’s Return Value, such as add the object to an array.
In the image, a Delay and Gate to control the burst of objects, but you could use keyboard input and Gate it via a tick event or some other way.
In the image the Gate is collapsed to save space (hold G to add a Gate).
UE4 - UI Buttons 1/8
I recently lost a lot of work and faced the formidable task of rebuilding it (which I did only to lose it yet again). Then I started over and, because
the urge to optimize had become much stronger, I realised a way I could do buttons much nicer.
I really like how Scaleform in UDK permitted button states, so this demo shows how to replicate that in blueprint.
I thought I’d come up with a good approach the first time (but it needs many wires). The problem is having four Draw Material Simple for the
button states. [NB: I’m just changing the button color depending on what the cursor is doing.] Having to feed in the screen position and button
size values for each one is inefficient. The image on the next page shows an improved approach.
Notice that a Switch on ButtonStateSwap is used to specify which Material to draw. This is an Enum asset I made in the content browser and
for each different button an Enum Something variable is looked up to see what value it has. Really it’s the same as Switch On Int but looks
nicer on screen, as you remember better which output does what.
So this example works but is wrong in terms of efficiency… there are some things I’ll need to explain besides this part, such as how to make the
HUDCenter Text function on the right below, and how to set the Enum values based on HitBox events.
UE4 - UI Buttons 2/8
Given what was on the previous page, it’s much nicer to look at the streamlined version shown below (zoom in for details):
You can see that there are far fewer green lines carrying values from the function generating them to where they need to go).
To clarify, there are four states for a button though usually we only use three. Up (when the cursor is elsewhere), Over (when the mouse is
over the button), Pressed (when the user clicks on the button), and Disabled (which is used when the button isn’t available for whatever
reason).
In this case I made an unlit parent material and then, from that, produced material instances that simply shift the base emissive color value as a
parameter.
For each button you make this graph works well, and just needs the variable inputs to be updated (text string, location offsets from the screen
center, hitbox name, and enumerator variable). These are explained on the next page.
UE4 - UI Buttons 3/8
The button has to have a text string (well, if it’s not a totally image based one), a location (for which I just use offsets from the screen center), a
hitbox name, and an enumerator variable which is used to switch the material or texture of the button graphic.
The hitbox is the part you actually click on, and technically it could be any size you want.
In my case, I am making the hitbox and material to size to the text string (hence Resume is wider than Save) with a little
math to make add 10 pixels to the width and height or each.
You can see the roll-over effect on the Load button in the image. When clicked, the material is switched to an even lighter
tone for a moment.
Here’s the function for getting the center of a given string of text, and setting a given string of text in the center of the screen.
This function belongs in the HUD blueprint. It has three external inputs. The InString is the main one that will differ per button. The Font is an
asset created in the content browser and assigned via a variable. FontScale is a Float multiplier for the font asset’s default size.
HUDX and HUDY are integer variables set after the HUD’s EventReceiveDraw event, as shown below.
A branch effectively gates the continual exposure of what you
want in your ‘LaunchMenu’ of buttons. To turn off the menu, just
set ShowLaunchMenu to false somewhere.
UE4 - UI Buttons 4/8
The HUD setup for the LauncherMenu that contains the buttons is as follows:
Notice that EnterLaunchMenu is a custom event fired from the HUDDraw event continually, but it only fires when the bool ShowLaunchMenu is
true. After the usual cast to another blueprint to get its function, we set Enable Input, so the C key can toggle the menu. This might also be
paired up with ShowCursor and EnableClickEvents. In this case I’d already done that in the PlayerController blueprint, for testing things out,
as shown below.
The command to set the bool InCinematicMode is used in the level blueprint to toggle Set Cinematic Mode (since that seems to only be
possible to set in the level blueprint). Cinematic Mode acts as a pause player command. That’s demonstrated here :
https://answers.unrealengine.com/questions/24674/when-in-paused-game-how-to-remove-the-paused-text.html
The next part is to make each UI button’s HitBox respond to the cursor, which is shown on the next page.
UE4 - UI Buttons 5/8
To make each UI button’s HitBox respond to the cursor, we use events in the HUD class. The chain off these can grow to be quite big as more
buttons are added, so I make a New Graph in the HUD blueprint to give these their own space.
.
This image shows the general layout of the three button states we need to set up. The over state is handled by an event in the HUD called
EventReceiveHitBoxBeginCursorOver. I set a Name var OverEnd then match it to all the hitbox Name variables for all the buttons.
In this example all I do as a result is changed the material, but here you could add sounds or tooltips or other commands.
UE4 - UI Buttons 6/8
In the previous image, the values for the enums driving ButtonStateSwap were set to 0 (which is the first in its content, therefore the Up state).
For the Over state the enum value to switch on would be 1, and for Pressed 2.
To create an Enumeration, RMB in the content browser folder and expand Miscellaneous.
Name it, populate its Enumerators and then save it.
To call it, just RMB in an eventgraph and start typing its name.
You should seeSwitch on ‘YourEnumName’ show in the list.
Remember, you can also use Switch on Int, and just spit out
numbers, but that can be hard to remember which value is what.
.
If you look back to the functions for creating the buttons, you’ll see the Switch on ButtonStateSwap is using an enum variable input
(Selection) which, for each button, is a var like UIButtonStateSAVE or UIButtonStateLOAD. So here we are setting it based on what the mouse
interaction with the HitBox is.
In the next part, we see how the click event continues this idea.
UE4 - UI Buttons 7/8
The click event in this case only changes the material on the button so it flashes brighter. Functionality would follow for each branch.
The click event occurs when the player clicks the hit box for a given button. By default no action occurs just because a button was clicked (so
Save doesn’t Save and Quit doesn’t Quit). Make functions of your own and call them from EventRecieveHitBoxClick. A simple example of the
commands that drive saving and loading is shown here: https://answers.unrealengine.com/questions/25747/how-can-i-savegame.html
Tips: Use Promote to Variable (right-click on empty pins) and this will create and auto-populate the variable type so you don’t have to browse
for that.
To replace a variable with a different one, drag the variable from the My Blueprint list onto the empty space on the existing variable node. This
will pop-up an option to replace one with the other, as shown below. This is useful if you are copying/pasted content and need to make updates.
To
UE4 - UI Buttons 8/8
I left a comment a few pages back that there’s a tidier way to set up the Hitbox events so they don’t need to branch so much.
Thanks to Steve Allison for this: https://answers.unrealengine.com/questions/44431/hitboxes-with-same-name.html
Having said that …
It seems that in UE4.2 (unless I’m doing things really wrong) each HUD hitbox is persistent, so if two menus have a hitbox in the
same location it’s really better to just use the one for both buttons, and use a branch off a bool to control the effect for the hitbox
depending on which menu is current. An example is shown on the right
Intuitively, you’d expect hitboxes to not last and to be added each tick or drawHUD event then discarded, but just because they’re no longer
being added does not mean they are actually removed. The first added hitbox has precedence over others (Priority seems not to work).
I’ve posted a query about this little bit of weirdness on the UE4 Answer Hub: https://answers.unrealengine.com/questions/53463/how-to-make-
hitboxes-that-dont-persist.html
The reply is that there’s a setting Suppress Native HUD which doesn’t (Currently) have discardable hitboxes …
So, test which case you’ve set active. In upcoming 4.3 version this case has been fixed.
UE4 - Create an Interface and let another actor look it up 1/4
I was playing around with using an Interface in a blueprint and ended up with a string that adds a dot to itself when you are at an actor’s location
and removes a dot from itself when you are too far from the same location. No reason why… although it could be a basis for a charging stat
boost (like you get extra Armor when standing in a Shield Dome). The length of the string is an integer that could drive or influence another
value.
1 RMB in content browser, in your BP folder and choose Miscellaneous > Blueprint Interface. Name it DemoInterface, as you like.
2 In the interface editor, add a function and name it SillyFunction (the name is up to you).
3 In the Details panel of SillyFunction, in Input press New, and for the new entry type InString and make sure it’s a string variable type.
4 Then Compile and Save. Don’t add an Output. If you add an Output you cannot use the interface’s Event, as in the documentation. Read
this https://answers.unrealengine.com/questions/43429/how-do-you-implement-an-interface.html
5 RMB in the BP folder and choose New Blueprint > Actor, and name it DumbActor.
6 Open DumbActor and click the Blueprint Properties icon in the Toolbar, as shown below.
This will expose a panel that lets you specify which Blueprint Interface this asset can implement.
7 Press Add, and choose your DemoInterface_C asset from the dropdown list, as shown on the right.
Now you will be able to CREATE the functionality for SillyFunction in DemoInterface_C. I’m not sure how to explain the usefulness of that, but
suffice to say that other blueprints also with the Interface implemented can all execute when the function is called in this blueprint.
https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/Types/Interface/UsingInterfaces/index.html
The call to SillyFunction is a Messenger type. And in other blueprints that also implement the interface, use interface events to send your string
over. NB: I don’t want to use GetAllActors of Class, because what if there were lots of them in the scene? But for now, it works as such.
It’s not much to look at, but it’s all we need. This is because we will only be passing in a
variable in one blueprint in order to send the variable to another..
UE4 - Create an Interface and let another actor look it up 2/4
I set up this in DumbActor. The Delays are needed in the eventgraph because they don’t work inside of a function (latent stuff isn’t allowed in
functions). If there is no Delay at all in the loop through the function and back through IncrementLoop you’ll collapse the game because of too
many execution steps.
IncrementLoop is a Custom Event.
DecrementLoop is a Custom Event
The custom functions GrowString and ShrinkString are shown on the next page. Both call DoSillyFunction, which is custom event hooked up to
the Interface function messenger. A messenger shows with an envelope in the corner. If there’s no envelope it’s just a local function call and
other blueprints won’t hear it.
Notice we get TextActor_C, which is the class representation of the actor TextActor ithe scene. In this case there’s only one actor to find.
We pass the value of the string variable Input to TextActor using SillyFunction (via the interface we made on the previous page).
The method below would also work well, I guess, if a bunch of actors were sending stuff to the HUD, since there’s only one HUD to send to.
So long as yourHUD also
added the relevant interface
in its Blueprint Properties.
UE4 - Create an Interface and let another actor look it up 3/4
Zoom to see the images.
This one is the GrowString function, and if the distance from the DumbActor to the Player is less than 150 we append a “.” to the string Input,
then call DoSillyFunction, the custom event on the EventGraph which sends out the Input string to our obtained TextActor. Then we loop this,
and also loop through DecrementLoop, which ‘breaks’ if the distance is still less than 150.
The looping part is probably not canon, but it works.
This is the ShrinkString function:
Notice the cool use of GetSubstring and Len-1 to shorten the Input string. What this does, if we get far from the actor, is incrementally remove
dots from the string that is passed via DoSillyFunction again to the interface event in our TextActor, on the next page.
UE4 - Create an Interface and let another actor look it up 4/4
TextActor, by comparison, is pretty simple. Note that Dots is the variable name of a TextRender component,as shown below.
And here’s a litle video of all this : http://youtu.be/MS8_4NMNc4Q
UE4 - Proximity Testing Actor
This is a reply to : https://answers.unrealengine.com/questions/56329/how-do-i-get-the-location-of-the-closest-character.html by Alan Webster
In this example we change the material of whichever actor is closest to the player (amongst those of the same type in the scene).
Make a blueprint actor called ProximityActor_BP (or whatever you want to call it). In the image on the left I have
outlined a flat plane mesh that I added to the actor as a primitive component. Add any StaticMesh you want.
This component should be added as a child of the root, not as the root. (I normally add an Arrow to the root.)
That matters because later we look up the component by index in order to change its material. as shown below:
Here is a link to the 1:1 scale eventgraph for the actor: https://dl.dropboxusercontent.com/u/9344219/ProximityActor.png
At 1:1 the original image is quite large (3187x726 pixels), so the image shown below is just for a preview so you know what to expect.
A 40 second video showing the result is on my youtube channel, here: http://youtu.be/33XdoerjUZs
Probably the same result could be established without using a secondaryarray, straight out of Get All Actors of Class, but I found the wires got
messy pretty fast trying it that way.
UE4 - Quick and Dirty Green Screen
I put a RenderTarget2D on a FBX mesh and behind the mesh a block with a green material on it (0,1,0).
The rendertarget texture in the material editor gives us our image (although it’s a ParameterTexture in the example below), and we
Blend_Exclusion it with 0,1,0 to chuck out the green in the Opacity channel.
The downside is that green in the Diffuse or Emissive may cause a spill kind of effect, particularly around the edge of the captured model, and
the colors may not be quite the same as in the captured image when it renders (I tried using the Add/Add/Subtract with RGB channels to reduce
that).
I’d love to hear other ways to achieve this.
What I’d really like to know is how to get a rendertarget to produce a non-white alpha based on the max view distance:
https://answers.unrealengine.com/questions/57357/change-rendertarget-alpha-to-0-past-max-view-dista.html

More Related Content

Similar to The world’s your oyster

2%20-%20Scripting%20Tutorial
2%20-%20Scripting%20Tutorial2%20-%20Scripting%20Tutorial
2%20-%20Scripting%20Tutorialtutorialsruby
 
2%20-%20Scripting%20Tutorial
2%20-%20Scripting%20Tutorial2%20-%20Scripting%20Tutorial
2%20-%20Scripting%20Tutorialtutorialsruby
 
Introduction to Game Programming: Using C# and Unity 3D - Chapter 2 (Preview)
Introduction to Game Programming: Using C# and Unity 3D - Chapter 2 (Preview)Introduction to Game Programming: Using C# and Unity 3D - Chapter 2 (Preview)
Introduction to Game Programming: Using C# and Unity 3D - Chapter 2 (Preview)noorcon
 
Unity3d scripting tutorial
Unity3d scripting tutorialUnity3d scripting tutorial
Unity3d scripting tutorialhungnttg
 
Flash Prototyping Workbook - Part 1 and 2
Flash Prototyping Workbook - Part 1 and 2Flash Prototyping Workbook - Part 1 and 2
Flash Prototyping Workbook - Part 1 and 2Alexa Andrzejewski
 
Keynote + Next Gen UIs.pptx
Keynote + Next Gen UIs.pptxKeynote + Next Gen UIs.pptx
Keynote + Next Gen UIs.pptxEqraKhattak
 
Basic After Effect & Animation GIF (J&T Express)
Basic After Effect & Animation GIF (J&T Express)Basic After Effect & Animation GIF (J&T Express)
Basic After Effect & Animation GIF (J&T Express)IzzuwanIsmail
 
en_GettingStartedInMicroStation.pdf
en_GettingStartedInMicroStation.pdfen_GettingStartedInMicroStation.pdf
en_GettingStartedInMicroStation.pdfArielAlejandroLander
 
Practical work 6
Practical work 6Practical work 6
Practical work 6wkhairil80
 
Plug-in Architectures
Plug-in ArchitecturesPlug-in Architectures
Plug-in Architectureselliando dias
 
Pcb design using proteus
Pcb design using proteusPcb design using proteus
Pcb design using proteusMashood
 
Cmd unity withc
Cmd unity withcCmd unity withc
Cmd unity withcumairnoora
 
Courselab Quick start guide
Courselab Quick start guideCourselab Quick start guide
Courselab Quick start guideBob Price
 
[Pro forma] - production log
[Pro forma] - production log[Pro forma] - production log
[Pro forma] - production logcharles-stick
 

Similar to The world’s your oyster (20)

Unity 3d scripting tutorial
Unity 3d scripting tutorialUnity 3d scripting tutorial
Unity 3d scripting tutorial
 
2%20-%20Scripting%20Tutorial
2%20-%20Scripting%20Tutorial2%20-%20Scripting%20Tutorial
2%20-%20Scripting%20Tutorial
 
2%20-%20Scripting%20Tutorial
2%20-%20Scripting%20Tutorial2%20-%20Scripting%20Tutorial
2%20-%20Scripting%20Tutorial
 
Introduction to Game Programming: Using C# and Unity 3D - Chapter 2 (Preview)
Introduction to Game Programming: Using C# and Unity 3D - Chapter 2 (Preview)Introduction to Game Programming: Using C# and Unity 3D - Chapter 2 (Preview)
Introduction to Game Programming: Using C# and Unity 3D - Chapter 2 (Preview)
 
Presentación Unity
Presentación UnityPresentación Unity
Presentación Unity
 
Unity3d scripting tutorial
Unity3d scripting tutorialUnity3d scripting tutorial
Unity3d scripting tutorial
 
Easyeda tutorial
Easyeda tutorialEasyeda tutorial
Easyeda tutorial
 
ID E's features
ID E's featuresID E's features
ID E's features
 
Flash Prototyping Workbook - Part 1 and 2
Flash Prototyping Workbook - Part 1 and 2Flash Prototyping Workbook - Part 1 and 2
Flash Prototyping Workbook - Part 1 and 2
 
Keynote + Next Gen UIs.pptx
Keynote + Next Gen UIs.pptxKeynote + Next Gen UIs.pptx
Keynote + Next Gen UIs.pptx
 
Basic After Effect & Animation GIF (J&T Express)
Basic After Effect & Animation GIF (J&T Express)Basic After Effect & Animation GIF (J&T Express)
Basic After Effect & Animation GIF (J&T Express)
 
en_GettingStartedInMicroStation.pdf
en_GettingStartedInMicroStation.pdfen_GettingStartedInMicroStation.pdf
en_GettingStartedInMicroStation.pdf
 
Sigil 0.2.0-manual
Sigil 0.2.0-manualSigil 0.2.0-manual
Sigil 0.2.0-manual
 
Practical work 6
Practical work 6Practical work 6
Practical work 6
 
Plug-in Architectures
Plug-in ArchitecturesPlug-in Architectures
Plug-in Architectures
 
Pcb design using proteus
Pcb design using proteusPcb design using proteus
Pcb design using proteus
 
Cmd unity withc
Cmd unity withcCmd unity withc
Cmd unity withc
 
XCode8.0
XCode8.0XCode8.0
XCode8.0
 
Courselab Quick start guide
Courselab Quick start guideCourselab Quick start guide
Courselab Quick start guide
 
[Pro forma] - production log
[Pro forma] - production log[Pro forma] - production log
[Pro forma] - production log
 

Recently uploaded

Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 

Recently uploaded (20)

Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 

The world’s your oyster

  • 1. The world’s your oyster.uasset
  • 2. Introduction 1.0 Hi, welcome to my UE4 notes starting from the the beta version, ‘Rocket’, now available to all from Epic Games. This is not a textbook. It is a personal log of learning UE4 that I hope will also help others. I’m trying to be systematic in terms of keeping a clear and consistent presentation style but the topics are more blog-like and pretty much follow whatever occurred to me, with a little housekeeping if the googledocs application allows it. This document was made with GoogleDocs and some formatting may shift depending on the view mode you choose. I aim to balance it for Full Screen. How I format things Names of files, asset names or user entered text will be in Italics, like this: YourFileName.umap Hotkeys will also be in italics. Names of editor keywords or key concepts will be in bold, like this: Look in Edit > Settings > Hotkeys. Weblinks look like this: http://forums.epicgames.com/forums/366-UDK Comments I added after filling up a whole page look like this and should be found in the margins: To make future editing easier, no series of steps will be numbered or bulleted Code will be formatted as shown next..
  • 3. Introduction 1.1 Code in UDK is a little different to unrealscript in that it’s C++ through and through. Also there’s a sort of markup syntax for Slate (UI) designers that looks quite different and I’m not sure I can recreate it here the way it’s done on the UDN. For in-line code like this TAttribute<T> I’ll use Consolas font. For a block of code, as shown above, settings are: Color of backdrop in the Text Window will be 255, 245, 205 [Googledocs: set Text Highlight and Text Colour.] Color of commented text will be 40,80,20 Color of highlighted code, as above will be 255, 0, 0 while normal code will be black. The code text window is jammed up against the red margin guide. To learn more about Slate log on to UDN then go here: https://docs.unrealengine.com/latest/INT/Programming/Slate/index.html Epic doesn’t offer a C++ head start so for that go here: Beginning C++ through Game Programming http://www.doc.ic.ac.uk/~af909/Beginning_C++_Game_Programming%5B1%5D.pdf As I understand this book is freely available, but you may want to buy a copy, or get a book like C++ for Dummies. http://www.dummies.com/how-to/computers-software/programming/cplusplus.html TAttribute<T> // This example of code will do for now
  • 4. Installing UE4 1.0 UE4 installs easy enough, like UE3 … An important difference you’ll notice VStudio 2015 Express is heavily supported via the full source code being available on github. See the Zak Parrish video on how to set up that. You will need a subscriber account for UE4 and a github account and to register VStudio via a Microsoft account. The editor can be launched from within VStudio after the solution is loaded, by pressing F5. You can then load Sample Content via the Launcher after login, or start a new project based on various templates such as Top Down C++ or Top Down Blueprint. UE4 has a launcher but can also open straight into whatever project was active last time, into the map (or scene) active last time in that project. This can be changed in the settings. You can revert changed settings using the yellow icon Reset to Default. Typically values in properties fields that are not the defaults are emphasised in bold. You can switch projects by choosing File > Recent Projects (a fly out with radio buttons showing what’s currently active). If you begin a new map it will exist within the scope of the current project. For instance, you might have a launcher.umap and a mainlevel.umap and a bonuslevel.umap. Note that .udk map files are now called .umap files. If you begin a new project, you must establish a folder location for it and the editor will create certain folders within it. Day 1 - Resolution
  • 5. Those familiar with UE3 will notice the the package file (.upk) is now called an asset (.uasset). Old packages can’t be imported as such, but you can bring over the asset contents, like meshes and textures. You cannot import a given .uasset from within the editor, you have to first place them into the Project folder somewhere then restart the editor to refresh its library. becomes Likewise, if you create a new map (MyLevel.umap replaces MyLevel.udk), you will notice that if you save to a new folder, say Custom, the folder won’t show in the editor under Game in the content browser till next time you fire up the editor. But you can create folders for assets internally, which show up straight away. Getting Started 1.0
  • 6. Getting Started 1.1 To create a new project choose File > New Project. A template pops up with preset gametype frameworks such as the following: Once you create a new project the editor will close and relaunch itself. I have not used the C++ variants. I use (Blueprints only) which assumes you either don’t know how to code or that your project and all its map feature content where custom C++ code is not required. Blueprints are a bit like visually scripted class files: Level blueprint (the scene eventgraph, variables and defaults). This is a lot like the Main kismet in UE3. Actor or class blueprint (per actor blueprints, a lot like custom prefabs including Kismet snippets in UE3)
  • 7. Getting Started 1.2 The Content Browser is more compact than in UE3. There is now also a more prominent Scene browser (the Scene Outliner) which is a lot like the Outliner in Maya. G The marked icon shows the folder structure of the project. Custom content should go into the Developer section. The icon above New also reveals the folder structure. The icon creates new assets internally. It’s a flyout, so don’t click-release on it or you’ll create more or less a random result. Instead, click-hold and choose from the pop-up list. Get in the habit of using the Search field in the editor; in this version of the editor this really pays off, with intelligent suggestions in every case where you use a search field.
  • 8. Getting Started 1.3 A welcome addition to UE4 that’s not in UDK is the ability to name instances of assets (actors) placed in the level via the new Scene Outliner. It is also now possible to drag and drop assets onto each other to attach them in a hierarchy. This is akin to the old Properties - Lock - Assign version of making attachments, which was clunky. To reverse an attachment via the Scene Outliner, RMB on the attached actor and choose Detach. These attachments can be changed during a game. In UDK Kismet to detach an attached actor you could use Attach to Actor with a ‘Detach’ tickbox turned on in its properties, but this was potentially visually misleading. In UE4 there is a specific Detach Actor from Actor function, which can be used to detach attached actors even if that was done via the Outliner. For eventgraph attachments, use an Attach Actor to Actor (this function is akin to the Attach to Actor action in UDK). Functions need to be fired by an event like ReceiveBeginPlay (akin to Player Spawned in UDK). Assign the variables by selecting a relevant actor in the scene then choosing RMB > Add Reference To … from the eventgraph menu.
  • 9. Getting Started 1.4 Like Maya, the editor now offers a Scene Outliner useful to locate actors placed in the level. This has a Search field. It will quickly become apparent that users can now drag and drop panels in the UI so they stack together or tab together. You can drag the edges of panels and viewports to resize them, as shown in the image, above right. You can toggle panels from the Window menu. Note that the Details panel is labelled as Selection Details in the Window menu. To save these layout changes, use Window > Save Layout. There is no Saved Layouts browser, however you can choose Edit > Settings > Editor Preferences > Backup and Reset > Reset UI Layout to restore defaults for the layout.
  • 10. Getting Started 1.5 One preference of note that differs from UE3 is that you can assign your own hotkeys to editor commands, such as PIE. These settings can be found using Edit > Settings > Keyboard Shortcuts and expanding the appropriate section. In this version of the editor there are more ways to Play and Simulate gameplay, so it’s a good idea to establish these hotkeys early and get used to the differences.
  • 11. Getting Started 1.6 Viewport controls are much like in UE3. LMB drag wanders around, RMB free looks, and both together tracks sideways or vertically depending on mouse drag direction. Many users will prefer WASD to move and RMB to free look. Q & E track up and down respectively. Camera travel speed has 8 settings as opposed to the 4 in UE3; the icon location has changed location and style. Likewise the movement, rotation and scale snapping tools have changed location to the upper right corner of the UI. The tilde key ` (the same key as ~ without holding Shift) is still used to swap World and Local relative Transform mode. In-game it opens the console. TIP: The ` key is also used in unrealscript to preface the logs like `Log(“Boo!”) but I didn’t check yet how that is done in UE4. Viewport labels are sleeker than in UE3, having semi-transparent rollout labels, a bit like 3ds Max. Apart from the UI most of the functionality remains the same as UE3. In UE3, to lock an actor (freeze its location) you would RMB and choose from the pop up menu. In UE4, you use the upper left viewport icon and choose Actor Locking > Selected Actor. In the new UI look, if you touch the orange triangle in the upper left corner of the view, it will display a tab, and if you RMB on the produced tab you can choose Hide or Close. Exposing the tab allows you to nest viewports just like any other panel.
  • 12. Getting Started 1.7 Cameras, when they are selected, show a cool floating preview of what they see, as shown below: Notice the selected camera gets an orange highlight. This color can be adjusted or even turned off in Edit > Settings > Preferences > Viewport Look and Feel if desired. I notice that if the Camera Preview Size value is set below 3.11 then the preview will flash and flicker, which is pretty unpleasant. TIP: Enable Use Small Tool Bar Icons. Big icons are obtrusive and before long you won’t need that kind of hand holding. A common issue for students of UDK is figuring out why they can’t select some actors. They don’t immediately spot that an actor may have a transparent component in its material settings. The icon for this in UE3 has been removed and now you have to choose the View Settings icon (the cog eye) rollout and tick Allow Translucent Selection. You can also press T. In that top row of icons, we’ll all grow to enjoy the Samples feature which lets you selectively download additional content, demonstrations that highlight various editor features. These download as .zip filse and once extracted can be placed in the UE4 projects folder, right next to Engine and Templates, and so on, and they’ll be exposed after editor restart.
  • 13. Transforming objects is slightly different than in UE3. In UE3 you had to specifically set a mode for non-uniform scale, which isn’t the case in UE4. You just drag the axis you want to pull in. In the Details panel, you’ll find Transform values, much like the Movement properties in UE3. Now you can lock scale values using a padlock icon to force uniform scale for all directions (alternatively, you can scale using the white center box on the gizmo with viewport scale snapping enabled and set to an increment that’ll give the value step you’re after). Spacebar toggles transforms, or you can use the Move, Rotate and Scale icons in the upper left icon tray as in UE3. For those who like it, in Edit > Settings > Preferences > Level Editing you can still choose Enable Combined Translate/Rotate Widget, which saves a mouse click or two when laying out objects. This adds an icon to the UI tray when enabled. Getting Started 1.8 Tip : In UDK the Home key (or Goto Actor) icon framed the selected object in the view. In UE4 this has been replaced by the F key. The object will be centered but other things may get in between, so use it along with LMB vertically to zoom to the actor smoothly.
  • 14. Getting Started 1.9 World Settings display in the Details panel in UE4, much as they take over the Properties panel in UE3 when exposed. If the Details panel happens to be nested in a tab behind another panel, it won’t jump to the foreground. Changes to the layout of Game Type, Damage (formerly Zone Info) and Physics are shown below. Note that MyGame is the default and if expanded shows the assigned Pawn, Replication, HUD, and Controller for that Game Type.
  • 15. A Quick Review UE4 uses Projects, which is a new concept for project organisation that may require some workflow adjustment for UE3 users. By and large, a project is defined according to its game type (third person vs platformer vs RTS for example). The user interface layout of UE4t is highly modular (and darker than UE3). Navigation and display functionality remains the same, but unsurprisingly you’ll have to spend a short time figuring out where some commands are to be found. Learning to set certain hotkeys and preferences early will make using the editor a bit nicer. Editing objects in the scene is much the same as in UE3, apart from the new style of object highlighting and the transform widgets. Some of the viewport UI icons have been shifted around, but by and large you can access viewport settings and modes from the top of each viewport. Most panels include a Search field at the top, which filters while you type. Panels can be dragged around, resized, arranged in nested tabs or stacked or even turned off. Mostly, control of panels is through the Window menu. In UE3 a dominant style approach was to expose many settings (like filters in the content browser or icons for the viewport) whereas in UE4 these have been deferred into roll-down menus. Existing UE3 users may find these changes to be at first a little weird, but after some exposure to the new methods it should be apparent that most changes do help get things done faster or take up less space. For example ticked filters from the drop down list are exposed with color highlights which act as ‘quick filters’ till unticked. In the default project, the Starter Content, there is a lot less provided content in UE4 than in the UT3 friendly UDK. This is good for those not wanting to be influenced by UT settings, but can make getting underway in a new project somewhat daunting. Having said that, you now download a library of sample projects which via the MarketPlace in the Launcher. TIP: Learn how the editor works by building simple scenes using the source content from the Engine folder, but don’t edit the Engine content directly. Make copies into your own folder.
  • 16. Getting Used to New Features 2.0 This document is mostly aimed at those who enjoyed using UE3. The actual UDN documentation is growing fast, so my main motivation is to point out things I struggled with and to suggest a learning path for my students. Tip: If you want to learn UE4 and don’t read the UDN documentation you’ll likely drown fast, in terms of getting anything made. Learn to keep UDN handy (bookmarks), and even have it open in your browser while working. You can get there from the UDK Help > Documentation menu. Do this now! You can also open it by pressing F1. Make a list of things you already know how to do in UE3 and try to reproduce those in UE4. This will expose to you a lot of things where change requires some re-learning. It won’t be long before you run into Blueprints, EventGraph, C++, VIMs, Slate and even provoke some crashes where you try to do things they way you used to do. For example, the Convert > Convert StaticMesh to InterpActor operation, in UE4t’s early beta versions, would crash it. This has been removed currently, and instead you choose Find in Content Browser (Ctrl + B) then choose Replace With InterpActor. An important difference to UE3 is that UE4 no longer has a separate Actor Classes catalog. Instead you’ll find blueprints under Class in the Content Browser, and also a Tools menu with many new object presets, including geometry great for grey-boxing (besides BSP).
  • 17. Getting Used to New Features 2.1 This shot shows my first ten minute stab at a scene in UE4 made from Engine base meshes only (with the Third Person project). Everything has a default material. So this is just transforms and cloning - ten minutes just to get used to that here. Note: the third person camera default goes through walls indiscriminately. Unbuilt objects tend to go black. [Edit: I’m informed on the forum that if you add a second UV channel in the mesh editor for a given asset and choose Generate UVs this will solve the black mesh problem, but I haven’t tried it yet]. This comment is out of date, but it matches up to the images: The Sample Content icon from the beta is now replaced by the MarketPlace in the Launcher, and you can see all kinds of examples to inspect. In the version I’m using the Launcher seems to be a little wobbly in connecting to the editor.
  • 18. EventGraph (Blueprints) 3.0 UE3 to UE4 feels to me a lot like going from a down-hill racer cart to a super charged muscle car. In UDK there was Kismet, visual scripting at the scope of the level (and through Prefabs at the scope of actors). In UE4 the blueprint works at the scope of the actor and is very flexible. There is also a scene blueprint. The mental jump is to figure out what belongs in the scene scope and what should be passed to an actor. If actions and events will always affect an actor in a certain way in any level, that should be written into the actor blueprint. The organisation of a blueprint is like this: Defaults (properties preset for this type of blueprint, ie Hidden in Game) Variables (anything defined by name, ie CurrentScore = 5, bAlive = true) Components (add content to this blueprint, ie = TriggerBox, Mesh, Sprite) Construction Script (operations that set up and initialize the blueprint when placed as an actor in the game level) Eventgraph (operations that influence the blueprint during game play) Click on each tab to switch between those panels. Variables are found in both the Component and Graph views. Construction Script and Eventgraph are tabbed together in the Graph window.
  • 19. EventGraph (Blueprints) 3.1 What in UDK is called an action is now called a function in UE4 to closer match the terminology of C++ programmers. Kismet in UDK has nodes under the actions. The eventgraph in UE4 has nodes down the sides but otherwise things are much the same in terms of hooking a Target to a Variable. A big difference is you can give the final value for a target via a chain of operators feeding into a target in the eventgraph function. In the image, the event is ReceiveTick (time passing in CPU time, not in frames per second). Delta Seconds which feeds Delta Time is the duration of the last tick, so far as I understand. In UDK an action called Get Actor Location and Rotation outputs vector variables from an assigned target. In UE4, since the blueprint is mostly likely referring to itself as an actor placed in the scene (bundled with components like meshes or collision volumes), the Target defaults to ‘self’. Blueprints are created and stored like a regular asset in the content browser and placed in the scene like a regular asset. An asset placed in the scene, including blueprints can be located in the browser using Ctrl+B. You can then right-click on the browser asset to modify it in the eventgraph editor. Choose Open in Full Editor.
  • 20. EventGraph (Blueprints) 3.2 Next to ‘self’ in a Target variable you’ll see a circle. It may be colored to indicate what type of variable it accepts. In the example below, there’s both an unfilled Target [self] and a filled Target linked to a variable Background representing a StaticMeshComponent in the world (as the pop up info below shows). On the right side of the function there are outputs, which are yellow in this case as they represent vector values. A vector is an XYZ or RGB value. What the second side shows is the Location of ‘self’ (the object this blueprint represents) being subtracted from the location of Background, which is then fed into a Break Vector function. This is equivalent to the Get Vector Components action in UDK Kismet. What it does is let the flow access any or all of the XYZ values separately so they can be modified further along in another function. In the image, just the Y value is sent out. The Y value is a Float, represented by a slime green color. String - Vector - Integer - Float - Object NB: In UDK an Object variable was purple and a String was green and a Float was dark blue. You also will come across Rotators, Transforms and XY values.
  • 21. EventGraph (Blueprints) 3.3 DISPLAYING TEXT ON SCREEN This example shows how to log an event as a function fired from the eventgraph. Log was the action to use in UDK. This has been replaced by a function called PrintString. In the example below we assume a TriggerBox is placed somewhere in the level via RMB > Add Actor > Trigger > Trigger(Box). This will show up in the Scene Outliner as TriggerBox and that’s how we’ll see it in Kismet naming too. Select the TriggerBox actor and in the eventgraph RMB and choose Add Event for TriggerBox > Add OnActorBeginOverlap. To get who is touching it, add a Get Player Pawn function and then add an Equals function and a Branch function. A Branch function is like the Compare Bool condition in UDK. These can all be found by typing their names in the new Search field (RMB in eventgraph). The PrintString, likewise, can be searched, and placed as shown. The connections show that if the actor touching the trigger is the pawn then the branch will fire as true, and do the PrintString. Any other overlapping actor will not fire the branch as true, so nothing would happen in that case. In the PrintString function itself, the In String is typed by the user Trigger Attached. The default is Hello. The ticked Print to Screen checkbox allows the text to draw on the screen during gameplay. The Text Color has been set to 0,0,0 (black). I’m assuming there are config files that determine the default text location.
  • 22. EventGraph (Blueprints) 3.4 This example is from the samples, for toggling a light. Understanding this may come as an Aha! moment for some, so I explain it below. Point Light Static 119 is just an actor in the scene, affected here by a Set Brightness function. Each time we press Enter (the InputKey event), we switch between firing the Flip Flop outputs A and B. Each affects the bool output (is A). It’s set by A to true, and by B to false. The bool value is converted to a Float value (True = 1, False = 0). The bit that confused me at first is the Subtract function which follows. If A is true, we subtract the bool 1 from the Subtract node’s value, also 1, which gives us 0 (1-1=0) ... 0 x 500 (the next node is a Multiply Float) gives us 0, which feeds into the New Brightness of the Set Brightness function, resulting in ... no brightness. Anything times zero is zero. So A represents lights out. If B is true, we subtract the bool 0 from the Subtract node’s value of 1, which gives us 1 (1-0=1) ..., 1 x 500 (the Multiply node) gives us 500, which feeds into the New Brightness of the Set Brightness function, resulting in a pretty bright light intensity. In Kismet, I wouldn’t have fed both A and B into the same function (or action). I would have had a different Set Float action for each, and probably a Modify Property for each accordingly. The point here is ‘why use more functions than you need’?
  • 23. EventGraph (Blueprints) 3.5 CONTINUAL ACTOR ROTATION TO FACE THE PLAYER On every tick, if the player camera location does not equal 0,0,0 (meaning, if the player is not in the scene) then set the current actor (a turret) to smoothly rotate till its rotation matches the current ‘look at rotation’ or direction needed to be facing the player. The ‘current rotation’ is obtained from the Get Actor Rotation calling ‘self’ since this graph goes with the turret, not in the scene (UDK uses scene based event flow and UE4 can do that, but favours per actor event flow).
  • 24. EventGraph (Blueprints) 3.6 PARENT / CHILD CLASS EXPLANATION 1/3 This is a brief account of how one blueprint can be established and then a child version of it can inherit what’s in it and add more stuff of their own the parent doesn’t share. A case would be a goblin template with as many unique goblin variations produced from it as you want. It is a bit like Parent material > Material Instance Constant in principle, but with blueprints. 1. Create a new class in a Custom folder under Game. Call it MyParent and set up some events as shown below. Optionally, create a mesh component in the Components panel using the roll down Add Component > Static Mesh and grab one from the content browser: I used the info mesh: StaticMesh'/Game/Assets/Meshes/SM_TextBox_Icon_Info.SM_TextBox_Icon_Info’. Whatever components are set in the parent blueprint will be sent into the child blueprint, but you can always override them, turn them off, or swap in different materials on a mesh or whatnot.
  • 25. EventGraph (Blueprints) 3.7 PARENT / CHILD CLASS EXPLANATION 2/3 Now we have a parent class, we can create a child of it. 2. In the content browser, RMB on the MyParent blueprint and choose Create blueprint based on this. 3. Call it MyChild and add a BeginPlay event, the right-click on it and choose Add Call to Parent Function. This is the important part … it gives you the brown Parent: Begin Play node. Add a string to show something happening for the child, as shown below. 4. Place the child in the scene, and see what happens on Play (Alt+P). Mine worked … and thanks to the brown function call, we get both the string from the parent and, after a 1s delay, the string from the child.
  • 26. EventGraph (Blueprints) 3.8 PARENT / CHILD CLASS EXPLANATION 3/3 Now we have a parent and child, lets look at changing something set in the parent where it gets inherited within the child. 5. In the EventGraph of the child blueprint MyChild, go to the My Blueprint panel and look for the tickbox Show inherited variables. By default this is off, and if we turn it on we can see the StaticMesh component reference (if you added one in step 1). 6. Drag the Static Mesh 1 variable onto the graph and when prompted choose Get. This lets us refer to that variable and set it as the target for a new Set Material function. 7. For the Set Material function, just click the textfield entry to pop up a list of textures available and choose one you like, or you can highlight one in the content browser like in UDK and click the assign arrow. If you click on the textfield you not only get a scrolling list of assets you also get a search field to filter the list. 8. Play and verify the Info mesh is actually changing material.
  • 27. EventGraph (Blueprints) 3.9 EVENT DISPATCHERS AND PARENT / CHILD BLUEPRINTS Now we have a parent and child let’s look at the Event Dispatcher commands. Event Dispatchers are like Remote Events in UDK. Well, a bit… In the parent class MyParent, in the My Blueprint panel, create a new Event Dispatcher, shown below (it might be >> out of view). Name it Do Stuff and drag it out onto the graph. You’ll see a command list, as shown below: Call means look up the dispatcher, from wherever we happen to be, which is cool because we might be in another blueprint entirely. In the blueprint you made in the last steps called MyParent, drag from the Do Stuff event dispatcher into the canvas and choose Call. Hook this up with your Event Begin Play event. Be sure to compile and save.If you don’t, you won’t see the new addition in other blueprints. Open the child blueprint MyChild. Check that Show inherited variables is ticked. Then check that Actor > Event Dispatchers shows Do Stuff. Drag Do Stuff onto the child blueprint’s graph and choose Assign. This adds two connected nodes which are automatically named, shown below. In the above steps the Do Stuff dispatcher was called in the parent as soon as the player touches an added Box component in the parent blueprint.
  • 28. Blueprint Interfaces 1.0 An interface is a list of function names and parameters which exist in one spot. Other blueprints can take those and implement them. Don’t worry what ‘implement’ means ... Essentially the functions exist elsewhere from where they are used in order to save redoing the functions often. To create an interface, go to the content browser and RMB and choose Miscellaneous > Blueprint Interface. Call it BPI_MyInterface. When you open it you’ll only see the +F function icon. Create a new function called IF_MyFunction (NB: the IF_ stands for Interface Function, not if statement … you could just leave it off). In the Details section, click on the New button in Inputs, and create two parameters, a bool and an int. Called them IF_INT and IF_BOOL. These are examples only. Notice these will show up in the function icon in the graph. How to handle the interface in another blueprint? Check this out: https://answers.unrealengine.com/questions/4964/how-to-have-blueprints-pass-variables-to-each-othe.html The broad idea here is you are making a really open functionName (parameterNames){ … }; situation which lots of blueprints can call on. You can also add Outputs, and this creates a ReturnNode in the graph with the variable name and a channel to hold a value. Note: I made an output Integer (shown below) called MyReturnedInt. This gives us a basic function and a couple of parameters to feed later on. Creating Interface On the left we see the node you can drop into any blueprint once you’ve compiled and saved your Blueprint Interface. See how the MyBOOL and MyINT (with friendly names) are shown in the node on the left as inputs. And the output is MyReturnedInt on the right, that I added to the interface too.
  • 29. Blueprint Communication 1.0 Without using an interface we can still get blueprints to talk to each other. The steps are possible to shorten and re-use, but it takes a little while to set up. 1. Make an object variable in Variables that points to the class you want to talk to, or target, for instance MyActor targets MyPlayerController. 2. Initialise the value for the variable … this is a bit of weird process in my opinion, but we’re going to show it over the next few pages. 3. Call a function in the blueprint you’ve targeted using the object variable to look up what’s available there. In this example we will make a PickMeUp actor blueprint that contains a ball mesh and when we Hit it by running into it with the Pawn, then this will call a function in the GameMode class blueprint PickUpGameMode (this exists in order to let you establish rules like scoring). The first step is to create the PickMeUp actor in the content browser. Put it in a new folder under Game. The second step is to create a mesh component for it and give the component a name (or you could just use StaticMesh1, the default). Set the Z value to about 48 so it sits on the ground when placed (its Root is still at 0,0,0). I used an Arrow component for the Root component. Add any material you like in the Rendering panel from the content browser. Place a number of these around the scene. Keep count of how many there are. Then save the map in your project and save the PickMeUp actor. In the same folder, RMB and choose New Blueprint and from the pop up window, choose GameMode. Call this new asset PickUpGameMode. This is where we will do the calculation and comparison for the player actually picking up the items. In the GameMode Defaults set the Pawn as MyCharacter, so you have a third person pawn that can collide with things in the scene, not just a floaty default camera. Once you have created it, open up again PickMeUp actor and in its Graph > My Blueprint panel, click on +V to add a new variable. Call this GameModeVar in the Details panel and set the Variable Type as Object, looking up PickUpGameMode_C. Make it Editable and write a Tooltip. That takes care of creating the variable which will allow us to look up any custom event, function, variable from our actor to our gamemode class.
  • 30. Blueprint Communication 1.1 The object variable in the PickMeUp blueprint should look like this: Now in the My Blueprint panel click on the +F button to create a new function. Call the function UpdateGameModeVar, or something like that. You can see mine in the image on the left. Double click on it to open it. Use the RMB contextual menu to add Get All Actors of Class, and in its Actor Class field choose the blueprint you made called PickUpGameMode, which should be in the list (if you saved and compiled it before). From the Out Actors output, which produces an Arrray type, RMB and choose Get, and connect the Array icon as shown below. Be sure to drag from the blue output of Get to look up Cast To PickUpGameMode … if you just RMB and search for it via the regular contextual list it won’t be found. Once you have that, drag GameModeVar from your variables list in My Blueprint and when you drop it you can choose Set, and hook up the wires as shown below. What this sequence does is ensure that when we refer to GameModeVar later it will be populated instead of being ‘None’.
  • 31. Blueprint Communication 1.2 That function, to really be complete, needs to actually call some function in the PickUpGameMode blueprint. First we have to make it there. Open up the PickUpGameMode blueprint and make an Integer variable called PickedUpItems. This will store a value for how many items have been picked up during the game. After that, create a Function called UpdateItemInt. This is what we’ll call in the PickMeUp blueprint. Here’s the UpdateItemInt function - it’s just incrementing the item count and displaying it on the screen. Everything in this sequence can be added by dragging out from the variable Get PickedUpItems. The + operation is called Integer + Integer. The one that looks like a dot is a condensed conversion node To String (Int). But you can add it automatically just be dragging from the Int variable to the In String of the Print String node. Before we go back and call this function, let’s add to the PickUpGameMode blueprint’s eventgraph the following loop. What this does is every half a second compares the value of the int variable PickedUpItems to 5. So when our function increments to five, it stops!
  • 32. Blueprint Communication 1.3 The magic part, so to speak, is just to call the function UpdateItemInt we just made in PickUpGameMode from the actor blueprint PickMeUp. Everything we set up before should enable this to happen smoothly. Before, we made the function UpdateGameModeVar in PickMeUp. To complete it, just drag the GameModeVar variable to the end and choose Get when dropping it. From the output of the variable, choose Call To Function > UpDate Item Int, which is the function in the PickUpGameMode blueprint. Set the object variable GameModeVar as the Target of the function call, as shown below (and add a Destroy Actor node to get rid of the picked up item). The ReturnNode shown is probably optional. It was added for me because I set up all this in the eventgraph and selected the whole chain and chose Collapse to Function.
  • 33. Blueprint Communication 1.4 Having done all that, we just need to set up the event for when the player touches the actors in the scene. In the eventgraph of the PickMeUp blueprint, add a Collision > Hit event (which is a physical impact or collision between two meshes). The Other output is whatever thing hit the actor. We want to check and make sure that’s the Pawn, so we use a Get Player Pawn, and compare its Return Value with Other. If they’re the same, the True condition (a local bool) in the Branch executes. If not, nothing happens. To add the comparison, RMB on the graph and type Object in the field, and you’ll see Equal (Object) in the list, which displays as the == node Lastly we call the function UpdateGameModeVar, which is what we built before in this blueprint (so Self is the Target). Easy, eh? When you play you should see logs that display a number incrementing up to 5 and then a final string *** All Done *** when all five actors are hit.
  • 34. Using Arrays 1.0 Arrays in Blueprints in UE4 are a lot like Object Lists in Kismet in UDK. So far as I can see, they’ve just updated the nodes to have more C++ sounding titles, as you can see in the image below. Here’s what you can do with a list of actors, or do with the actors in the list: Create an array - Add items to the array - Remove an item - Clear the entire array - Get the number of items in the array - Check if a specific item is already in the array - Set an item into a particular index or slot in the array - Resize the array to include only items up to a certain index. So what’s an example? Let’s say you want to get all the actors of a certain Blueprint (or Class) in the entire scene, or even within a certain distance of the player, and you want to sequentially hide them. Get All Actors of Class is an event graph node which returns an array filled with whatever actors that matched. That’s the easy part. Now you’d need to operate upon each actor in the array until each one was hidden (or whatever you wanted to do) until the array had been totally hidden. In UDK, the easy way to do this was to use ‘Access Object List’, then ‘Modify Object List’ using Remove. You’d access each item and hide it and then remove it from the list, and then do the same thing again on whatever items were left. You’d then use a ‘Compare Int’ against 0 for the total number of items still left in the list, so you’d know to stop looping back through the list when it was empty. When you want to affect a lot of things together as a set you need to use an array.
  • 35. Using Arrays 1.1 The example we’ll use comes from the UE4 Answers Hub, where someone was asking about toggling on/off a lot of lights with one switch. An example of this can be found in the Content Examples, but I thought I’d try it myself based on how I’d go about it in UDK, more or less. It sounds easy to turn on/off lights from a switch. I was surprised by the bulky graphs I ended up with (see previous page). Probably there’s an easier way. But at least I figured out Arrays in UE4. What we need to do is make an actor blueprint called MyLamp and an actor blueprint called MySwitch. You’ll also need a custom gamemode and custom PlayerController blueprint based on the defaults, all of which should be saved in a Custom or YourName folder under Game in the Content Browser, as above. In my project I don’t have a pawn with a mesh to Hit or Overlap the switch, so I decided to use a distance comparison as a way to tell if we’re at the switch or not, then make a keystroke event in the PlayerController activate the lights if we’re close enough to the switch. Why put the input event in PlayerController? Well, input kind of comes from a controller like a keyboard, mouse or joystick or touch screen. Also, the event being there makes it free to send out to any blueprint you want, as you’ll always have access to the PlayerController in any level. If you’ve read the previous sections on blueprint communications you’ll remember we set up an object variable, in this case MySwitchVar which represents the blueprint MySwitch_C, and the above sequence sets up that. Remember to correctly set the object variable properties. Note that in the image we call a function in MySwitch called SwitchPress. You cannot call it before you’ve added it there of course and the blueprint must be placed in the scene to find any actors of this type. It’s important to know that the array in question here consists of the obtained MySwitch blueprint actors (out actors) and we Get the entry 0. 0 is the Index of the 1st entry in the array, 1 is the 2nd and so on. That’s just how it is. Starting steps
  • 36. Using Arrays 1.2 The MyLamp actor needs a mesh component and a light component. I also added a TextRender component so I could flip the light on and off and display text for that - you could do a lot of things such as adding sound or changing the color of the switch. I wound up using the text string in the TextRender component to check for whether or not the light was currently on or off, but a bool could also be used. The default properties for the PointLlight and TextRender are shown in the image below. You might to add walls around the scene so you can really see the lights are shining when they are on. Once you have compiled and saved the MyLamp actor, place them as you wish in the level, as many as you wish. The MySwitch actor needs a mesh component - I chose a gold pyramid, and put it on the table. Notice that each component is represented by an object var created for you in the My Blueprint panel so you can reference it in the eventgraph. You can name these yourself.
  • 37. Using Arrays 1.3 Let’s look at the custom function you’ll next add called SetBrightness for the MyLamp blueprint (which we’ll call from MySwitch). SetBrightness will either brighten or dim the light via a Branch (hold b and click). The condition for the branch could be based on the brightness value, or a bool value, but I chose to use the string of text in the RenderText component. There’s a string comparison Equal (String) that looks like == where the current displayed text is either ON or OFF, so we can use that to figure out which branch to execute. From the RenderText variable we can produce a node called Set Text which flips the current string. And from the variable TheLight, we can produce a node called Set Brightness which takes a Float value. 0 is no light, and 5000 is a lot (it is also the default set in the blueprint defaults). Effectively we’ve created a Switch or Flip Flop. Next we’ll look at what fires our new SetBrightness function. Note - there is nothing in the eventgraph part of MyLamp. The function by itself is all we need.
  • 38. Using Arrays 1.4 In MySwitch, the graph is probably the most complicated so far, and this is where we really test out using the array functions. Just remember: to create many of the nodes shown below you need to drag from the blue variable outputs to expose relevant nodes by context. This graph is explained in the next slide too. The gist is that from any array of MyLamp actors we chain through the entire bunch, calling the Set Brightness function in MyLamp only if the player pawn is near the MySwitch actor, within 99 units. After each distance check we remove the obtained actor from the array and start over with what’s left until nothing is left. The CompareInt (against 0) checks the Length of the array to establish whether the array has been emptied out. Note that later on when we call the SwitchPress event (from MyPlayercontroller, everything resets). So this process is a loop that dies out if you are too far away from the switch or if SetBrightness has been called on all the array items. The calculation is super fast, so even if you had dozens of MyLamp actors in the scene, they’d all turn off at once. (Add a Delay to slow it down).
  • 39. Using Arrays 1.4 So what nodes are relevant to affecting the array? The first thing is we get all the actors of a certain blue print type. Then we use Last Index to return the entry number (or index) of the last in the list, and we Get that in order to cast it to our object variable MyLampVar. Then we get from the array its Length, or how many items are in it. This value is obtained when we capture that actors, but it also updates (I guess) when we Remove from the array the particular item we set as MyLampVar. This ability to get the last item in a list, do something to it, remove it, then check the new last item is super handy in visual scripting. The Clear node is used when we press T (via MyPlayerController and call the SwitchPress event). Clear strips out everything from an array, which is just a safety measure since we next use Get All Actors of Class again, allowing us to cleanly repeat all of this whenever we wish. Look back to Using Arrays 1.1 for the T input event, and how it calls the custom event SwitchPress.
  • 40. Basic Coding in Blueprint - Making a 24 hour clock 1.0 This is a demo I did for students in about their third hour using the graph editor. It requires understanding what is a String variable, and that there are some string functions like Append (joining or concatenating them) and LEN (return the number of characters in a given string). It also requires understanding of an Integer, and how a CompareInt works to check whether two numbers are equal or which is greater or lesser. The case is to make an actor (the clock mesh is entirely optional) which includes a Draw Text component, and update it every second via a function we create in it. Challenges include - making numbers less than ten look like 01, 02, and not look like 1, 2 etc. - making seconds and minutes reset after reaching 60, and hours after 24. - toggling visibility for a second text display of the number of days and adding sounds (chimes) to notify the change of each hour or day … although in practise it’s unlikely you would continually run the game for longer than an entire day. The example could be used not only for a functional clock but for counting the total playing time in days, hours, minutes and seconds, if the results were saved and loaded .. but for now, let’s just do the blueprint graph to update and display the time as shown in the image above. The first step is to create a new Actor blueprint in your folder under Game in the content browser. You could opt to execute this whole process as a HUD blueprint feature instead, rather than within an actor placed in the level. You’d just use the HUD function Draw Text instead of the Set Text function for Render Text component added to an actor. The cute mesh I made for the clock is available totally free as a 2k triangle FBX you can import into UE4 from your project’s Content folder. Dropbox location: https://dl.dropboxusercontent.com/u/9344219/FreeClockModel.FBX Once you have the model in UE4 you can double click on it and choose Generate Unique UVs in UV Channel 1 to get a nice texture distribution on the model. I didn't UV it externally since I only needed to apply some flat colours. With or without UVs, it will need materials assigned to its 4 material channels within the editor (in the Details > LOD0 settings).
  • 41. Basic Coding in Blueprint - Making a 24 hour clock 1.2 The actor components looks like so: The Arrow on the Root is just for a direction indicator. We don’t use it here. Next we add and name a Render Text component as TimerText, and add another and named DaysText. Naming the components is important because they are automatically added as object variables in the event graph panel (My Blueprint). The ClockMesh variable is a StaticMesh component using the imported mesh provided on the previous page. This is optional really. If you want to have the clock face surround the displayed time, then you’d adjust the location, rotation and scale settings of the components so they line up in the preview window. Make sure the Timer text would fit. Try it with 24 : 24 : 24 That’s it for components. Now we’re ready to start editing the Graph to add functionality. You can drag and drop the actor in the scene and save both the scene and actor just to be sure. In the example we’re doing, we won’t set or reset the time. It will always start from 00 : 00 : 00 when the game begins. If you did want to access the time value during gameplay, you could obtain the time result in your GameState class for example by making an Object Variable that looks up this actor’s class (See Blueprint Communications). To edit the actor blueprint, just select it in the content browser and double click it, or in the scene and choose Ctrl + E.
  • 42. Basic Coding in Blueprint - Making a 24 hour clock 1.3 The first part of the graph to set up is a function, and a set of variables to carry the time values. In the main event graph, RMB and grab a Custom Event, and call it UpdateTimer. In the My Blueprint panel, create a Function (+f icon) and call it Timer. This will throw you into a new tab for this function. For now, just go back to the event graph tab. Add the variables shown on the right. Notice the components we already added are showing too. Seconds, Minutes, Hours and Days are all Integer type variables. Add them, compile and then set the Default Value for each of them to 0. DisplaySeconds, DisplayMinutes, DisplayHours, and Zero are all string type variables. They will hold text to be put into the Render Text components of the actor. The integer values are used in the incrementation math each second, and we convert the results into strings to display. To change the Default Value for any variable, scroll to the bottom of the compiled variable’s Details. If you plan to access the time via other blueprints or classes, then you may want to set the integers to be Public by clicking the eye icon. In the event graph hold P and click to add an Event Begin Play node. This fires when the game begins and gets things rolling. So we have these two events so far:
  • 43. Basic Coding in Blueprint - Making a 24 hour clock 1.4 Next, drag the component variable DaysText onto the canvas and when prompted choose Get. This lets us reference that component and do stuff to it. What we want to do is hide it when the game starts, as when the clock starts off, we’re still in Day 1. Of course, you could make it display something instead if you prefered that. After a day, this gets unhidden. The function to hide the component can be obtained by dragging off from the blue output pin of DaysText and searching Set Hidden. This will produce Set Hidden in Game. Connect up its Target to the DaysText pin. From the UpdateTimer custom event connect to a Delay (hold D and click). Set the Duration float value to 1 as this delay is what will provide us with the passing of time effectively. Since in the first steps we already created a function called Timer, we can now call that, by RMB and expand the Call Function category to reveal it there.
  • 44. Basic Coding in Blueprint - Making a 24 hour clock 1.5 Now we need to populate our Timer function with incrementation of the seconds, minutes, and hours, as shown below (hopefully it’s readable)... The highlighted node are CompareInt functions. This check is running so that, as we add 1 to the Seconds each second, if the Seconds value gets to 60 we’ll be able to reset it to 0. The entire Timer function we’re building now will loop,as the last node we’ll be adding will fire the CustomEvent we put in the actor’s event graph, called UpdateTimer. The additional node shown is a Play Sound Attached function. I added a custom beep cue, but you can import any WAV to your project folder and RMB on it aftering importing and choose Create Cue, and then assign it to play when the Hours value increments (when minutes = 60).
  • 45. Basic Coding in Blueprint - Making a 24 hour clock 1.6 You will have noticed the previous image shows execution wires shooting off from the CompareInt which I commented with 24 HOUR CLOCK. The next part of the graph handles the updating of the day changing - though bear in mind to test this part out it will take all day of playing. What happens here? Once we reset Hours after 24 have passed, we unhide the RenderText component DaysText which was hidden in the actor event graph. To do this, use a Set Hidden in Game function again, but this time set the New Hidden bool off (or false). We then display either the integer values Days + “ Day” if Days is equal to 1, otherwise it will display the integer value Days + “ Days” if Days is greater than 1. To add the node called Set Text you just need to drag off from the component variable's blue pin, in this case DaysText. And again we play a SoundCue on the change of each day, which could be a cockadoodle sound I guess. At the end of this chain, you’ll see a new CompareInt commented Digits. In the next section, we make sure that if seconds, minutes, and hours is less than 10 it will display as 01, 02, etc instead of displaying as just integers 1,2, etc.
  • 46. Basic Coding in Blueprint - Making a 24 hour clock 1.7 The final block starts from the CompareInt commented as DIGITS (from the previous page). The Input to it is the LEN (length) of Seconds as a string, where the integer value is converted to characters. LEN returns how many characters are in a string. Our CompareInt compares with 2, so if the Seconds value is 0,1,2,3,4,5,6,7,8 or 9 then its LEN value as a string would be 1. 1 would fire the < pin on the CompareInt and lets us Append (in input A, as prefix) a string Zero (which has its default value set to 0), so “1” becomes “01”. For higher integers, if the LEN produces two characters, we don’t need to append anything. We run this check on Seconds, Minutes, and Hours. We don’t need Days. Once we have the correct digits in the string produced from the current value of Seconds (01 instead of 1 if needed) we store it in a string called DisplaySeconds, and we do the same for minutes and hours. We then get TimerText, the component of the actor in which we Set Text to be the combined time, 05 : 11 : 38 for instance. After that, we call the custom event UpdateTimer. This makes the Timer function repeat after 1 second.
  • 47. Character Animation 4.0 Open existing blueprints and study them to see how they work, particularly those used in the default game-type templates. Blueprints are found in the content browser (in UDK it would have been the Actor Classes tab and you’d have to inspect them externally via unrealscript). In UE4 you just double click on them to open the blueprint editor. A good starting point would be the /Game/Blueprints/MyCharacter blueprint in the third person project. It handles movement, turning and jumping. The InputAxisTurn, Lookup, and MoveForward events are established in code. They receive controller input (keystrokes like WASD and mouse motion). In the graph, they wire up to the appropriate functions and execute them. The code equivalent is Event activated(). In this example the event InputAction Jump receives a button press from the player and feeds out to the Jump function. To be fair, the function graphs in this blueprint are all pre-coded for the particular game-type template ThirdPerson and they are hard to expose. Properties that relate to a function may be found under the Defaults section - ie Jump Z = 500 (I say jump, you say how high?) Tip: To enable character crouching, search crouch in the Defaults to expose the tickbox for Can Crouch. Note - this does not actually make the character crouch, it just enables it. For that you have to add an input key, and graph functions related to crouching (and specify mesh animation). In the next slide, we’ll set up the ThirdPerson character so it can crouch and uncrouch.
  • 48. Character Animation 4.1.1 MAKING THE THIRD PERSON TEMPLATE CHARACTER CROUCH First set up a hotkey. To do this go to Edit menu > Project Settings > Input. Within Action Settings press the + icon. Then scroll down to the new entry and specify the Action Name Crouch and the Key as C. Now in the MyCharacterBlueprint add the following (don’t worry about the fact you’re editing default content - you can always remove this later). Right click on empty space to show the function list, and type in the search field: crouch as shown in the upper right image. This will expose the Input > Action Events > Crouch event and the Call Function > Character > Crouch action as well as the Un Crouch function. Add them all. Next add a Flip Flop, which can be found the same way, using RMB and search. This is a Flow Control function which takes an input wire then feeds out first A when fired, then B the next time, and so on. The Flip Flop is equivalent to the Switch action (with two links) in UDK. The comment box can be added last. Select all the nodes and RMB and choose Create Comment From Selection. If you were to play now, you’d notice only the camera drops when you press C. The character mesh doesn’t change, because we haven’t told it to yet. We’ll do next using the character’s VIM asset. Tip: If you wanted to do a blended change from standing to crouch and back, you’d use an InterpTo function. We’ll try that out here.
  • 49. Character Animation 4.1.2 EDITING THE THIRD PERSON TEMPLATE CHARACTER VIM TO INCLUDE A CROUCH ANIMATION In the previous section we set up crouching input and the crouching functionality for the player camera. Now we need to animate the character. Back in UDK, we’d use an AnimTree and call an animation from the AnimSet library. In UE4, this has been rebranded as Persona and VIM. The problem is there is no Crouch animation in the UE4 assets to add to the existing set of animations for the character skeleton we’re using. We could use a direct bone translate down on the Pelvis and a two-bone translate up on the feet, but that would only be a marginally useful approach as the relative offsets probably wouldn’t sit well with the animation of the character moving. We have to digress a bit and reproduce the assets ourselves, import them, and create a new Character blueprint, and assign it to the game type. https://www.dropbox.com/s/gqi5fwe9lwe8wmc/ManMesh_Idle.max The 3ds Max file is provided so you can subsequently add your own motions. It’s 2mb. Note that while the model is the same, the rig is different, so the default UE4 character’s animations can’t be extended with your own. You’ll have to replace them all from scratch, a somewhat daunting task perhaps, particularly given that, from game to game, animations required may differ. I did my example by knocking up a 3ds Max FBX version, but it’s probably a better idea to use the Jeremy Ernst rigging tool ART (Automated Rigging Tool for Maya which comes with the editor in the Extras folder). From ART you can quickly style biped character meshes that are auto- skinned to the rig. See the Jeremy Ernst videos on the Unreal Engine youtube channel. PERSONA This refers to the editor you use to set up animation blueprints (VIMs) . It is actually a collection of editors nested together. The official documentation at this point is definitely a necessary read. Go to it, settle in with a mug of cocoa or whatever, and read it carefully. https://docs.unrealengine.com/latest/INT/Engine/Animation/index.html
  • 50. Character Animation 4.3 IMPORTING ANIMATION In the previous section we mentioned assets need to be created externally (a set of animation clips to represent the possible moves a character can make). To import these, first import the FBX which represents the bind pose, without animations as such, just the skinned mesh. In the Content Browser, right click and choose Import to Game. For the first case, click the SkeletalMesh radio button. Save that asset. After that, import one by one the FBX files which include animation and set them to be governed by the already imported skeletal mesh. For the animations, click the Animation radio button and then click Select Skeleton > None and replace that with the desired skeleton. Skeletal Mesh assets are light blue and Animation Sequence assets are green in the content browser and in the Persona asset browser. Having imported the character assets, right click in the content browser and choose Other Assets > Animation > Animation Blueprint (which will show as a dark brown icon).
  • 51. Character Animation 4.4 BLEND SPACES To begin describing how certain clips relate to each other we can create an asset called a BlendSpace in the content browser (RMB pop up menu > Other Assets > Animation > BlendSpace. When you create it, you have to pick from available skeletal meshes to base it on, as we did when importing animation FBX files. An example is the RunTPP BlendSpace for the default third person player. Double clicking the new asset will open up the Persona editor, ready to edit this asset. The UI for the blend space area is not very well distributed - best to have two monitors. The Asset Browser in the Persona editor will show all the available clips (green) that may be used by the BlendSpace. Drag clips onto the canvas (which very likely you’ll have to first expand to view properly). Here’s a little video of me setting up a BlendSpace, with explanatory captions: https://www.dropbox.com/sh/on05lf81upn28u8/Tmw9HNC_AN The main idea is that points located on a grid form a kind of aim space (like the Aim Offset in UDK’s animtree). Each point represents the ‘100% on’ state for an animation clip, and any point in between is blending. The nearer the mouse is to the points the stronger that point will play. Key input can then be mapped to the points in the BlendSpace, with a timer doing the graduation in between. For instance, if someone is running and they release the run key the BlendSpace transitions to a stop (not an immediate jolt). Parameters for speed and input would be set in the character blueprint.
  • 52. Character Animation 4.5.1 STATE MACHINES 1 Today I am looking at State Machines, used in the Persona graph of the ThirdPersonPlayer character, and I am wondering what these are for. So far as I can see a State Machine visualises animations via a flow or schematic a bit like the AnimTree in UDK, but the direction of flow can be all over the place in UE4. The flow uses conduits affected by transition rules. This is new UE4 terminology. https://docs.unrealengine.com/latest/INT/Engine/Animation/StateMachines/index.html This page has some illustrations which clarify things … somewhat but you have to plan for yourself how to implement them for your case. I guess an example of flow would be as follows: Going from a lie down on the bed pose you have to stand up before you can play a standing greeting, but from a stand up pose you can also flow to many other standing actions, as well as lying back down on the bed. But you never want to play ‘standing to lying down on the bed’ if you are already lying down … and so it goes. All State Machines start with an Entry icon. A State is kind of like a marker for an animation or set of animations that typically play under certain conditions. A rule determines how that state may be activated or turned off in favour of another. Here’s a State in the schematic, followed by the eventgraph that state represents (from UDN documentation). Play Idle_Ready is equivalent to a Play AnimSequence in UDK’s AnimTree. Rolling the mouse over a State shows a floating preview of its content. In the schematic view States have no pins. They are intended to have a more freeform layout. To connect a state to any other state, simply drag a wire from its outer border. Dragging off a State into empty space allows you to create a new State linked to it. You can also auto-create a State by dragging an animation clip from the Asset Browser into the State Machine editing canvas. It gets named after the animation clip.
  • 53. Character Animation 4.5.2 STATE MACHINES 2 Today I am looking at State Machines, which are created by right clicking the Animation graph, and it seems they are there to provide a way to relate different clumps of animation performance using flow rules, driven by use created variables (think, bPlayer1InCombat, bPlayer1Dead). A Transition Rule is represented as arrows flowing along the links between States. They are icons representing a graph which sets its rules. Here’s an examples from the UDN documentation. It shows a Rule icon and the graph establishing the requirement of the transition at hand: Only if the speed variable is greater than 10 will the conduit permit flow (from Idle to Moving in this example). It’s a little bit like using a Compare bool or Compare Integer to control a Gate. A different rule can be added for a link flowing back from the Moving state to the Idle state. The next concept to introduce is that of a Conduit. Imagine you have a sports car in GTA and you’re going to walk to it before getting inside. You’d flow your Walking movement state into a conduit and then from the conduit link to either one of DriverDoorEntry, PassengerDoorEntry, BootOpen or alternatively flow to GetRunOver if the car happens to be moving really fast at the time and you are in front of it. The documentation example show on the right is for handling death using a Killed conduit. Note there is no reverse flow out of these rather final states.
  • 54. Character Animation 4.6.1 SETTING UP ANIMATION BLUEPRINTS So, when do we actually define or call a State Machine (or a BlendSpace for that matter) in our Animation Blueprint? An animation blueprint’s Eventgraph updates values used by BlendSpaces (and other blends) within the AnimGraph to drive animation changes. “For example, the EventGraph of an Animation Blueprint could use the velocity of the owning Pawn to determine direction and speed. These two values can then be used as inputs into a Blendspace within the AnimGraph to blend between an idle animation and various directional movement animations. Similarly, the pitch and yaw of the owning Pawn can be used as inputs into another Blendspace to blend between various aiming poses applied additively in order to cause the mesh to aim where it is looking while still maintaining the previously mentioned movement animations.” https://docs.unrealengine.com/latest/INT/Engine/Animation/AnimBlueprints/index.html To create a new Animation Blueprint (to reverse engineer the setup of the TTP one) RMB in the content browser and choose New Animation BP. Specify the Parent Class (AnimInstance) and Target Skeleton asset. Name the new blueprint and right click on it and go to Properties.
  • 55. Character Animation 5.6.2 SETTING UP ANIMATION BLUEPRINTS In the new Animation Blueprint properties, we can view and set up variables it will use. Speed (Float), Direction (Float) and bIsInAir (Bool) are the ones we need to add to match the TPP version. Variables can be added in the Properties of the blueprint, or in the My Blueprint palette of the opened blueprint (as shown below on the right). In properties, the + icon lets you add additional variables (as shown below on the left). Speed and Direction are used in the character’s BlendSpace - these automatically blend to the eventgraph’s updated values during the game.
  • 56. Character Animation 5.6.3 SETTING UP ANIMATION BLUEPRINTS When we created our blueprint we used the TPP skeleton (the ThirdPersonPlayer asset that comes with UE4). There’s a BlendSpace called TPPRun that relates Direction and Speed variables it includes to a set of animation clips, determining which clip to play based on variable value. So, all we have to do is drive Direction and Speed values and, because the TPPRun BlendSpace belongs to the TPP skeleton, they will be used.
  • 57. Character Animation 5.6.4 SETTING UP ANIMATION BLUEPRINTS When we created our blueprint it created for us an AnimGraph with a Final Animation Pose node. It took me a while to figure out this part and I may be wrong (as always). Right click next to the node and expand Animations and choose Blendspace ‘RunTPP’ (or your own if you have one). Now I’m not sure what to do. I tried RMB > Variables > Default > Get Direction, followed by Get Speed. I connected these to the Direction and Speed inputs into the Blendspace node. Then I compiled and it seems to work. But I feel something is missing as there’s nothing to tell it to jump. Maybe I need to instead add a State Machine with the blendspace part in one state, make an Idle and make a Jumping state and a Walking state., and put the RunTPP blendspace in the Walking state. The next page shows the internals.
  • 58. Character Animation 5.6.5 SETTING UP ANIMATION BLUEPRINTS A new State Machine is created from the right click menu. Hook it up to the Final Animation Pose and then double click on it to edit it. The image below shows what we’re aiming for: Entry is there by default. Drag and drop the Idle animation for the Asset Browser tabbed under the graph editor. This will auto-populate a new Idle State on the canvas, as shown above. You can roll the mouse over it to see the playing clip inside the State. Right click and add a Walking State. In here add the BlendSpace ‘RunTPP’ and the Get Variables for Direction and Speed as on the previous page. Add a Jumping State, and inside that put a 1D Blend State (create a new asset and drop the Jump clips into it Start-Looping-End). Between the states drag connecting wires in both directions. These are the required transition rules for each wire direction. Idle to Walking : Speed > 0 Walking to Idle : Speed == 0 Walking to Jumping : bIsInAir Jumping to Walking : Not bIsInAir
  • 59. Character Animation 5.6.5 SETTING UP ANIMATION BLUEPRINTS A way to double jump. The bool bIsInAir exists in the animgraph of the HeroTPP asset. As we saw on the previous page we can use bIsInAir to drive a Transition Rule (or gate essentially) for the character’s Jumping animation. We add a bool caled bPermitDoubleJump and an Integer variable called PressedJumpCount. Each time the jump button (Spacebar usually) is pressed AND bIsInAir is true, we increment the value of PressedJumpCount. If it’s greater than 1 we set bPermitDoubleJump to false. When bIsInAir is false when we press jump, we reset the integer to zero and set bPermitDoubleJump = true. Notice that the variable names are written in friendly format in the graph. bPermitDoubleJump reads as Permit Double Jump.
  • 60. Character Animation Input 6.0 MAKE THE CHARACTER WALK IN THE DIRECTION OF THE CURSOR SCREEN LOCATION In the character blueprint we can launch the character in the direction of the mouse cursor. Usually the launch function launches the character by a velocity relative to the map. In this case when the player presses LeftMouseButton they’ll move relative to the cursor position. To accomplish we modify the Character blueprint to cal Get Player Controller, from which we can drag off the Return Value into the Convert Mouse Position to World Space function. That function returns World Position and World Direction. World Direction is what we're looking for to combine with a Magnitude, which we’ll feed into a Launch Character function. Simply connect the World Direction * Magnitude result into the Launch Velocity vector input and connect an Input Event (LeftMouseButton for this example) to the Launch Character execution pin. f The Magnitude value determines the speed of the character. Ideally you’d set it in a global fashion to affect WASD movement too. Note that this doesn’t specify any particle method to orient the character to face that direction or play a mesh animation. It just kicks the player along the vector, which would work well if the character was a flying saucer or some other round or uniform shape. We could use an RInterpTo method similar to the one we did earlier with the billboard in order to make the character face the cursor location when the player clicks.
  • 61. Character Animation Input 6.1 MAKE THE CHARACTER WALK IN THE DIRECTION OF THE CURSOR SCREEN LOCATION Here is how the ‘move to mouse’ functionality is laid out in the Top Down game template.
  • 62. User Interface (Slate) 7.1 Slate is a mark up language used to create widget-based UI interfaces (ie, drown down menu, chat windows, tabbed panels). The entire GUI of UE4 is written in Slate. If you want to learn to use Slate these are suggestions for things you should research: - Draw a panel on the screen - Permit mouse control (custom cursor, detect clicking, mouseover, mouseout, click outside etc) - Permit game paused in background while cursor is active (to freeze camera look and player movement) - Make a button (with states) that opens and closes the panel - Create an event to show and hide buttons - Create a toggle to pause gameplay when a certain panel is exposed - Create a toggle to pause gameplay when a certain panel is selected - Embed a button on a panel that allows it to be closed - Create an event that sets a button to be enabled/disabled - Create an event that preserves its pressed state until another is pressed - Make the panel draggable in the viewport - Add text to the panel - Add a slider to scroll the text in the panel - Add a graphical image to the panel content - Add a graphical icon to the button - Add drop down, tooltip, and roll out features to buttons - Make sliders, steppes, tickboxes, input text, radiobuttons and other CLIK style widgets
  • 63. User Interface (Slate) 7.2 Slate currently has sparse documentation. Macros are used to create and populate widgets: SLATE_BEGIN_ARGS( SSubMenuButton ) : _ShouldAppearHovered( false ) {} /** The label to display on the button */ SLATE_ATTRIBUTE( FString, Label ) /** Called when the button is clicked */ SLATE_EVENT( FOnClicked, OnClicked ) /** Content to put in the button */ SLATE_NAMED_SLOT( FArguments, FSimpleSlot, Content ) /** Whether or not the button should appear in the hovered state */ SLATE_ATTRIBUTE( bool, ShouldAppearHovered ) SLATE_END_ARGS() This Slate example is from the UDN documentation.
  • 64. User Interface (Slate) 7.2 Slate can be understood by looking at examples. You can at least see the names of the widgets available using an inspector within UE4 found in the Window menu > Developer Tools > Widget Reflector. When the Widget Reflector is running a new window opens (itself ‘reflectable’) that shows whatever UI elements the user has their cursor over, which highlight with green frames, as shown below, in the case of the Compile button content. To enable highlighting click on the Pick Widget button: The UI elements reveal what .cpp class they can be found in and the widget type.
  • 65. User Interface (Slate) 7.3 Slate commonly used widgets: SWindow - Kind of a top level element that can contain any number of other UI elements SVerticalBox - Kind of a container or panel in which you place other widgets. Used for icons, for example. SHorizontalBox - As above, but more often used for text backdrop STextBlock - Container for text SEditableText - User input textfield (such as Search field) SButton - Button SComboButton - A flyout or drop down button type, similar to SMenuAnchor SBorder - For making things pretty SSpacer - For making things pretty, buddy of SSplitter (a divider) SImage - A graphic, for example the picture content of an icon SAssetThumbnail - A specialised graphic getting the image component from an actor SListPanel - Contains other widgets (such as the content brower or an inventory panel) SOverlay - ? SScrollPanel- The main element of a slider, more or less the same as SScrollBar SScrollBarTrack - The range of a slider (Note: the bar in a slider is just a SVerticalBox), more or less the same as SSlider SDockTab - A dockable tab panel (such as the Scene Outliner in the editor) SComboMenuContent - Used to create drop down menu entries along with SListPanel SComboRow - The entry in a SListPanel SCheckbox - for flagging a property on or off SNumericEntryBox - for entering a number
  • 66. Troubleshooting 0.0 I was rumbling along and … What happened just now? I couldn’t get the eventgraph window to show up. It’s likely a display setting fault with my laptop. I generally run the editor with a second monitor, but today I wasn’t. To fix the issue, I went to Windows Task Manager (Ctrl+Alt+Delete) and looked at the UE4 process. Two running process are shown when both the editor and an additional window like the eventgraph are open. To expose the eventraph I right-clicked on one of the processes and chose Maximise. Nothing happened, so I did that again for the other one. And the missing eventgraph popped up. Yay. This hadn’t worked from the operating system’s taskbar icons (like it does with the Log in UDK for instance). Task manager process tab:
  • 67. UE4 - FLYING GAME CONTROLS 1/4 Important: This demo was constructed using the github UE4 4.2 preview. If you turn off the default controls, you can make your own game controls as follows. Turning off the defaults. 1. Go to your Pawn class and in its Defaults panel, type bindings in the search field. 2. Turn off Add Default Movement Bindings. Note: This will disable them, so you won’t be able to move around in your game for now. We’ll implement our own movement instead. In your Pawn class, add an Event Tick and promote its Delta Seconds to a new float variable PawnTickDelta. Set that as shown in the image. Create a Sequence node, with seven pins (you’ll probably wind up with more eventually). These give you a way to flow out to up, down, strafeleft, straferight, forward and backward motions. I’ve also added FreeLook: http://goo.gl/2Cld0G to handle turning. Create the Custom Event nodes for those first, then call them from the Sequence pins, as shown on the right. My pawn blueprint is called Flying_ParentPawn as I want to first make an abstract parent blueprint and then derive various child pawns from that, later on. In the demo, we just use the parent. Make sure you add your pawn and your playercontroller to the level’s gamemode. If you don’t none of this will be active. The other thing you’ll want to do is make blueprint casts when play begins. This is shown in earlier sections, and here: http://goo.gl/PU66jx In my case, the playercontroller variable used for casting is FlyingPlayerControllerVar in the pawn class. In pawn, to prevent too fast movement, set Max Speed to 30.
  • 68. UE4 - FLYING GAME CONTROLS 2/4 The Cast to Controller function follows an Event Begin Play (p) and notice it calls Enable Input so we can establish hotkeys in the pawn class. Having dealt with that, we can create the functionality for the player motion (remembering this is camera movement, nothing to do with a character model or its animation). This part relies on the Movement Component that comes for free with the pawn blueprint. Notice the World Vector values may need tweaking. Note: the Gate bool Start Closed is on by default, because Tick enters continually, so we use the Up and Down keys for flow control only. The small image on the right shows, in your playercontroller blueprint, a quick way to toggle the onscreen cursor, which you may find handy when checking the movement controls are doing what you want them to do (for the FreeLook or turning camera part).
  • 69. UE4 - FLYING GAME CONTROLS 3/4 For Forward and Backward motion,set the next part of the Pawn eventgraph as shown below: The key inputs you set for controlling each Gate are up to you. I used [ and ] and found it comfortable to use when the Up and Down arrow keys are being used for up and down motion, for flying. I guess many people would use WASD with up and down as Q and E perhaps. The regular nodes to complete this are: Get Control Rotation, added to a Make Transform, and then passed through a Transform Direction, finally added to the movement of the player. Notice the Direction value for forwards is X positive or 1.0 and backwards is X minus or -1.0. You then use a Scale Value float to multiply that vector. My default value for Thrust Scale was 20.0 but make it whatever works for you.
  • 70. UE4 - FLYING GAME CONTROLS 4/4 What works well for forward and backward motion (on the previous page) works well for sideways camera motion too, in this case, strafing. Using the Y axis for Direction instead of X axis is all we’ve changed. I mapped the strafing keys to both Left arrow == comma, and Right arrow == fullstop. Having set up basic motion, we need turning. My FreeLook steps, added to this pawn blueprint are shown here: http://goo.gl/2Cld0G The example uses Math Expressions, which have been introduced in 4.2 version of the editor, but can also be set up with regular Math nodes. On the UE4 Answer Hub, Tim Sweeney commented “This is awesome, Thanks for Sharing”. I should record a video of it all working. (To Do).
  • 71. UE4 - “Fun with Blueprints” - Zak Parrish on Unreal Engine (youtube) The video by Zak Parrish: http://youtu.be/9-7SmkasS_A shows how to spawn many objects in random locations in a volume. The pic is a bit large, just zoom in the doc and use the sliders to pan. Instead of using a Class reference directly, you could create a named variable SpawnedActor. This would let you use children of this parent to set the variable SpawnedActor to be different classes, using the same parent blueprint graph for many cases. The actor spawned should include a mesh or emitter so you can see it. If you want the spawned actors to fall to the ground from wherever they spawn, you’ll need to set Transform > Mobility > Movable in the spawned actor’s mesh component. Set the mesh component’s properties so it has ticked values for : Simulate Physics and Simulation Generates Hit Events and Generate Overlap Events and Collision Presets = PhysicsActor. You’ll also need to tick Start Awake if it isn’t already. Possibly the ground will need to generate hit events too. You can use Hit Events to generate sounds on collision, to get the hit location to spawn emitters, and so on. These can be in the spawned actor. You can also operate on the returned object produced by the SpawnActor function’s Return Value, such as add the object to an array. In the image, a Delay and Gate to control the burst of objects, but you could use keyboard input and Gate it via a tick event or some other way. In the image the Gate is collapsed to save space (hold G to add a Gate).
  • 72. UE4 - UI Buttons 1/8 I recently lost a lot of work and faced the formidable task of rebuilding it (which I did only to lose it yet again). Then I started over and, because the urge to optimize had become much stronger, I realised a way I could do buttons much nicer. I really like how Scaleform in UDK permitted button states, so this demo shows how to replicate that in blueprint. I thought I’d come up with a good approach the first time (but it needs many wires). The problem is having four Draw Material Simple for the button states. [NB: I’m just changing the button color depending on what the cursor is doing.] Having to feed in the screen position and button size values for each one is inefficient. The image on the next page shows an improved approach. Notice that a Switch on ButtonStateSwap is used to specify which Material to draw. This is an Enum asset I made in the content browser and for each different button an Enum Something variable is looked up to see what value it has. Really it’s the same as Switch On Int but looks nicer on screen, as you remember better which output does what. So this example works but is wrong in terms of efficiency… there are some things I’ll need to explain besides this part, such as how to make the HUDCenter Text function on the right below, and how to set the Enum values based on HitBox events.
  • 73. UE4 - UI Buttons 2/8 Given what was on the previous page, it’s much nicer to look at the streamlined version shown below (zoom in for details): You can see that there are far fewer green lines carrying values from the function generating them to where they need to go). To clarify, there are four states for a button though usually we only use three. Up (when the cursor is elsewhere), Over (when the mouse is over the button), Pressed (when the user clicks on the button), and Disabled (which is used when the button isn’t available for whatever reason). In this case I made an unlit parent material and then, from that, produced material instances that simply shift the base emissive color value as a parameter. For each button you make this graph works well, and just needs the variable inputs to be updated (text string, location offsets from the screen center, hitbox name, and enumerator variable). These are explained on the next page.
  • 74. UE4 - UI Buttons 3/8 The button has to have a text string (well, if it’s not a totally image based one), a location (for which I just use offsets from the screen center), a hitbox name, and an enumerator variable which is used to switch the material or texture of the button graphic. The hitbox is the part you actually click on, and technically it could be any size you want. In my case, I am making the hitbox and material to size to the text string (hence Resume is wider than Save) with a little math to make add 10 pixels to the width and height or each. You can see the roll-over effect on the Load button in the image. When clicked, the material is switched to an even lighter tone for a moment. Here’s the function for getting the center of a given string of text, and setting a given string of text in the center of the screen. This function belongs in the HUD blueprint. It has three external inputs. The InString is the main one that will differ per button. The Font is an asset created in the content browser and assigned via a variable. FontScale is a Float multiplier for the font asset’s default size. HUDX and HUDY are integer variables set after the HUD’s EventReceiveDraw event, as shown below. A branch effectively gates the continual exposure of what you want in your ‘LaunchMenu’ of buttons. To turn off the menu, just set ShowLaunchMenu to false somewhere.
  • 75. UE4 - UI Buttons 4/8 The HUD setup for the LauncherMenu that contains the buttons is as follows: Notice that EnterLaunchMenu is a custom event fired from the HUDDraw event continually, but it only fires when the bool ShowLaunchMenu is true. After the usual cast to another blueprint to get its function, we set Enable Input, so the C key can toggle the menu. This might also be paired up with ShowCursor and EnableClickEvents. In this case I’d already done that in the PlayerController blueprint, for testing things out, as shown below. The command to set the bool InCinematicMode is used in the level blueprint to toggle Set Cinematic Mode (since that seems to only be possible to set in the level blueprint). Cinematic Mode acts as a pause player command. That’s demonstrated here : https://answers.unrealengine.com/questions/24674/when-in-paused-game-how-to-remove-the-paused-text.html The next part is to make each UI button’s HitBox respond to the cursor, which is shown on the next page.
  • 76. UE4 - UI Buttons 5/8 To make each UI button’s HitBox respond to the cursor, we use events in the HUD class. The chain off these can grow to be quite big as more buttons are added, so I make a New Graph in the HUD blueprint to give these their own space. . This image shows the general layout of the three button states we need to set up. The over state is handled by an event in the HUD called EventReceiveHitBoxBeginCursorOver. I set a Name var OverEnd then match it to all the hitbox Name variables for all the buttons. In this example all I do as a result is changed the material, but here you could add sounds or tooltips or other commands.
  • 77. UE4 - UI Buttons 6/8 In the previous image, the values for the enums driving ButtonStateSwap were set to 0 (which is the first in its content, therefore the Up state). For the Over state the enum value to switch on would be 1, and for Pressed 2. To create an Enumeration, RMB in the content browser folder and expand Miscellaneous. Name it, populate its Enumerators and then save it. To call it, just RMB in an eventgraph and start typing its name. You should seeSwitch on ‘YourEnumName’ show in the list. Remember, you can also use Switch on Int, and just spit out numbers, but that can be hard to remember which value is what. . If you look back to the functions for creating the buttons, you’ll see the Switch on ButtonStateSwap is using an enum variable input (Selection) which, for each button, is a var like UIButtonStateSAVE or UIButtonStateLOAD. So here we are setting it based on what the mouse interaction with the HitBox is. In the next part, we see how the click event continues this idea.
  • 78. UE4 - UI Buttons 7/8 The click event in this case only changes the material on the button so it flashes brighter. Functionality would follow for each branch. The click event occurs when the player clicks the hit box for a given button. By default no action occurs just because a button was clicked (so Save doesn’t Save and Quit doesn’t Quit). Make functions of your own and call them from EventRecieveHitBoxClick. A simple example of the commands that drive saving and loading is shown here: https://answers.unrealengine.com/questions/25747/how-can-i-savegame.html Tips: Use Promote to Variable (right-click on empty pins) and this will create and auto-populate the variable type so you don’t have to browse for that. To replace a variable with a different one, drag the variable from the My Blueprint list onto the empty space on the existing variable node. This will pop-up an option to replace one with the other, as shown below. This is useful if you are copying/pasted content and need to make updates. To
  • 79. UE4 - UI Buttons 8/8 I left a comment a few pages back that there’s a tidier way to set up the Hitbox events so they don’t need to branch so much. Thanks to Steve Allison for this: https://answers.unrealengine.com/questions/44431/hitboxes-with-same-name.html Having said that … It seems that in UE4.2 (unless I’m doing things really wrong) each HUD hitbox is persistent, so if two menus have a hitbox in the same location it’s really better to just use the one for both buttons, and use a branch off a bool to control the effect for the hitbox depending on which menu is current. An example is shown on the right Intuitively, you’d expect hitboxes to not last and to be added each tick or drawHUD event then discarded, but just because they’re no longer being added does not mean they are actually removed. The first added hitbox has precedence over others (Priority seems not to work). I’ve posted a query about this little bit of weirdness on the UE4 Answer Hub: https://answers.unrealengine.com/questions/53463/how-to-make- hitboxes-that-dont-persist.html The reply is that there’s a setting Suppress Native HUD which doesn’t (Currently) have discardable hitboxes … So, test which case you’ve set active. In upcoming 4.3 version this case has been fixed.
  • 80. UE4 - Create an Interface and let another actor look it up 1/4 I was playing around with using an Interface in a blueprint and ended up with a string that adds a dot to itself when you are at an actor’s location and removes a dot from itself when you are too far from the same location. No reason why… although it could be a basis for a charging stat boost (like you get extra Armor when standing in a Shield Dome). The length of the string is an integer that could drive or influence another value. 1 RMB in content browser, in your BP folder and choose Miscellaneous > Blueprint Interface. Name it DemoInterface, as you like. 2 In the interface editor, add a function and name it SillyFunction (the name is up to you). 3 In the Details panel of SillyFunction, in Input press New, and for the new entry type InString and make sure it’s a string variable type. 4 Then Compile and Save. Don’t add an Output. If you add an Output you cannot use the interface’s Event, as in the documentation. Read this https://answers.unrealengine.com/questions/43429/how-do-you-implement-an-interface.html 5 RMB in the BP folder and choose New Blueprint > Actor, and name it DumbActor. 6 Open DumbActor and click the Blueprint Properties icon in the Toolbar, as shown below. This will expose a panel that lets you specify which Blueprint Interface this asset can implement. 7 Press Add, and choose your DemoInterface_C asset from the dropdown list, as shown on the right. Now you will be able to CREATE the functionality for SillyFunction in DemoInterface_C. I’m not sure how to explain the usefulness of that, but suffice to say that other blueprints also with the Interface implemented can all execute when the function is called in this blueprint. https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/Types/Interface/UsingInterfaces/index.html The call to SillyFunction is a Messenger type. And in other blueprints that also implement the interface, use interface events to send your string over. NB: I don’t want to use GetAllActors of Class, because what if there were lots of them in the scene? But for now, it works as such. It’s not much to look at, but it’s all we need. This is because we will only be passing in a variable in one blueprint in order to send the variable to another..
  • 81. UE4 - Create an Interface and let another actor look it up 2/4 I set up this in DumbActor. The Delays are needed in the eventgraph because they don’t work inside of a function (latent stuff isn’t allowed in functions). If there is no Delay at all in the loop through the function and back through IncrementLoop you’ll collapse the game because of too many execution steps. IncrementLoop is a Custom Event. DecrementLoop is a Custom Event The custom functions GrowString and ShrinkString are shown on the next page. Both call DoSillyFunction, which is custom event hooked up to the Interface function messenger. A messenger shows with an envelope in the corner. If there’s no envelope it’s just a local function call and other blueprints won’t hear it. Notice we get TextActor_C, which is the class representation of the actor TextActor ithe scene. In this case there’s only one actor to find. We pass the value of the string variable Input to TextActor using SillyFunction (via the interface we made on the previous page). The method below would also work well, I guess, if a bunch of actors were sending stuff to the HUD, since there’s only one HUD to send to. So long as yourHUD also added the relevant interface in its Blueprint Properties.
  • 82. UE4 - Create an Interface and let another actor look it up 3/4 Zoom to see the images. This one is the GrowString function, and if the distance from the DumbActor to the Player is less than 150 we append a “.” to the string Input, then call DoSillyFunction, the custom event on the EventGraph which sends out the Input string to our obtained TextActor. Then we loop this, and also loop through DecrementLoop, which ‘breaks’ if the distance is still less than 150. The looping part is probably not canon, but it works. This is the ShrinkString function: Notice the cool use of GetSubstring and Len-1 to shorten the Input string. What this does, if we get far from the actor, is incrementally remove dots from the string that is passed via DoSillyFunction again to the interface event in our TextActor, on the next page.
  • 83. UE4 - Create an Interface and let another actor look it up 4/4 TextActor, by comparison, is pretty simple. Note that Dots is the variable name of a TextRender component,as shown below. And here’s a litle video of all this : http://youtu.be/MS8_4NMNc4Q
  • 84. UE4 - Proximity Testing Actor This is a reply to : https://answers.unrealengine.com/questions/56329/how-do-i-get-the-location-of-the-closest-character.html by Alan Webster In this example we change the material of whichever actor is closest to the player (amongst those of the same type in the scene). Make a blueprint actor called ProximityActor_BP (or whatever you want to call it). In the image on the left I have outlined a flat plane mesh that I added to the actor as a primitive component. Add any StaticMesh you want. This component should be added as a child of the root, not as the root. (I normally add an Arrow to the root.) That matters because later we look up the component by index in order to change its material. as shown below: Here is a link to the 1:1 scale eventgraph for the actor: https://dl.dropboxusercontent.com/u/9344219/ProximityActor.png At 1:1 the original image is quite large (3187x726 pixels), so the image shown below is just for a preview so you know what to expect. A 40 second video showing the result is on my youtube channel, here: http://youtu.be/33XdoerjUZs Probably the same result could be established without using a secondaryarray, straight out of Get All Actors of Class, but I found the wires got messy pretty fast trying it that way.
  • 85. UE4 - Quick and Dirty Green Screen I put a RenderTarget2D on a FBX mesh and behind the mesh a block with a green material on it (0,1,0). The rendertarget texture in the material editor gives us our image (although it’s a ParameterTexture in the example below), and we Blend_Exclusion it with 0,1,0 to chuck out the green in the Opacity channel. The downside is that green in the Diffuse or Emissive may cause a spill kind of effect, particularly around the edge of the captured model, and the colors may not be quite the same as in the captured image when it renders (I tried using the Add/Add/Subtract with RGB channels to reduce that). I’d love to hear other ways to achieve this. What I’d really like to know is how to get a rendertarget to produce a non-white alpha based on the max view distance: https://answers.unrealengine.com/questions/57357/change-rendertarget-alpha-to-0-past-max-view-dista.html