Making an Interactable Blueprint

Adding Machine Blueprint Intro

Making a collectible token

Make a new Blueprint. So far we’ve made a character blueprint and a GameMode blueprint. This one will be an Actor Blueprint. Actor Blueprints are not controlled. They are typically static objects placed around the level.

Here we’ll make a token. When the player overlaps with it, the player’s score goes up by one, particles are emitted in the location and the token disappears. Also, right before it goes away, it checks what the player’s score is. If the score is 10 the text YOU WIN is printed to the screen.

In the BP Viewport I first added a Sphere collision. Then I added a regular Sphere and put it inside the collision as you can see below.

In the Event Graph tab I added an event for if anything collides with this Blueprint. Below is the code with comments.

Then you can place as many of these tokens around your level as you like.

For the Particle Emitter – feel free to tweak it all you want. But at the very least, under “Required” you need to give it a material. You can just use one of the emissive materials you’ve already made or make a new one:

Adding Blender assets to Unreal (optional)

Adding a controllable character to your level

Now you have a basic level setup. Maybe some walls, a floor to walk around. Let’s make a character class to explore the world you’ve made thus far.

 

First we’re going to set up the input keys in the project settings in the edit menu. We’ll do space to jump, and W/A/S/D to move forward/back/left/right. No mouse functionality yet but you can do that on your own if you wish by taking a look at the 3rd person demo project. 

Next we’re going to add our first two Blueprints. Go to the green Add New button and click Add Blueprint Class.

 

 

Add a GameMode class and a Character Class.

Let’s open up the Character Blueprint first. You can name yours whatever you’d like. We’ll go to the EVENT GRAPH tab first. First let’s add our “Events” for movement. An event is a red node with only one white arrow coming out of it. This is what triggers things to happen. In this case we want to trigger events for when the user presses W/A/S/D or the space bar.

Here you can see I made 3 events. One for jump, one for moving forward/back and one for moving left/right.

Make sure to connect the axis value (1 or -1 that we set up in Input) to the scale value and also be sure to set the direction. In unreal Z is up and down, X is forward/back and Y is left/right. So for ForwardAndBack event put a 1 in the X direction and leave the other two at 0. For Left and Right put a 1 in the Y value and leave X and Z at 0. Jump is easy as there is already a built in movement for that.

 

Now let’s go from the event graph tab to the VIEWPORT tab of our Character Blueprint. Add a camera so you can see and maybe some basic shapes to make your 3rd person character. Alternatively if you want your game to be first person, just add the camera where the eyes would be. A little above the arrow.

Lastly we need to set up our GameMode. This is easy. Just set your Default Pawn Class to be the character you just created. In my case I named my character DUDE. Then go in the World Settings tab of your level and be sure to set the GameMode Override to the GameMode you created. If you don’t see the World Settings tab you can find it in the top menu under the Window entry toward the bottom.

Intro to Unreal Tech Demo (-5)

Game Design Class Intro

Matinee animations recap

Intro to Sound

Sounds that you import into Unreal MUST be WAV format, 16-bit PCM. As far as I know no other format is accepted. Luckily in Audacity (free and open source) it is very easy to convert any type of sound. Here I am exporting a FLAC file that I downloaded from www.freesound.org into a WAV.

Screen Shot 2016-05-26 at 12.55.56 PM

When you import a sound in Unreal it is called a Sound Wave. If you want to be able to do things with it, you create a Sound Cue from the Wave. You can do that by right clicking on the Wave file and clicking “Create Cue”

The two main types of sound in a game are atmospheric sounds and sound FX.

Screen Shot 2016-05-26 at 12.59.59 PM

First I am making an atmospheric sound. By clicking on the Output node of the Sound Cue I can adjust the attenuation settings of the sound (the range, how far a player can hear it for)

Screen Shot 2016-05-26 at 12.54.56 PM

Also importantly I need this sound to loop. I click on the Sound Wave node and click Loop on the left hand side (you can’t see too well because of the comment window over the loop boolean).

Screen Shot 2016-05-26 at 12.55.11 PM

Then I just drag the Sound Cue into the level. Here you can see the attenuation. Only when the player steps into that sphere will it hear the atmospheric sound. And it gets louder as the player approaches the center.

Screen Shot 2016-05-26 at 1.05.49 PM

For Sound FX you usually want quick sounds that do not loop. Here I am putting together three jump sounds from freesound.org and putting them through a random node. That way when my player jumps it’s a different sound each time. This could be useful for a lot of things such as an NPC who screams something different each time the player is near, explosions that sound a bit different each time, etc.

Screen Shot 2016-05-26 at 12.53.26 PM

Then to play the sound in Blueprints I just do a “Play Sound at Location” node every time the Jump action is executed.

Screen Shot 2016-05-26 at 12.52.20 PM