This is going to be a lot different from everything else I have done for this class. Everything before this has been simple enough that I could just make something that looks at the numbers and chooses the optimal play. Using a less concrete strategy and coordinating up to four tanks will require a much different approach. I have a few ideas, but implementing them will be much less straightforward than the previous projects.
The simplest idea I have is to just have each tank track the nearest tank and shoot at it. I already started this, and I have it to where I can tell tanks to shoot at a point, so this won’t be a big leap from there. This is the simplest strategy, and would pretty much just hope for the other AIs to simply perform worse than mine. This is also the most boring strategy to make, so I want to make something at least a little more complex. This will be my backup in case the other strategies don’t work out as well.
The way I make the tanks shoot at a target is fairly simple. After finding the path to the target, they check if the last point in the path is visible, and then when it is, stop following the path and start shooting at the target. I also added a bit of code to prevent tanks from shooting while their teammates are in front of them. This would be the bulk of this AI strategy, but with an extra bit to set the targets of each tank to the closest enemy tank.
Another strategy I came up with uses the mechanics in an interesting way. The strategy is to group up all of the tanks and travel in a pack, because tanks don’t collide with each other. The problem then is trying to shoot, so I thought about making each tank take turns peeking out ahead and shooting, then returning to the pack. This strategy has some benefits, like taking up less surface area to be shot from, but is mostly just something I thought would be funny to see. Unfortunately, I have found that the tanks seem to shoot from behind a little, because my tanks can shoot teammates that are overlapping and slightly behind them. This might make the strategy less effective, as peeking out would take more time and possibly be less efficient. I still want to try it out, even if it doesn’t work that well and is just something to bring out when I’m in the lead or something.
Some other strategies are basically just counter play to other strategies people might use. A counter to the stay still and shoot at the closest tank strategy would be to have a tank drive by and distract the enemy tanks, while the other tanks open fire. Even if the enemy tanks move while shooting and just drive at my tank, if they move predictably enough, I could use that to predict where to aim, because I can control where my distraction tank will go. This would require their tanks to drive pretty much exactly how I would expect, which is unlikely with all of the different pathfinding and steering strategies people might use.
Beyond higher level strategies, I will also probably implement more lower level improvements and optimizations. Things like aiming ahead of moving tanks, or improving my path smoothing, which still has a few issues. This would also include things like avoiding shooting my own tanks, which I already implemented. These types of improvements will help my tanks no matter what higher level strategy I am using.