Skip to main content

Unreal Engine Dev Update #10: Meet my new Player Character - The Camera

As usual, it's been a while since I put up a development update. In my previous update, I had mentioned that I made some major changes to my project. Oh and btw, since this is basically a learning project for stretching my understanding of game design, I'm just calling it Project Horizon. Current plans are that I'll be releasing it for free. This is kind of an experimental game project for me. So I'm just gonna through around some stuff at it and see if they work. Alright let's get back to the changes. First of all, I'll just note down the two major changes here:
  1. I've set the RTS Camera in my game as the default player character. 
    2.  A new AI Controller to control the player units.
So I'll get to the first one in detail now. For starters, I've been using my player units as the default characters in the game. And that would seem like the sensible thing to do. Accessing the active player units are also a lot easier that way. And as mentioned in my previous posts, I've been using a custom RTS Camera (not the one that comes with the default character in Top Down Template) to move around the map. I noticed that when I'm playing the game, I'm just moving around the camera most of the time, while issuing commands based on a UI. It's almost as if the camera is the unit that the player is controlling. It's the only thing in the game over which I have almost constant control. The units that I command, move on their own and fire on their own, once I issue commands to them. And that kind of leads to the thought behind the reasoning for the second change. But getting back to the camera implementation, I'm still using a character blueprint for the camera. As a result, I can easily access the camera from any place. And I'm doing that a lot since I need it to automatically follow the units when they are executing their commands. But apart from this change, the core functionality of the camera remains the same as before. I had written a brief account of it's implementation in one of my earlier posts. Feel free to check it out here:

Unreal Engine 4 Dev Update #7: RTS Camera System for Top Down Turn-Based Games

Now let's get down to the second major change. As mentioned above, I'm currently using AI Controllers to control all the units in the map. One version for the AI  and another for the player units. And why would I do that? Two reasons: Utility and Efficiency. The Utility comes in the form of Behavior Trees. The AI Controller puts the power of Behavior Trees at my disposal. I did not have this luxury when I was using a player controller. The Behavior Tree enables me as a developer to not spend unnecessary resources on checking player state, since it can take care of it much more efficiently. The code that I had implemented prior to Behavior Trees for handling player state involved checking lots of conditions at every tick. Basically, the logic was not simple. It was not elegant. It was the type of code, that you want to change right from the moment you implement it. I was happy to push all of it into the Behavior Trees. So in hindsight, it is the transference of the player unit control to the AI Controllers that propelled me to use the camera as the default player character. It took some time and confusion to get through these changes. But things look a lot cleaner now. Plus the game is working fine. And I'm actually happy that I got rid of that code. Before I end this post, I hope this will do justice to the title:
With that I'm rounding up this update. I don't have any videos directly related to this as both these changes were mainly under the hood. The gameplay basically remains the same as before. There have been a lot more changes since, but I think I'll have them in another post. Meanwhile feel free to browse through my Youtube channel (link below) as I've already uploaded some of the new gameplay videos following this update. 

Alright that's it for now. I'll hopefully have another update before the end of this week. See you soon.

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 …