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 Tutorial: Create Circular Ring Material without Textures

Hi, welcome back for another tutorial. It's been quite a while since I put up a tutorial as I've been busy working on toolkits for the Marketplace. One of my earlier tutorials [link: Unit Selection Decals for RTS Games] had focused on how to create ring materials using textures, as well as using them to display unit selection decals for RTS games. However, a drawback associated with using textures was that it prevented the user from changing the inner & outer radius of the ring. And during prototyping stages of a product, it's far better to implement structures that can be changed easily from within the engine so that you don't have to create a new asset from an external package every time you need to test out a new idea. I've found this approach quite useful while working on my own products. Hence, this tutorial focuses on creating a ring material that can be adjusted both from within the material editor as well as dynamically at runtime.

Alright before we get …

Unreal Engine Diaries #11: Nav Mesh Configuration

[This episode of Unreal Engine Diaries focuses primarily on nav mesh configuration, nav areas & configuration of agent types.

Source: Unreal Engine 4 AI Support Twitch Broadcast with Mieszko:]

1. The Recast NavMesh has a couple of attributes named 'CellSize' & 'CellHeight' under the 'Generation' section in it's details panel. Together they determine the resolution of the nav mesh & lowering these values can create more precise nav meshes. It could be especially useful when there are lot of holes in the nav mesh due to the surface properties of the terrain. However, lowering them also makes the nav mesh calculations more expensive.

2. If runtime nav mesh generation is enabled, it would be best to set the 'Tile Size' attribute of Recast NavMesh to the minimum viable amount.
3. The 'Min Region Area' parameter which can also be found under 'Generation' section of Recast NavMesh can be i…

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 …