Posts

Showing posts from July, 2024

Creating a simple dialogue system in Unreal Engine 5

Image
 Through my early days as a gamedev, I've learned a plethora of neat techniques but there was one that I always wanted to know how to do. A dialogue system. Here is my first attempt at a rudimentary system. This will be redone very soon with more depth. The very first step was to create a interface for Dialogue. Then a duplicated the Third Person Character blueprint and changed the meshes for both.  I made variables for this NPC, the first being an array variant of the string variable. This was give as many options for dialogue as I wanted. Then I created an index variable as an integer to determine in what order the dialogue was spoken. Then a reference to a widget was made. For the string array, I added three elements and added three simple sentences. The Index integer was initialized at -1. This was because the first element of the array began at 0 and the way the code works, we are incrementing the index. Starting it at -1 means we start blank, then move index 0 (the first...

Remaking Mario in Unreal Engine 5 (Part 4)

Image
 (This post follows on from this page:  https://triplehitcombo.blogspot.com/2024/07/remaking-mario-in-unreal-engine-5-part-3.html ) Last and by no means least, we hit the final page and it's all about the blocks! Okay, a little bit about the Third Person Character as well.  Let's get that bit out of the way first! In the construction script, we set a function for when the player dies. A sound plays, inputs are disabled, an emitter is spawned, character movement is disabled and an animation plays to jump the character up slightly, in Mario fashion.  In the event graph, we have the death function. It plays out as the construction graph would indicate, with the player dying and the transform location updating as I intended.  Once the location is determined, a delay is set and a cast to the player is made to deduct a life from the player, then the player actor is destroyed.  In the Modify Hit Points section a few checks are needed. First off, I needed to check ...

Remaking Mario in Unreal Engine 5 (Part 3)

Image
 (This post follows on from this page:  https://triplehitcombo.blogspot.com/2024/07/remaking-mario-in-unreal-engine-5-part-2.html ) After breaking down a couple of really big code snippets, let's take a break and look at some smaller ones! Clouds The background of the level is looking somewhat drab, let's add some clouds in the background. The first step was to create a bunch of clouds in a trigger volume and set some variables.  This piece of code was done in the construction graph. a spawn area is set (the size of the trigger volume) and a For Loop is set for every instance to spawn, another is added and the transform is set as a random point within the bounds. Instant Death A simple one. A trigger volume and attached to it is a call for the Player Death function. This is applied at the player spawn so the player doesn't jump off the level to the left and placed above spike traps. It's so simple, you don't even need to see the code! Goomba Okay we have examined a ...

Remaking Mario in Unreal Engine 5 (Part 2)

Image
(This post follows on from this page:  https://triplehitcombo.blogspot.com/2024/07/remaking-mario-in-unreal-engine-5-part-1.html ) Last time we left off, we ended on the UI and ensuring that all variables to be displayed on screen worked as intended. Checkpoints First, I made a checkpoint system to give the player a place in the level to return to, to avoid frustration if they repeatedly die. The concept was to make the visual representation for the checkpoint, then a trigger volume. In the event graph, I started to work on the blueprints.  The beginning of the code was a cast to the player and game mode BP. Then a setter for the spawn transform for the rotation of the checkpoint. This was set to a Do Once loop that connected to a timeline to display the animation of the flag changing when Mario enters the collision. Since the checkpoint can only be triggered once, a Do Once loop was the most useful choice.  After the timeline was set a lerp was added to adjust the rotati...