So Im in a competition where we build the AI for killbots, and run a tournament to see whose is the best. There are several weeks involved, so our AI has time to get nice and complex. From the get go, these are my plans.

This is currently just picking random points on the map and moving directly towards them. The easiest thing I could do would be to add a small jitter to this, so that it ‘zig-zags’ towards its movement target. Eventually, this will need to move through a maze, though, so what it needs to do is set up a path, with each point on this path taking up a tile. If the path moves through a wall, it should push the section of the path around that wall, creating or deleting path sections as needed, until a path is created that moves around the wall sections and still reaches the movement target. I could also take into account spotted bullet trajectories and avoid moving through them while they are alive.

Currently, I am using a Dead Reckoning model of prediction. Dead Reckoning is more often used (in computer games) to lower network load in multiplayer games, by removing the need to update clients/servers at the games refresh rate. (read more under dead reckoning for networked games).
You may have seen another use while playing a dogfighting game, where a trajectory is painted in front of your target, so by shooting this instead of your target directly, you should lead your shots into them (providing they do not dodge).

ps, this is vector math.

The way I am achieving this is by first approximating the target bot’s movement. This game is on a 2D board, so positions are in x,y co-ordinates. if we spot the enemy and note their position as (2,5), then in the next turn their position is (3,7), we can find their next position by adding the difference of those positions to their current position.

(3,7) – (2,5) = (1,2)
(3,7) + (1,2) = (4,9).

So, now we know that in the next frame if they keep their current trajectory, they will be at (4,9). Now, my bullets have a high movement speed, but I still need to adjust for the travel time. If the enemy is too close, I may over-compensate, too far away and I will under-compensate.
To deal with this, I need to find my own bullet speed to find out how far the bullet will travel each frame and the distance it has to travel to reach the target. We then add the leading distance for each frame the bullet needs to travel to reach the target.

So that makes the equation
enemy movement difference * (bullet move speed / distance to target)

I need to do more testing to find the best stats to build with this, but so far im getting around 40% accuracy.

My plan here is to track any bullets I see and build a trajectory out of them. While I could just assume that they are moving towards me, if I dont at least take into acocunt that i may be seeing the same bullet again, I could end up just running into bullets.

I also wanted to track wins/losses and the different stats that the bot was running, to see what the best build seems to be. I could even take into account the bot i was fighting at the time. This data could be used to ensure I have the best build for each opponent.
If I put in multiple behaviour types, I could also switch those out too.

Stay tuned for updates!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s