top of page
Writer's pictureCallum Pearce

RTS Combat


Following on from my last blog post, I need to start working on some proper combat in the game. However, it is at this point in my project where I start learning about multiple ways to go about solving different solutions, and it what situations each one is better than the other.

There are multiple ways how combat can work, and they partially depend on the formation style chosen. Originally, I intended to create a formation style that was able to be smart, move around object all while staying in formation. However, when it came to properly implementing this kind of formation I learnt it uses steering behaviours to look in front of it, and alter its path. As my units moved without velocities, it wasn't actually able to steer the AI properly. Therefore, the simpler method had to be chosen, and having the units all end up in a formation, but while moving have them in a line. This other method of formation using velocities, affects the way combat works, as it wouldn't rely on the pathfinding as much as the simpler method does. As units would be able steer away from objects, they would steer off a ideal path. The same would be said for combat, you could have more units bunched up around an enemy off the pathfinding than if it was strictly based on the pathfinding. As the simpler method was used, it does result in the number of units attacking to be limited by the number of free nodes around the target.

As a player could train an army to be larger than this limited number, changes had to be made so that when the units arrived, if they weren't able to attack that target, they would look for another target nearby within their line of sight. If there was no target, they would remain idle. This is the basic premise of the combat system, but getting this to work proved a challenge as a lot of errors involving the pathfinding kept popping up that had to be fixed.

Most of these errors are now fixed except one that is still causing a major issue. Sometimes units when sent to target anything, they will start moving then somehow flip onto their back, and start bobbing up and down on the spot. Sometimes it can be corrected, other times that unit could break like that until the game has ended. So planned next is further research into the movement system/the movement components on the units like rigidbodies to try and diagnose the problem that is happening.

Now that the combat has been added, my next and final plans are to get the AI to start buildng up and army and attacking the player. Even though most of the strategies talked about before exist for this to happen, it is coming down to the decision making of the AI when to start building an army, how many units to train etc... All of this can factor on different things so will be interesting to attempt.

41 views0 comments

Recent Posts

See All
bottom of page