One of a shortest talk my team and I had during our final year.
« -So, about bots ? …
-We will never get the time to do that, a multiplayer game in such a small amount of time and considering our current knowledge, it’s already a big challenge, so no bots. »
But for now I’m looking for a job, so I have some free time, and we always thought that if our game wasn’t a student project, it would features bots. So I’ve decided to try my best designing and programming bots, to practice some Game Design and continue to improve my knowledge of Unity, as well as keeping myself doing things, because being unemployed is really unpleasant and boring.
A build with bots should be release soon in Aces Moddb page. (it will be version 1.2)
I’ve started to think about how bots could move in our level. I wanted bots to move as close as possible from the way a player make his plane moves. My solution was to use the point graph from the free A* Pathfinding plugin. It consist on a lot of nodes linked each others (if the distance isn’t to great and if there is no wall between them), and the plugin calculate the way to reach a point using nodes.
One of the biggest programming challenge was to find the way to make bots move from a node to another. I didn’t want to use something like a LookAt, or a basic translate, because it would’ve look « unnatural ». So I’ve finally find a way to « calculate » the inputs needed to make the plane moves, as if the bot uses a controller, just like a player (it was very challenging to find a nice solution, I’ve worked a lot on paper, then tried a lot of way to make it in code) (so rewarding to find a solution!).
Little experiment to show how the bot follow a target
For the AI, I’ve finally decided to create an entity which looks at the state of the game, and gives missions to bots. Because it’s a game based on team play, I didn’t want to give a big AI to each bot and a system so they could interact and communicate each others, it would’ve been too complicated for, I think, the same result.
But to complete the main entity, each bot got a basic AI, which provides it some « instincts ». So a bot can decide to engage and fight an enemy plane, or stop his current mission to escape several enemies.
Problem at the beginning, if 2 enemies bots alone encountered, they couldn’t dogfight properly which resulted in an infinite loop…
[Not to strange result, because the basic of dogfight is trying to get the advantage over your enemy making turns as quick and as little as possible in order to shoot at him, and for the bot, it's the quickest way to get a target]
After several trials, I’ve decided that if two plane confront each others, one will be « aggressive or passive » and the other « passive or defensive », so they can’t really have a duel, but no more infinite loop, and a better result for the game’s flow. So for an encounter, the possible combinaisons are:
- Bot 1 : Aggressive / Bot 2 : Passive
- Bot 1 : Passive / Bot 2 : Defensive
- Bot 1 : Aggressive / Bot 2 : Defensive
What bots can do:
- Capture points
- Attack turrets
- Defend turrets
- Get in fight with enemies
So yes, they can finish the game.
With some patience you can see the end of a game « Bots vs Bots ».
In my opinion, bots are more interesting to play against humans. Even if they don’t use abilities, they can focus on objectives and, to be honest, I think they can win against a team of 5 humans beginners.
Little overview of the bots
Heatmaps of a game « bots vs bots » (red won – 25 min)
All – Blue Team – Red Team
In the future, I want to add more and more « moves » and reactions to bots, in order to make them as interesting as possible.
I definitely want them to use all the narrow passages and tricky shortcuts when they are escaping an enemy!
Of course I also want them to use more abilities (at the moment they just use rockets versus turrets).
It was very interesting to work on AI and to find solution to the problems raised by bots in a MOBA which features planes in a close environment.
+ / I’ve managed to create some basic bots, with basic AI.
+ / First experience in AI design, very interesting.
- / I have some strong scripting skills now, but I’m not a true programmer, so I had to limited myself for the AI design, because I know my limits.
+ / I know my limits.
- / Still unemployed at the moment.
Full game video. So I play with 4 bots versus 5 bots. There is a bug with bots which start a sound when they take damage as it happens to me. So, sorry for those annoying sounds, hopefully it’ll be fixed soon.
(Sorry it’s not in HD, just because I have a really bad connexion, maybe one day I will upload it again in full HD) (the upload of this one last more than 6 hours)
Oh, and it can be nauseous sometimes to watch (especially with my specials moves – yeah I’ve crashed a few time during the game -) but if you actually play it it feel much better I can assure you .