Monday, March 24, 2014

UAV Simulation - How do you stop these things?

First off, those of you who voted in last week's poll picked the Torrent MCX over the Chaingun Ray by a margin of 41 - 9.  Thanks for believing the article.  If anyone builds some Torrent MCX, let me know how you like them.

There is a saying in Engineering: All models are wrong, some are useful. 

I built a model to attempt to simulate what is happening when UAVs go up against defenses.  I used the published statistics and some video analysis to get the data to input.  I'll explain how the model works as I go, and I'll try to point out the limitations.  I won't attempt to convince anyone (even myself) that this model will accurately predict exactly how a UAV hit will go down, but hopefully my model will help us understand what types of defenses might work better than others against UAVs.

Quick Edit (11:30 AM):  Some early responses pointed out that penetrative resistance works very well to stop UAVs from doing damage.  This is absolutely correct, and I didn't try to address that part of UAV defense in the simulation here.  I'm only looking at what configurations of countermeasures work the best.  Mix Resistance % and Plate Subtraction for best results.

Another Edit (26 March 10:30 AM):  Sorry - I intended that you would be able to edit the simulation in place to test out your own defense scenarios, but that didn't work when I posted the article.  It works now.

First of all, I'll explain how my simulation is built.  I used Excel, and simulated in time steps of 0.1 seconds, which conveniently is the salvo time of countermeasure weapons.  
For each time step, 

  1. (Launch Event) UAVs are launched: Number of launchers every reload time
  2. (Enter Def Event) UAVs move into defensive range: Time delay from launch
  3. (Enter Off Event) UAVs move into firing range: Time delay from launch
  4. (Shots Ready) For each defensive turret type: If shots are available, fire shots up to number of turrets & available shots (salvo).  If no shots are available, see if reload time has passed & if so, reload and fire shots.
  5. (Hits/Hornets Downed) For each shot fired, multiply by accuracy to determine how many UAVs are shot down.  Yes, I'm keeping decimals here, since I'm working with expected values.  Remove UAVs in offensive range first, since those are closer.  For flaks, divide number of UAVs by 10 and round up to estimate how many UAVs are downed from a flak shot.
  6. (Firing/Damage) Surviving UAVs in firing range do damage equal to the DPS * time step.  I don't try to accurately figure out when each UAV fires, since I'm just keeping track of the total number of UAVs in range instead of each individual UAV's dwell time.
  7. (Leave Event) After entering firing range, and after swarm time, UAVs leave.  The number of UAVs leaving is equal to the minimum number of UAVs in firing range during the previous amount of swarm time.
  8. (In Range) The number of UAVs remaining in range move to the next time step.

Lucky for me, a couple players were kind enough to hit my base with UAVs, and I was able to play them back and perform some video analysis to determine the UAV travel time.  For you who are interested, I recorded the video with Camstudio, and used Xnote to overlay the time reference.  

Video Link 1: Not sure if he was just out to steal some resources or if he overprepped or if he crashed here.

Video Link 2: This guy just barely avoided losing some medals.

(music by The Dead Weather)

To determine the travel time of Hornets, I tried to find a time where I thought that the carriers were at max range when they launched at a target, and tracked the time of the first UAV between launch and doing damage.  In Video 1, the event I used was when the carrier launched at my first Cerb turret.  It launched the first drone at that turret at time 28.333, and the Cerb started taking damage at time 32.717.  Unfortunately, the first two drones got shot down before taking damage, and I think it was the third drone that got through to begin doing damage.  It seemed to be about 0.7 seconds behind those first two drones, so I estimated the travel time to be 3.7 (32.7 - 28.3 - 0.7) seconds to go from max range to firing range.

Some more estimates I made in that area are:  the defensive range is a average range (weighted by number of shots) of all the different turrets available to fire, and I allowed the turrets to be behind (or ahead) of the target by some distance, so they aren't all on top of each other.    

Analysis: Video #1, First Cerb attack
My first run through with the sim, I tried to recreate the conditions of the hit from Video #1 on that first Cerb - the problem is that not all of the offensive ships start firing at that turret at the same time.  The Triton fires first with three launchers (at time = 28.333), and then the two carriers come in with 8 launchers each some time later (times x and y).  I also think that the range from my Triton to the turret is marginal - I think the hailstorms cover the turret but the phalanx don't, since you can see yellow shots but not white.  What is interesting is that the difference in ranges is only 6 (55.5 vs. 61.6) so even though the UAVs orbit their target, the range calculation may just use the range to their target, because the phalanx would have covered part of that orbit otherwise.

From Video #1 , I see that the Cerb is destroyed at time = 51.671, which means that the UAVs actually took 23.3 seconds between first UAV launch and destroying the turret.  When I run the simulation with 19 launchers, a offset range of 56 (chosen to allow two shots in defensive range before firing), and 5 Hail C on an R4 Triton with CM3, and try to determine the time it takes to do 28,800 ship damage (My Level 4 turret has compound plates, so it has 10,800 health with 33% penetrative resistance or = 10800 * 1.33, then doubled since UAVs do half damage against buildings).  The Simulation indicates the turret should have been destroyed in 7.2 seconds.

Not really very close there... is it?  I have a suspicion on a major source of error... let me look at Video #2, and see how the data looks against an undefended turret:

Analysis: Video #2, Undefended Cerb
I'm using the attack on the 4th Cerb for this analysis.  By this time my Triton is sunk, and so is one of the attacking carriers.  So I have 3 ships with 8 launchers each (24 UAVs) attacking a Cerb, and no countermeasures are in effect.  The turret under attack has ablative panels (no penetrative protection), so it should be destroyed after receiving 21,600 ship damage.   The UAVs are launched at time 2:01.685 and start doing damage at 2:04.727.  This shows a 3 second travel time.  The turret is destroyed at time 2:13.057, which is a video time of 12.4 seconds to destruction.  The simulation shows 5.9 seconds to destruction.  (and I had to leave in 1 defensive turret to get a proper run)

Since the countermeasures aren't playing a role in this one, I'm adjusting my DPS calculation to get the right answer... If I drop the UAV Ship damage from 66 to 11.7, then the destruction time matches.  If I put the conditions back to the conditions from Video #1, the time to destruction is 24.2 seconds - which is actually a pretty good match to the 23.3 seconds from the video.

Although I'm not too comfortable with proceeding with such a large difference in my DPS from expected, I'm going to run with it... mostly since it is Sunday night as I type this, and I'm on a self-imposed deadline.  I will go back to my first statement, "All models are wrong, some are useful"  Let's try to get some use out of this.

Note that I've seen people make statements on the forums that weapons actually only do half of their listed damage.  I've always been suspicious of this, but that could be part of my problem here.

Analysis: Hails vs. Phalanx
To try to see what works better, Hails or Phalanx, I'm going to do some more runs, starting with my Triton configuration (5 Hail C, 5 Phalanx 3, Countermeasures 3, Full Rank and Alliance bonuses for both attacker and defender ships) as a baseline against 24 UAV launchers.  I'll run the sim for 15 seconds, and look at the effects of removing the Countermeasures special, and also of different mixes of Hailstorms and Phalanxes.

CM3?Damage after 15 secondsHail KillsPhal Kills
Triton R4: 5 Hail C 5 Phal 3Y1491126.2586.4
Triton R4: 5 Hail C, 5 Phal 3N1550422.564.8
Triton R4: 8 Hail C, 2 Phal 3Y185984825.92
Triton R4: 10 Hail C, 0 Phal 3Y20328600
Triton R4: 2 Hail C, 8 Phal 3Y141029103.68
Triton R4: 0 Hail C, 10 Phal 3Y156770129.6

First off, I would have expected a lot more damage on the no countermeasures run, the damage only went up by 600 (4%) and I would have expected a number closer to 20% (the accuracy difference.  The Phalanx are more effective than the Hailstorm, likely because of their much greater accuracy.  The Phalanx are limited by the one shot per target per salvo, and my simulation does not account for that, but with the number of UAVs in range, the Phalanx would have plenty of targets on each salvo, so I don't think that is affecting the results.

Another interesting point is that the run with all phalanx did not do as well as the run with 8 Phalanx and 2 Hails.  When I look at the raw data in each time step, it seems like this happens because when there is only one type of defensive weapon they all run out and start reloading at the same time.  The most disadvantageous situation is when the defense holds off a wave of UAVs, but is almost out of ammo.  Then they wait for the next wave of UAVs, fire a shot or two then run out and have to reload.  Then the UAVs start building up.  When the weapons are mixed, one weapon is reloading while the other is still active. 

Analysis: Add a Defensive Turret or Two
Next I'll look at the benefit of adding Flak or Bombard turrets to cover the Triton.  I'll assume the turret is 20 spaces behind the ship target, and mounted with an advantageous special (Barrage Rack 3 for Flak, Enhanced Propulsion for Bombard).  The assumption I made for Flak effectiveness for this simulation, is that if there are 1-10 UAVs in range, the flak shoots down 1 UAV, if 11-20, 2 UAVS, and so on.  I drew a circle around a target, laid out UAVs on that circle, and estimated splash range to come up with that.

CM3?Damage after 15 secondsHail KillsPhal KillsFlak KillsBombard Kills
Triton R4: 5 Hail C 5 Phal 3Y1491126.2586.400
Triton R4: 5 Hail C, 5 Phal 3 + FLAKY61326.2586.4800
Triton R4: 5 Hail C, 5 Phal 3 + BOMBARDY719726.2586.4047.25
Triton R4: 5 Hail C, 5 Phal 3 + FLAK + BOMBARDY90326.2586.47036
Triton R4: 5 Hail C, 5 Phal 3 + 2 FLAKY7026.2586.41100
Triton R4: 5 Hail C, 5 Phal 3 + 2 BOMBARDY198926.2586.4082.5

With only one turret to add, it seems the Flak is the most effective choice, as it becomes more effective as the UAVs build up.  With two turrets dedicated to antis, the two Flak configuration in support of the Triton allows the defenses to almost completely hold off the incoming UAVs.  Although the bombard is useful, it looks like the flak is a better choice.

So what have we learned about defending from UAVs?

- For ship based weapons, Phalanx are better than Hailstorms
- For base turrets, Flaks are better than Bombards
- For the most effective defense, combine different defensive types.

Oh yeah - Here's the sim to play with:


Next week: A discussion about the most important hull in the game  (I've got my answer in mind & I'll be writing my article about it, but I'd be interested to hear yours - Vote in the poll!)