The sun is not my friend.

This week I focussed on my killbot again.

Here’s the good stuff that happened:
Added stat tracking, now pumps out its initialized data and win state. This is the first step to setting up an AI that will set its own stats and behaviours based on the conditions it is playing in. I want to set up an AI that will find out the bot it is playing against and set itself up to best fight against that. I used this to find out what the best stats for my bot were when fighting itself.

stats1

As shown above, the best stats were a high bullet damage and medium to low health and speed. In this case, the bot had much higher bullet speed and damage. Its prediction was decent enough so that it could take out its opponent before being dealt fatal damage.

stats2

While against another bot the results for wins were similar but less pronounced.

Here’s the bad stuff that happened:
I got hit with a bad case of the heat exhaustions this week, which is a first for me. knocked me flat on my ass for a couple of days too, I couldn’t eat, stay awake and I could barely think straight, it was awful. Here’s my advice; don’t get Heat exhaustion, it really sucks.

So I began building up this thing without actually laying out a plan for it, which meant everything went right into the update. I pulled all of that out into their own functions with little issue, except that I could not find a way to get lines to draw if their code was outside of the update function. Now I could easily finish up the behaviours, and call on different functions whenever they were needed! Here is a list of what I attempted and what happened:

tried to improve upon the ded reckoning through an increase in accuracy (failed)
tried to create simple curve prediction by mirroring its path into the future (failed)
tried to incorporate bullet dodging by changing path when spotting a bullet (failed)
tried to create a function that allowed me to use debug lines anywhere (failed)
fuuuuck-mrw-i-accidentally-leave-my-phone-unlocked-next-to-my-girlfriend-and-she-check-my-messages

These were all made fairly impossible because of my ordering and spaghetti code. The prediction on the weapon is being overridden somewhere and a cannot figure out where so I cannot tell if anything I’m doing is more or less accurate.

The path mirroring into the future mirrors left to right as well as up to down, I need it to only mirror left to right. This is also only useful if the enemy is only moving in a circle that never changes in radius (or is pulling large curves very often).

Dodging is another issue where the function was being overwritten later in the code, which should be reasonably easy to fix, but this problem has only recently occurred to me and prevented my progress on the matter.

I don’t even know with the debug lines, I’m assuming I’m overwriting something somewhere, but I have no way to debug the tool I’m using to debug stuff. All I know is it works in the update function and nowhere else.

So I am pretty sure I will be able to get these issues fixed up in the next couple of days after a little more rest. I’ll clean up my code, attempt to get rid of all the parts overriding the smarter parts, and push in better prediction and bullet dodging. These should be the two behaviours required to beat the other bots.
Wish me luck!

KILLBOT TOURNAMENT

 

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.

Movement:
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.

Prediction:
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.

vector
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.

Dodging:
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.

Smarts:
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!