Introduction

In this article, we will go over character selection and making it move around the map. Firstly we will use box collider to select the characters, than we will implement decal component to highlight the selected characters. Finally, we will create a class derived from AIController and use its functions to move the characters on the map.

Selection

I did character selection with a rectangular box collider sized with respect to the player’s input. The box collider’s extend and center position are calculated according to the positions where the player presses and releases his/her mouse left click.

I also used a decal component in order to highlight the selected characters. Decal component is a component that is used to paint surfaces that has a colliding area with it. Decal components are used in several purposes for example in a shooter game when player shoots a wall, the bullet track on the wall is generally made with a decal component, or spraying a surface like in counter strike is made with the same technique and so on. Here, we use decal component to draw a circular highlighter on the surface of the selected characters.

Decal component has the following decal material:

GetHitResultUnderCursor function sends a ray from the mouse position and gives the corresponding hit results. Here, it is only used to get the hit position, but it can be used to get the hit actor etc., and is a very usefull function. More information about FHitResult can be found in the API: http://api.unrealengine.com/INT/API/Runtime/Engine/Engine/FHitResult/

Commanding

Let’s create a class derived from Unreal’s AIController class. Actually we do not need to create it for now, but  we will be needing this class in the future.

Since we make characters move around the map we need to create a nav mesh bounds volume:

Result


Next article will be about HUD. We will be seeing our selection box and character health and so on. Until then take care.

Github repository: github.com/emrebarisc/RTSBattleRoyale