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

In my previous dev updates, I had talked about how I implemented a grid based movement system in the Top Down template. Now that we got that out of the way, I decided to tackle the issue with the default camera system in the Top Down template. Since I needed the camera to smoothly move to focus on the active character, it was kind of troublesome to use the default cameras as they were each attached to their corresponding characters. So I got rid of them. And now I have a new RTS style camera in place of it. Now this allows me to smoothly move the focus between the cameras depending on the game state. I'll just give a brief overview of the features that I've implemented.

First of all, I created a separate blueprint for the new camera. At the most basic level, it needs to move freely anywhere along the map. So I mapped the WASD keys to move the camera along the forward/backward and lateral directions. I'll probably add mouse based movement as well in the near future. All the features that I had implemented in my previous camera were directly added to this well. This included both keyboard based smooth zooming capabilities as well as keyboard based camera rotation. I had included tutorials for the same in a few of my earlier posts. You can find them here:




Anyways, this time around I decided to add mouse based zoom and rotation as well. As suggested by one of the members in the Unreal Engine community, I have used an interp node to add a mouse wheel based smooth zoom functionality. Alongside, I've mapped the middle mouse button drag to camera rotation. So with the exception of mouse based movement, I now have a camera that can move around the map freely. Here's a video demonstrating it:
                                        
        
As mentioned earlier, one of the problems that I faced with the earlier camera system was the difficulty with having the camera move smoothly towards the active character. So obviously, that was the next thing to tackle before moving on. The functionality for moving towards the newly selected actor was already implemented, but moving forward in that direction didn't serve my purpose well. I also had to take in to account, the fact that the camera needs to focus on the A.I. character as well, when I click on the end turn. So I rewrote the functionality to automatically move the camera between the characters. Again I use the interp node and player/A.I. movement status tests, to have the camera smoothly flow in to focus on the player. You can see it in action in the following video:
         
       
[Note: My PC is not very powerful. The stuttering issues during certain animations are a result of using the screen recording software alongside the editor and not the animation itself]
      
In this video, I've only shown the camera switching towards the active player character and not the A.I. since I was doing some work on the 'End Turn' feature. Now that I've implemented a basic end turn functionality, I'm happy to say that the camera movement smoothly switches it's focus on to the A.I., when it makes an action. So that's it for now. If you're interested in seeing more of my work, feel free to check out my Youtube channel:
        
Stormrage256' Youtube Channel
                              
In a day or two, I'll be uploading a new video with weapons and firing animations for the characters. Here are a few WIP screenshots until then:





Comments