Monday, September 24, 2018

Using High School Math After High School: How Good are Bullseye Arc Abilities?

A few days ago, I was tweaking my ship efficiency spreadsheet and came across a problem. Some pilot abilities like Torani Kulda's and Soontir Fel's only trigger when enemy ships are in their bullseye arc. To properly evaluate these ships, I need to put in how many times these abilities will trigger each game. What's a reasonable number to put in?

In other words, I need the chance an enemy ship will also be in your bullseye arc when you catch it in your firing arc.

Irfanview has a paint feature!

Turns out, we can answer this question with some high school math. Take that, everyone who says you'll never use high school math after high school!

Do board games count? I'm not sure board games count.

Just like in the textbooks, you can scroll down to last section of this post (titled "Out of the spreadsheet, onto the board"). I've put all the final numbers there, and the discussion afterwards simplifies everything to just the important takeaways.

For everyone else who loves math (all three of you), or if you're a parent who wants to spend a fun afternoon bonding with your kids by doing some math problems (you can tell I'm neither a parent nor a kid), read on!

All information in this article is presented "as-is". The author makes no representations and extends no warranties of any type as to the accuracy or completeness of any information in this article. Please let me know if you find any algebra or copy-paste mistakes.

A decent place to start


We can start by asking what fraction of the forward firing arc the bullseye arc takes up. Calculating the area of the total firing arc and the bullseye arc is pretty straightforward:
  • The bullseye arc is a rectangle. The area of a rectangle is its width times its height.
  • The forward firing arc can be divided into two areas. First, there's the rectangle that extends from the width of the firing arc. Again, the area of this is its width times its height.
  • The second firing arc area is the two wings that extend past the edges of the ship base. These are slices from a circle, and the area of a slice is equal to πr2 times the angle/360.

Here's a bad paint picture with these areas highlighted. We can clearly see why I'm not an artist.


Now we can plug in some numbers:
  • The length of the range ruler is 300mm. This is the height of the rectangles and the radius of the wings.
  • The width of the bullseye arc is roughly 15mm.
  • The width of a firing arc is roughly 34mm for small ships, 53mm for medium ships, and 72mm for large ships.
  • The angle of each wing slice is half the angle of the firing arc. According to mu0n, the angle is 40.62 degrees for small ships, 41.4 degrees for medium ships, and 41.76 for large ships.


After some number crunching and dividing the area of the bullseye arc by the area of the firing arc, we get the following percentages:
  • 6.1% for small ships
  • 5.6% for medium ships
  • 5.2% for large ships

In other words, you'd expect a bullseye shot roughly one-in-sixteen to one-in-twenty shots.





I did everything wrong


These numbers don't quite answer our question. They tell us how often a random dot in the forward firing arc ends up in the bullseye arc. Problem is, ships in X-Wing aren't dots (even if my opponent's ships sometimes feel like dots). Ships are (almost) squares that take up a significant amount of space. How does that change our answer?

Let's go back to the equation for the fraction of the firing arc that the bullseye arc takes up:


Using ship bases instead of dots will increase both the area of the bullseye arc and the area of the firing arc. When both the numerator and the denominator increases, it's not obviously clear whether the fraction will get larger or smaller.

However, there is a way to intuitively figure out whether the fraction goes up or down.

Fractions go up if multiplied by numbers larger than 1 and go down if multiplied by numbers smaller than 1. In other words, whether the bullseye arc percentage goes up or down depends on the percent increase of the bullseye arc compared to the percent increase of the firing arc when we go from dots to ship bases.

It's pretty clear the percent increase in the bullseye arc will be larger than the percent increase in the firing arc. Here's another bad paint picture where I widen the edges of the firing arc and bullseye arc to reflect a hypothetical ship base (ignore that it's circular and too small). While there's more teal in the picture, the red is a much larger percent of the bullseye arc than the teal for the firing arc.


That means the numbers from before are too small.


Doing things right (for parallel ships)


The answer depends on the size of our ship, the size of the enemy ship, and the orientation of the enemy ship. Small enemy ships and ships parallel to ours will increase the arcs the least. Large enemy ships and ships offset by 45 degrees will increase the arcs the most. So, we'll run the numbers for each combination of ship bases and the two orientations to get an upper and lower bound.

I'm also going to make some assumptions to simplify the calculations. The first is I'm going to treat all enemy ship bases as square (40mm for small ships, 60mm for medium ships, 80mm for large ships), even though they are slightly rectangular in practice. The second is I'm going to ignore the plastic part of our ship's base. This will save us an annoying calculation and only slightly overestimate the size of the firing arc.

Let's start with how the areas change when the enemy ship is parallel to ours.


For the bullseye arc, it's easiest to use the center of the enemy ship as the point of reference. The center of the enemy ship can be up to half of the width of the enemy ship base from the edge of these areas. That means each side of the rectangle moves out by half the enemy ship's width, or the total width of the rectangle increases by one enemy ship base.

The height of the bullseye arc actually stays the same. The center of the enemy ship base can be half of the enemy ship's length farther and still be in arc. However, the center of the enemy ship can't be any closer than half of the enemy ship's length or it'd overlap your ship. These cancel out, so the height doesn't change.

For the firing arc, it's best to keep the center rectangle the same and just work with the wings. For the wings, things get a bit messier because the corner of the enemy ship that touches the firing arc changes. The best way to figure out what's going on is to draw a picture, so here we go:

How do I draw dotted lines in Irfanview?

We can immediately see it's easiest to use the bottom-left corner of the enemy ship as our reference point for the right wing and double this area to account for the left wing. This lets us model the area of the wing as the same slice from the circle as calculated using dots plus the area of a parallelogram  with height h and base b as indicated (thanks to our simplifying assumption of ignoring the plastic part of our ship base). The height of this parallelogram is the length of the enemy ship base.

Now we only need to calculate the base of the parallelogram, so it's time to bust out trigonometry!


We have a right triangle. We know the hypotenuse (longest side, opposite the right angle) is 300mm, the length of the range ruler. We also know the angle of the corner closest to our ship is 90 degrees minus the angle of the slice. The cosine function gives us the relationship between an angle of a corner, the length of the hypotenuse, and the length of the non-hypotenuse side attached to the corner. The length of the base is equal to the cosine of the angle multiplied by the hypotenuse. (If you don't remember much about cosine, just treat it as a button on your calculator. Plug in your angle, hit the button, and it gives you a number which you'll multiply the hypotenuse by. Just make sure it takes degrees and not radians.)

Now we have all the numbers we need. Be careful to take the numbers based on the size of your ship and the size of the enemy ship!
  • The height of the bullseye arc and the height and radius of the firing arc is 300mm.
  • The effective width of the bullseye arc based on the enemy ship is 55mm (S), 75mm (M), or 95mm (L).
  • The effective width of the rectangular part of the firing arc is 34mm (S), 53mm (M), or 72mm (L) based on your ship.
  • The angle of each slice is 40.62 degrees for small ships, 41.4 degrees for medium ships, and 41.76 for large ships based on your ship.
  • The height of the parallelogram is 40mm (S), 60mm (M), or 80mm (L) based on the enemy ship.
  • The base of the parallelogram is 195.3mm (S), 198.4mm (M), or 199.8 (L) based on your ship.

And we get these results:
  • For your small ships, 18% (S), 23% (M), or 27% (L) of their firing arc is the bullseye arc based on the size of the enemy ship.
  • For your medium ships, 17% (S), 21% (M), or 25% (L) of their firing arc is the bullseye arc based on the size of the enemy ship.
  • For your large ships, 16% (S), 20% (M), or 24% (L) of their firing arc is the bullseye arc based on the size of the enemy ship.
In other words, roughly one-in-four to one-in-six of your shots will be in your bullseye arc. That's a large difference from when we used dots instead of ship bases.

Just tilt 'em (45 degrees)



We also need to know what happens when the enemy ship is offset by 45 degrees, because that should make the bullseye arc even larger. Things get messy, but thankfully I can gratuitously abuse the power of simplifying assumptions to make things easy again.

Let's start with the firing arc. It's actually the easy part, wings and all.


If we use the bottom corner of the enemy ship as the reference point, then we can use the original rectangular and wing portions of the firing arc that we calculated back when we used dots instead of ship bases. We just need to add the area of that orange rectangle outside the wings, where one side is the length of the range ruler and the other side is the length of the enemy ship.

Now let's look at the bullseye arc. We'll go back to using the center of the enemy ship as the reference point.

It's not what it looks like.

The trapezoid at the top is pretty easy. But see those little triangles at the bottom? They're -censored-.

I'm invoking the power of simplifying assumptions and pretending they don't exist. That's actually accurate for large-base ships, but those triangles will be bigger for small-base ships. I don't care, they're not worth it.

Now that we've ignored the hard part, the problem is easy to solve. The height of the rectangle is the range ruler minus half the diagonal of the enemy ship base. The width is the width of the bullseye arc plus the diagonal of the enemy ship base.

The trapezoid is also pretty straightforward. The area of a trapezoid is its height times the average of the two bases. The height is half the diagonal of the enemy ship base. The long base is the width of the bullseye arc plus the diagonal of the enemy ship base. The short base is just the width of the bullseye arc.

Now, let's plug some numbers in:
  • The is the height of the rectanglar parts of the firing arc and the radius of the wings is 300mm.
  • The width of the rectangular part extending from your ship base is roughly 34mm (S), 53mm (M), or 72mm (L) based on your ship.
  • The angle of each wing slice is half the angle of the firing arc. According to mu0n, the angle is 40.62 degrees for small ships, 41.4 degrees for medium ships, and 41.76 for large ships.
  • The width of the rectangular part extending from the wings is 40mm (S), 60mm (M), or 80mm (L) based on the enemy ship.
  • The width of the rectangular part of the bullseye arc and the long base of the trapezoid is 71.6mm (S), 99.9mm (M), and 128.1mm (L) based on the enemy ship.
  • The height of the rectangular part of the bullseye arc is 271.7mm (S), 257.8mm (M), and 243.4mm (L) based on the enemy ship.
  • The short base of the trapezoid is 15mm.
  • The height of the trapezoid is 28.3mm (S), 42.4mm (M), and 56.6mm (L) based on the enemy ship.

And we get these results:
  • For your small ships, 21% (S), 26% (M), or 29% (L) of their firing arc is the bullseye arc based on the size of the enemy ship.
  • For your medium ships, 20% (S), 24% (M), or 27% (L) of their firing arc is the bullseye arc based on the size of the enemy ship.
  • For your large ships, 19% (S), 23% (M), or 26% (L) of their firing arc is the bullseye arc based on the size of the enemy ship.


The hottest new strategy: 22.5 degrees!


This is left as an exercise for the reader.


Out of the spreadsheet, onto the board


First, let's recap the numbers. Here are the percentages of the total firing arc that the bullseye arc makes up. They depend both on the size of your ship (the shooting ship) and the size of the enemy ship (the target). The smaller number is if they're parallel to your ship, and the large number is if they're offset by 45 degrees.
  • Your small ship: 18-21% (S), 23-26% (M), 27-29% (L)
  • Your medium ship: 17-20% (S), 21-24% (M), 25-27% (L)
  • Your large ship: 16-19% (S), 20-23% (M), 24-26% (L)

We can also break this down by range bands. For Range 1 (yes, sometimes the parallel chances seem to be larger than the 45-degree offset chances):
  • Your small ship: 35-34% (S), 41-36% (M), 45-36% (L)
  • Your medium ship: 31-31% (S), 37-33% (M), 41-34% (L)
  • Your large ship: 28-28% (S), 33-31% (M), 38-32% (L)

For Range 2:
  • Your small ship: 18-22% (S), 23-27% (M), 27-32% (L)
  • Your medium ship: 17-20% (S), 21-26% (M), 25-30% (L)
  • Your large ship: 16-19% (S), 20-24% (M), 24-28% (L)

For Range 3:
  • Your small ship: 12-15% (S), 16-20% (M), 19-23% (L)
  • Your medium ship: 12-14% (S), 15-19% (M), 18-22% (L)
  • Your large ship: 11-14% (S), 15-18% (M), 17-21% (L)

That's a lot of numbers.


So let's simplify things. A survey by Gold Squadron Podcast found games averaged 11 rounds with 8 rounds of combat in X-Wing 1.0. I don't think this changed much in 2.0. Roughly 1-in-6 to 1-in-3 shots will be in your bullseye arc. You can reasonably expect 1 to 3 bullseye shots per game for ships that survive the full game and don't miss chances to shoot. Finally, while the size of your target matters a great deal, the size of the shooting ship doesn't matter too much. You don't have to feel too bad if you put a bullseye arc ability on a large ship.

Based on these numbers, here are some strategies which will significantly increase the number of bullseye shots you get:
  • Get closer, ideally range 1.
  • Go after their big ships and their formations.
  • Get multiple enemy ships in arc.
  • Angle your ship relative to the enemy ship, ideally 45 degrees (this increases the size of the bullseye arc by up to 25%, but also increases the size of your firing arc so it won't show up in the percentages above).
And of course, you can always deploy across from enemy ships to line up the first shot.

This can help you make decisions when list-building. For example, Predator may be hard to value if you think of it as a reroll for shots in your bullseye arc. Predator granting you roughly two random rerolls per game is much easier to think about. If Predator requires two uses to produce an extra hit but you're only averaging two uses of it per game, Crack Shot may be a better choice.

Now, go out there and try lining up your bullseye arc (or not)! Don't follow my example and spend more time mathing X-Wing 2.0 than playing it :).