-
Notifications
You must be signed in to change notification settings - Fork 24
Tournament Writeup 2023‐09‐06
https://oort.rs/tournament/fighter_duel.20230906.7764
My AI's strategy was to fly towards a point 1 km away from the target, using guns and missiles to engage it. It will initially move towards the origin until it finds the enemy. Thrusters are controlled with proportional navigation.
The radar sweeps around at max width to search for a target and will then zoom in by halving the beamwidth per tick to a minimum of 3 degrees. The radar will ignore missiles that aren't considered a threat (threats are things that are heading for us or very close to us). Periodically the radar will increase the beamwidth to search for other targets.
Target leading for guns is done with a closed-form solution that doesn't account for acceleration. There's no filtering applied to the target position/velocity.
Missiles are apparently only fired when we're in guns range (this was a bug). The position and velocity of the target is sent via radio only when the missile is launched.
The missiles are more sophisticated than the fighter (since this AI was originally written for the scenarios with bigger ships). They use proportional navigation for seeking with a random N. The missiles keep an estimate of the target's position and use radar returns to update it. The radar stays pointed at the predicted position. When the radar contact is lost it will increase the beamwidth and distance filter until it reacquires the target or gives up. It doesn't make much of an attempt to search for targets at long range. The missile uses the ShapedCharge ability to its full extent.
I think this AI was successful due to it being able to shoot down enemy missiles and get to close range. Against some opponents this resulted in gun kills and others were pushed off the edge of the world. There's a lot of room for improvement in this AI around its use of radar and positioning. I think it was able to find enemy fighters largely by following the trail of missiles fired at it.
Both fighter and missile just scan in a circle repeatedly until they find a target. When a target is found the radar is focused on the target and scaled to the smallest value such that that the perpendicular velocity of the tracked target is insufficient to leave the radar range. Missiles are completely ignored by the radar.
Both fighter and missile keep the last known target's position and velocity. If they don't have a known position/velocity they check the radio to see if one is being broadcast. If it is they use that.
This works out so that the missiles are guided by the fighter until they are close enough to either another missile that is tracking the target or they are tracking the target directly.
The missiles attempt to accelerate both to the target and to keep the target's perpendicular velocity at 0. They use a scaling factor that is inversely related to fuel left for how fast to accelerate toward the target compared to maintaining 0 perpendicular velocity. This was an attempt to keep enough fuel left to correct perpendicular velocity when the target appears more accurately on the radar. It seems like it is probably more effective to just accelerate at max speed until some threshold is reached since accelerating toward the target is less effective the less time the missile has left. It does sometimes have the effect of grouping missiles.
The missiles stop accelerating when low on fuel because they are likely to be close enough to the target that the target's anti-missile system gets confused and blowing up is a waste.
The fighter uses the target's last known velocity and current velocity to estimate acceleration. It uses an iterative algorithm to guess where the target will be given this velocity and acceleration. It takes its own velocity into account along with bullet speed when deciding where to aim.
I'm not sure why this method is less accurate than rlane's, but it was so inaccurate I didn't find it worthwhile to track missiles and shoot them down.
The fighter attempts to orbit the arena. I implemented this poorly so it crashes on the outside sometimes.
There are two main radar modes used: Search and Track.
In Search mode, the radar rotates around the full circle and keeps track of every contact it finds that is separated by some distance. The radar sweep uses quarter circle steps instead of single beam width increments. I don't really know if this is a good idea.
In Track mode the radar looks at one specific location that is updated with each contact. The beam width and distance filters are adjusted by distance and time since the last contact. The longer ago the last contact was the more 'zoomed out' the radar beam is.
For this scenario the first contact of a search is immediately used as a track target. Missiles are always filtered out.
Missiles switch the radar search with a radar sweep using a beam that starts with a high width and increasingly looks at larger angles to the estimated target position since the last contact. If the maximum angle is reached the beam is narrowed and the sweep is repeated until a contact is found. At that point the missile switches back to track mode.
In general, every 'target' keeps the position, velocity, acceleration and last update time of that target. This makes it easy to always get a decent estimate of the position, even when the last update was some time ago. This worked well up to 1~2 seconds. Whenever a target is updated the new position, velocity and acceleration are averaged with the previous values with some mixing factor.
If a missile has no target, it waits until it receives one via radio. Position and velocity is transmitted by the fighter for a couple of ticks after firing a missile.
Once a target exists, time to impact is calculated. First closing speed is calculated and time is approximated using distance and closing speed. Then the time estimate is improved by taking the acceleration of itself and the target into account.
I found that this approach worked decently well, but is very unstable if the closing speed is low and target velocity and acceleration vary, due to tracking noise. Once the distance is small enough and the closing speed is more significant than the acceleration the resulting estimation is very good.
If the missile predicts it will reach the target in less than 10 seconds, it tries to align it's velocity with the direction to the target while accelerating towards it. The factor that mixes these two is scaled by the inverse of the distance.
It the time to impact is larger than 10 seconds and the missile has a lot of fuel it will accelerate straight towards it's target.
Otherwise the missile just coasts.
To conserve fuel, once inside the 10 second range, the acceleration is scaled such that it could keep acceleration like this until impact.
The missile explodes if it is within 50 meters of the target, or if it was within 250 meters at some point and is now further away than last tick.
This was an afterthought. The Ship stays pointed towards it's target and some rotation is randomly applied while the gun is fired. The idea was that this is better than nothing, at least some missile would be hit by pure chance.
The fighter tries to keep some large distance to the target while acceleration perpendicular to it. I tried to also keep it from flying to it's death by leaving the arena, but apparently those efforts weren't enough. I saw that this still happened in the tournament.
I think the largest improvement would be to actually try to shoot incoming missiles down. When comparing my AI to that of @rlane, it is obvious that this is hugely effective.
Not leaving the arena would also make a good improvement.
Another thing that I'm not happy with is the early part of missile guidance, often I see that missiles miss because they don't have enough fuel left to correct their past mistakes.
Having missiles and the fighter collaborate with tracking the enemy via radio, so that every ship has the best possible target info would also be good. I believe this would to some extent also alleviate the issues with missile guidance.