Sponsored By

RTS Unit Group Movement: Deterrence - Video Devlog 5

The fifth weekly devlog of Deterrence. This week, I go over the trials, limitations, and methods of moving groups of RTS units.

Matthew Gianfrancesco, Blogger

April 19, 2022

3 Min Read
Game Developer logo in a gray background | Game Developer

A tower defense mixed with real-time strategy where you repel attacking sentient AI robots until they give up.

 

Prologue

This is my first time implementing RTS unit movement and I am no expert, but I have learned the basics that hold true in many AAA RTS games. Most of the information I go over in this devlog can be found here and here.

Performance

The RTS unit pathfinding method can destroy a games frame rate if not used wisely. Having a large group of units and having each unit in that group use their own pathfinding method to go to the same place is a performance killer. Also there may be units that find an alternate route making the group split, which may not be what the player wants. This problem is simply solved by designating a leader. The leader would find the path and all other units will use the leaders path.

One factor that can adjust the pathfinding work load is the spacing of grid nodes that units move on. By increasing the spacing, you are effectively reducing the amount of processing power to find a path between the unit and the destination; by doing this, you also sacrifice pathfinding in tight spaces. The RTS map and pathfinding grid should be made with each other in mind for the best performance.

Unit to Unit Collisions

The pathfinding method will only take into account the terrain and structures the unit must move around, but since units are constantly moving and changing positions, their collisions are calculated as they move along their path. In this game I implement a collision prevention check to stop units from walking on top of each other. To make it work, each unit has a priority based on their distance to their goal. The unit closest to it's goal will be given the right of way.

There are also instances where I would allow units to pass through one another when getting into formation. I also tried resolving collisions that were not prevented, but that would result in a huge chain reaction of collision resolving in a tightly packed group. From the research, the best way to handle unit to unit collision is to have a grid that all the units shared to predict and resolve collisions with one another.

I'm just settling with my single collision prevention method for now since this game is a tower defense at it's core and this is my first time implementing RTS style movement.

Formations

Formations are important to allow units to flow in a group and prevent units from having the same destination point. A well thought out formation should take into consideration the terrain and structures by forming around them without splitting the group.

Read more about:

Blogs
Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like