Skip to main content

Unreal Engine 4 Dev Update #9: Navigation Path Display for Pawn Movement

In one of the earlier dev updates, I had written about the movement grid system that I had implemented. If you haven't checked it out yet, here's a link:

Unreal Engine 4 Dev Update #5: HUD based Command UI, Grid based movement system & Dynamically Spawning Grids

Basically all the pawns in the game are moving based on grids of 100x100 units. In it's current form, it only works for plane surfaces. I'll have to modify it to meet the requirements for curved surfaces, but for now, it's working fine for prototyping on flat surfaces.

Unlike most Turn-Based games, where units moving from one grid to another travel along the path connecting the grid centers, I plan to have free movement between the grids. This is very similar to what was implemented in XCOM: Enemy Unknown. I feel that free movement is the way to go for Turn-Based shooters, as otherwise, the movement feels very constrained. As a result, I'm using Unreal Engine's default navigation system, instead of going for a custom A* pathfinding algorithm. There are some occasional issues with the navmesh, when it comes to finding the shortest path. But I'm guessing that I can deal with the very obvious issues through adequate level design measures. If it proves too buggy in the future, I'll probably check out Monokkel's custom pathfinding algorithm that'll release soon in the marketplace.

So anyways with the current setup, as you might have seen from earlier posts, I do not have a permanently visible grid system. It's spawned dynamically based on player input and destroyed after it's use. As a result, I wanted to give the navigation path details to the player, when he wishes to move his unit to a new location. And fortunately, there is functionality in Unreal Blueprints to find the path that the player's unit will take from it's current location to any other location. So using that I was able to get path points towards any accessible location as soon as player clicks over there. I then used this data to create splines from the starting point to the target location, along the path points that I had earlier obtained. As a result, the player can always see the path to this target location before he makes his move. More so than it's aesthetic function, this data will be really useful in order to devise a good tactical move, if reaction shot functionality is added to the game. In it's current form, the pathing spline is not very smooth at the turning points. That's something that I have to deal with later on. But apart from that, it functions kind of similar to the path display from XCOM.

Here's a recording of the path display in action. As I mentioned in my previous post, I have removed most of the materials and toned down the graphics settings.

Recently, I noticed that there were pathing issues when moving around other units. By default, the pawns placed in the level do not affect nav mesh generation. As a result, the pawns didn't take the other pawns into account when generating their navigation path. So they just collided with any other unit in their path, thus halting their movement before reaching the destination. At first, I set the pawns' root capsule to affect nav mesh generation. But even in this case, I faced an issue, as the pawns were moving too far from each other due to their combined wider region of effect on nav mesh. I had to enable run-time navmesh generation and have the pawns effect the navmesh dynamically in order to rectify this issue. I now disable the active pawn's effects on navmesh, while having the remaining static pawns effect the navmesh. This way the pawns are able to path around each other fairly easily. And that's where I'm gonna leave it for now, while I move on to handling the pawn attributes and combat.

That's all for this update. You can check out more unreal dev videos in my Youtube channel:

Popular posts from this blog

Unreal Engine 4 Tutorial: Smooth Zoom using Mouse Wheel for Top Down Template

Well, I had already written a tutorial for implementing Smooth Zoom functionality for Top Down Template. But it was based on keyboard inputs. Since most Top Down PC games use mouse wheel for zoom, I decided to make a tutorial for the same. The core logic here is the same as the one implemented by Ryan Jon for the custom camera in his RTS Community Project. If anyone's interested, they can get the code for the RTS Community Project here:

UE4 RTS Community Project

Anyways, he has replaced the default camera for the characters with a general camera since that's more ideal for developing an RTS game. Since a basic Top Down game with a single playable character does not need a separate custom camera, I decided to implement the same functionality for the default player camera in UE4's Top Down Template. So let's get down to it.

First of all we need to make a custom curve from the content browser. We will be using this curve to define the smooth camera movement while zooming …

Unreal Engine 4 Tutorial #4: Basic HUD Based Command UI for Top Down Turn Based Games

Hi, welcome back for the next tutorial. And in this tutorial, I'll be explaining how to create a basic Command UI for top down turn based games using HUD blueprints. By the time we reach the end of the tutorial, we'll have a Command UI with movement and fire action commands, and a player character that responds to the commands. Here's a screenshot showing the end product: 

Oh, and this tutorial is gonna be quite big, compared to earlier ones. So I advise everyone to go through the screenshots, before reading through. If it's clear, there's no need to read through the whole thing, partly because I've written this with a beginner audience target in mind. Ofcourse, if you have doubts, I hope they will be clarified in the written description. If not, feel free to ask me in the comments.
So let's get started. Again, I'll be starting with the top down template. First of all, we need to create a new HUD blueprint. If you're a beginner, you can find this by f…

Unreal Engine 4 Tutorial #3: Unit Selection Decals for RTS Games

Hi, welcome back for another UE4 Tutorial. This time, I'll be walking you through how to set up unit selection decals for RTS games. So the decals need to be visible, when a particular unit is selected, and set to hidden as soon as the unit is deselected. For this tutorial, I'm gonna start off from the Unreal Top Down Template.

First of all, I'll be changing the default controls a bit. Instead of using left mouse button to move the units, I'll be using right mouse button for character movement. I already have a decal texture, that I created in GIMP. If you don't have one, you could get my decal texture from the link below:
DropBox: Character Selection Decal Texture
So once you have the texture ready, next step is to set up your decal material. For creating a decal material, we need to set the 'Material Domain' in the details panel to 'Deferred Decal'. I'm also setting the blend mode to 'Emissive' in my case. Then we multiply the texture wit…