Auto Combat – Creating flow

Hey! Let’s make a serious game dev blog 😀

Today is the first day of the Dog Year, Yey! Happy Lunar New Year!!! Since this is my “serious” dev blog writing, I just share a bit of my combat system idea first.

Inspiring by Final Fantasy XIII-2’s combat AI system, I try to create a similar one myself. I thought it should be very easy at first since it’s just moving around the target, but the more I observe it, the more I am amazed by the pace of the combat and the positioning of each character.

Another reference I try to learn from is Ni no Kuni II. This one is a bit different but apart from being able to control one character of the party, the other characters’ AI perform beautifully during the combat. It gives out a feeling that your comrades are cooperating with you to beat the enemies.

Anyway, here is the trial-and-error steps that I makes to imitate the AI positioning from references above.

1) normal approach when in Combat Idle:
I am using an amzing A* path finding plugin from https://www.arongranberg.com/astar/, this one has quite many type of path finding system. My first setup is just letting the AI move toward it’s attack target and attack. Look pretty messy at first. It use the default Grid AI so currently they don’t avoid each other while moving.

https://gyazo.com/bc790da33d6c8e8bcf518d8320a08062

Note: the red-wing beetles are my summon familiars.

2) RVO
Since the first one didn’t work well, I have a though of another path finding system this plugin provide, called RVO (reciprocal velocity obstacles) or local avoidance system. It’s demo shows an amazing result when you deal with enormous amount of characters moving at the same time. However, after half day of integration, it’s just a bit nicer (cry). Maybe of my coding logic or I think because their moving targets are to close to each other and RVO control them to move slowly (while avoid clashing each other – like driving car) and it’s still not what I want.

https://gyazo.com/ee1e850e71ef14af0430843ff7c06210

3) Grid Obstacle
Ok! After undo my RVO code and back to default grid path finding, I just remember in the plugin’s examples, there is one which demonstrate a bot that avoids a moving cube. That cube uses a component called Grid Obstacle, which makes a realtime moving obstacle updating to the grid map frequently. So I tried to add it to all my characters. And BOOM! Nice result. Should done it from the beginning though, but at least I learned how to integrate RVO, which what I always want to try out.

https://gyazo.com/dc3ff358aa574ed8d4fd74a12175f80d

4) Moving before attack
After satisfy with the path finding AI, now comes the character’s behavior. Since I want to bring in the FF XIII-2 combat system, I have a turn meter (like old turn base game) which controls attack turn of each character. I set them to stand still until their turn, result look boring though…

https://gyazo.com/ebf58a901aaf238a5004daa4af2a0aa0

5) moving backward to create gap after attack
I found that in FF XIII-2, after attacking, the players will move backward to create a gap from their targets. In this way, they will have more space to perform a dashing strike or a nice magic trail attack. In the same time, it feels more real like real life situation. I integrated it in and have a quite nice result.

https://gyazo.com/5a4348d28d469df28f2f93a33a957a44

6) Replace character and skill
I guess it’s not that bad 🙂 hopefully later when eye-catching skills have been added, as well as smart-camera AI system, I can reach the level of what FF XIII-2 and Ni no kuni II presents.

https://gyazo.com/4caa968f8fba8aacc04ca6b46749651b