Skip to main content

Unreal Engine 4 Dev Update #11: New Character Models, Unit Highlights, Mouse Based Unit Selection & Context based HUD system

Finally, for once, I've managed to put a development update within the deadline mentioned from my previous post. Alright, we're having a cluster of small changes for this one. So let's get right down to it.

New Character Models

   
I had started off this project from the Top Down Template. So I've been using the default Unreal Engine character until now. A while back, I had bought the 'Prototype Characters' pack by Ying Pei Games from the marketplace. Since they fit the theme of my game better than the blue guy, I decided to use them for my units. Blue for the good guys, and red for the bad guys. If you've been following my posts, you might have come across the fact that I'm already using Epic's Animation Starter Pack in my project. I had some of the basic animations running already, so I did not have much work with adding the new models after re-targeting the skeletons. Here's an in-game screenshot:
   

And here's one up-close:




Unit Highlights and Health Display

Up until now, there was no cue when the cursor was focused on any interactive object, say, when I hover it over an enemy unit. So I decided to add unit highlights for enemy units. The idea was to have them highlighted, when the mouse cursor is over them. I'm using 'Hit Result under Cursor' and Custom Depth with a highlight material to achieve this. I actually got this idea from Tom Looman's Switch Development Blog. He's got a tutorial for the same as well. And btw Switch is probably the most awesome UE4 project that I've seen so far. It's hard to miss for a UE4 developer, but if you haven't seen it already, I'd highly recommend it. Here's a link:

Tom Looman - Switch Development Blog

Anyways, once I got the highlight working, I decided to add a Health Bar over the highlighted unit. So I got into UMG, made a health bar widget and added it to the character blueprint. At the moment, it's using a progress bar that changes according to damage received. You can see it in action in the video link towards the end of the post. I've also made the floating health bars to always face the player, no matter which angle he/she is looking from. For player units, I set these health bars to be visible all the time.
  
  
Mouse Cursor based Unit Selection

As mentioned in one of my previous posts, I've been using the number keys to select different units under the player's control. Being able to select units using the mouse was part of the plan for a while. So I just added that as well. Feels a lot better to use it this way, compared to the keyboard. Again, this is being demonstrated in the video as well.

Sounds Effects for Weapons Fire

As the title suggests, I've added the weapon fire sound effects from the Shooter template. I just play them along with the muzzle flash emitter when a unit starts firing upon another unit.

Context based Command HUD System

Lastly, I added a context based HUD display system. What that means is that, the interaction with the Command HUD happens based on what the player is trying to do. Right clicking on a location on the grid space to move the player only allows the player to interact with 'Move' button and 'End Turn' button. Similarly, right clicking on an enemy unit will allow the player to issue only 'Fire' commands and 'End Turn'.

Alright, so that's all for this update. Here's the video demonstrating the features that have been added, as per this update:


You can check out my other videos from my YouTube channel (link given below). Feel free to subscribe to my channel, if you're interested in the development of my project. And have a happy weekend.

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: https://www.youtube.com/watch?v=7LaazCv4rB0]

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 …