Surprisingly enough this week, I focussed my work on the killbot, as there is a Killbot Tournament tomorrow. Over the last couple of weeks, I drank heavily while coding this thing and then stopped drinking while I untangled all of its code. I was running into constant conflicts where whatever thing I was trying to implement was being overridden by some other section of code that I had forgotten about, or was made impossible to implement as there was no safe place to push it in. I devised a new way to run the code with Adrian White, which is just three steps that the killbot moves through, with different behaviours that run based on that. This mainly makes it a lot easier to figure out what needs to happen when, and really cleans up my code, comparatively.
3 Step plan:
So as you can see in the extremely easy to follow diagram above, there are three steps to my killbots behaviour cycle.
Step 1 is a rotational scan of the battlefield, trying to spot its target. It can pick up an enemy, bullet or nothing. If it spots nothing or a bullet, it stays in this step, otherwise it moves on to
Step 2, where it scans again, except aimed at the same position where it saw the enemy last round. If doesn’t see anything, or only spots a bullet, it will move back into Step 1 again, otherwise, it will move forward into
Step 3, where it will predict the enemies movement and fire at the enemies’ estimated position.
The current pattern for my killbot is to rotate around by the FOV amount each turn, but flipping the angle to negative every second scan. I set this up to help avoid an enemy sitting inside its blind spot as easily (the first pattern we learn is just a clockwise rotation. it is very easy to place a bots movement pattern inside that huge blind spot based on their position and how much time has passed). The next thing my bot does is, once it fires at an enemy, it scans in the enemies last predicted position. If the enemy is not there, instead of resetting the viewing angle, it starts searching from that position. On average, this heavily reduces the time it takes to reacquire the target.
As previously stated, this bot uses the ‘ded reckon’ model of prediction (or something close to)
The way this works is the killbot captures its targets position over 2 turns. Using this we can find the enemies’ distance traveled and movement direction per turn. by adding this to its current position, you can get a good idea of where the target will be next turn, easy! The problem lies in the time it will take our bullet to reach the target. if it will take two turns for the bullet to reach the predicted target, the we have to aim two turns ahead. Now we have even further to travel to reach the predicted target, though, and so this starts to get very messy. The best way to do this is to predict a whole bunch of angles, and the respective targets position when our bullet intersects its path until we find one where the distance between the two converges to a point (or actually collides). If the enemy continues on this path then we actually have an almost flawless accuracy.
Currently, my killbot isn’t doing very much to trick the enemies prediction, it picks a random spot on the map and snakes its way towards that spot by applying an alternating
cosine and sine offset to its movement direction. This offset was amplified by its behaviour step counter, so it turned much harder as it was firing, but in writing this I just realised that this would lower its velocity and make it, on average, much easier to hit.
Anyways, wish me luck for the tournament, if I come last I will eat a whole bag of chewable cyanide tablets.