X-Wing Probability Calculator

By IronWardog, in X-Wing

I've made a small page that calculates attack probabilities in X-Wing that I've been using for a while and maybe other people might want to use it.

--- Adress is now a web redirect ---

Multi result version with line chart: http://xwingcalculator.ddns.net/diceuilm.html

Full version with pie chart: http://xwingcalculator.ddns.net/diceuip.html

Full version with line chart: http://xwingcalculator.ddns.net/diceuil.html
Basic HTML version: http://xwingcalculator.ddns.net/diceui.html

Alternate mobile layout: http:// xwingcalculator.ddns.net /diceuilmmob.html

Line chart will be integrated in the regular full version in the future.

It should look like this:

screen.png



Features

  • No casino style pre-computations
  • Hit probability distribution
  • Expected damage
  • Critical hit probability
  • Probability of keeping tokens after the attack
  • Several stackable dice modifier abilities
  • (Somewhat) Intelligent use of abilities/tokens, optimized for single attack, attacker/defender will try to maximize hits/evades
  • Virtually no dice limit (UI capped at 15)
  • Allows multiple tokens
  • Pluggable architecture allows new abilities to quickly be added
  • Shiny pie chart!


Known Issues

  • TLT token spending for both attacker and defender is not optimal (both try to maximize both attacks even when it brings no benefit)
  • Some reroll mechanics may not be aware of all other abilities.
  • Attacks with a lot of dice and rerolling can take some time and may cause the browser to pop up a warning. Press continue and it will eventually finish.

Potential Roadmap (if I need it and/or if people want it)

  • Integrate line chart in main UI
  • Multiple attack simulation (system already allows this)?
  • More abilities?
  • Result drill-down/exploration (there is a lot more information available than what is shown)?

How to use

  • Select the abilities you want to trigger.
    If an ability requires a token and you don't have it, the ability won't trigger.
    Missile/Torpedo abilities WILL trigger even if you do know assign TL/focus (this page simulates combat resolution only).
  • Select the number of dice to roll and the number of tokens.
  • Hit "Calculate"
  • The Hit distribution table will appear at the bottom. The pie chart will appear along side it if your browser supports canvas.
  • If you assigned tokens the token retention table will appear below. This shows the probability of having at least 1 token of each type at the end of combat.

FAQ

  • Do I need target lock to fire missile/torpedos?

No.

  • Do I need target lock to use Advanced Targetting Computer?

Yes.

  • How do I simulate Homing Missiles?

Set Attack Dice to 4. Add a Target Lock. Do not assign Evade Tokens to the defender.

Bugs, feature request, comments or request for redistribution can be sent to [email protected] in addition to this thread.

I've made as accurate as possible but it is bound to have bugs. Enjoy and Happy Hunting.

Edited by IronWardog

Added concussion missile.

Rather than a pie chart, I would suggest displaying the actual PDF and CDF. x-axis is hits, and y-axis is PDF and CDF. It's more visually intuitive than a pie chart in this case.

Edited by MajorJuggler

How hard would it be to include Gunner/Luke as options?

How hard would it be to include Gunner/Luke as options?

Relatively difficult especially if you want the attacker and defender to spend their tokens "intelligently" to optimize damage.

  • No casino style pre-computations

Can you please explain what this means?

Edited by EdgeOfDreams

@MajorJuggler

My first instict was to make a line chart with the cumulative but I thought it was easier for people to have a pie chart, I thought it would be easier to visualize partial cumulative probabilities (e.g. just 3 hits + 2 hits) but I'll make a version with a line chart and see how it turns out.

@bmf

Like MajorJuggler said, it is easy to put in but having it spent the tokens intelligently is not trivial. I'll try to have a crack at it. Interacting with TLT, however, is even more complicated.

Thank you for the feedback.

Edited by IronWardog

@EdgeOfDreams

One of the ways to implement probability tools is to have the computer roll dice millions of times for a specific sitation (3 atk with predator vs 3 defense with autothrusters) and store the result. The upside is that since you already computed it, it will give you the result quickly. The downside is that whenever you add a new ability you'll have to spend plenty of time doing the pre-computations.

This tool computes the probabilities on demand.

Rather than a pie chart, I would suggest displaying the actual PDF and CDF. x-axis is hits, and y-axis is PDF and CDF. It's more visually intuitive than a pie chart in this case.

Added a version with the line chart, links below.

I'm not sold on the line chart so I also made a version with the inverse cumulative that I like better.

I think I still prefer the pie chart if but you want I'll integrate the line chart in the UI or keep a separate version with it.

Version with line chart http://xwingcalculator.netau.net/diceuil.html

Version with line chart and inverse cumulative http://xwingcalculator.netau.net/diceuilinv.html

The calculator I've been working on ( https://docs.google.com/spreadsheets/d/1YrPMS-cdTpd4ASeQrlh5sGDD_hjpF0SbNRh8VEwm9UA/edit?usp=sharing ) does this. I've been working on an Android version, so this one hasn't seen much in the way of updates the past couple weeks. Once the Android version is stable I'll be porting the engine changes back into the JS engine.

How hard would it be to include Gunner/Luke as options?

Relatively difficult especially if you want the attacker and defender to spend their tokens "intelligently" to optimize damage.

Looks like something's funny with Wired.

If you run attacks with Wired and a TL, it likes to double the number of attack dice in the results. With vanishingly small probabilities, of course, but it's pretty cool that if I run a Phantom with Wired+FCS+Gunner, my second shot has a 7% chance of scoring 1 more hit than dice rolled. Or a 0.001% chance of rolling 8 hits for that matter.

Any plans to put in Adv. Targeting Computer?

Edited by Sparklelord

I love you.

  • No casino style pre-computations

Can you please explain what this means?

@MajorJuggler

My first instict was to make a line chart with the cumulative but I thought it was easier for people to have a pie chart, I thought it would be easier to visualize partial cumulative probabilities (e.g. just 3 hits + 2 hits) but I'll make a version with a line chart and see how it turns out.

@bmf

Like MajorJuggler said, it is easy to put in but having it spent the tokens intelligently is not trivial. I'll try to have a crack at it. Interacting with TLT, however, is even more complicated.

Thank you for the feedback.

Incidentally, computing the brute-force probability correctly with the exact answer actually takes far less time than calculating it Monte Carlo style as IronWardog described.

Rather than a pie chart, I would suggest displaying the actual PDF and CDF. x-axis is hits, and y-axis is PDF and CDF. It's more visually intuitive than a pie chart in this case.

Added a version with the line chart, links below.

I'm not sold on the line chart so I also made a version with the inverse cumulative that I like better.

I think I still prefer the pie chart if but you want I'll integrate the line chart in the UI or keep a separate version with it.

Version with line chart http://xwingcalculator.netau.net/diceuil.html

Version with line chart and inverse cumulative http://xwingcalculator.netau.net/diceuilinv.html

Right, I used the term CDF loosely; plotting the probability of at least x hits is what I had in mind, and is what you have plotted for your 2nd option. Now you just need to label the lines and axis.

[edit]

Also, you don't need a fancy higher-order line fit for the curves. Point to point fit is better. For example, in the standard plot of 3v1, the orange line dips below the blue line at about x = 2.5 to 2.75. This is not meaningful (and is actually deceptive) because the plot only exists at discrete values anyway.

[P.S. edit]

I added this to the Index of Useful links. :)

Edited by MajorJuggler

Looks like something's funny with Wired.

If you run attacks with Wired and a TL, it likes to double the number of attack dice in the results. With vanishingly small probabilities, of course, but it's pretty cool that if I run a Phantom with Wired+FCS+Gunner, my second shot has a 7% chance of scoring 1 more hit than dice rolled. Or a 0.001% chance of rolling 8 hits for that matter.

Any plans to put in Adv. Targeting Computer?

There was a problem with Wired, I've fixed it now.

I'll look into getting ATC in.

Rather than a pie chart, I would suggest displaying the actual PDF and CDF. x-axis is hits, and y-axis is PDF and CDF. It's more visually intuitive than a pie chart in this case.

Added a version with the line chart, links below.

I'm not sold on the line chart so I also made a version with the inverse cumulative that I like better.

I think I still prefer the pie chart if but you want I'll integrate the line chart in the UI or keep a separate version with it.

Version with line chart http://xwingcalculator.netau.net/diceuil.html

Version with line chart and inverse cumulative http://xwingcalculator.netau.net/diceuilinv.html

When I think about discrete probability density functions, my mental handle has always been a histogram. Line plots are a close second, but as MJ says, are moderately misleading (since the function isn't defined except on the natural numbers in range).

Regardless, this is a great tool, and I now have it bookmarked.

(...)

Updated the line chart with the legend and set it to point to point (bezier was default).

(Also removed the straight cumulative version, diceuil and diceuilinv are the same now).

Edited by IronWardog

Added Advanced Targetting computer.

The maximizing function is to sometimes spend the target lock instead of using ATC. The amount of risk you should take with this is debatable but I think I picked the best overal amount of risk. Though it means that sometimes you may have 0 hits, even with ATC.

Also edited the roadmap.

This is great work!!!!!

Thanks for pulling this together.

Oh my goodness.

You've just saved me a whole ton of Excel work in the name of curiosities. Thank you!

Edited by Reiver

Seems to be working fine on Mobile- and I use a non-standard mobile browser that usually has more problems than the common browsers do (safari, chrome, etc). So you should be good on the mobile front.

Very nice work! I'm impressed! I can't wait to see it after you've had some time to polish it up a bit more.

My only suggestions are these:

It would be nice if crits were reflected in the results somehow, though that does add a whole new level of complexity to your scripts.

Also, it's just a little thing, but it would be nice if the results were posted as percentages rather than decimals. But maybe that's just me. :D

--

Also, you don't happen to live in Utah and play at Game Night Games frequently do you? I'm pretty sure I know you... :)

Yes, I suppose I'll get around to add crits eventually, the thing is it is a fair bit of work and calculations are going to take a lot more time and I don't think the crit information is that useful (it is interesting, though).

Personally I prefer to look at decimals myself but, if I have time, I'll add an option for it show as percentage.

No, I'm afraid I live across the pond. I've never been to Utah.

Cheers.

Also Gunner should be out soon, I just need to run more tests and result optimizaton checks on it.

No, I'm afraid I live across the pond. I've never been to Utah.

Cheers.

Oh, my apologies. One of the local players here is working on an almost identical project as part of a college assignment. It will be interesting to look at his and yours when he's done and see how the results compare.

Gunner is now available.

It spends tokens in a smart way, however, for the defender, the token spending strategy depends on the ship you are defending with (you are probably more willing to let damage go through on gunner's first attack with a ship with high HP than, say, an Interceptor). Therefore, I've chosen a balanced risk analysis that produces better overall results.

You cannot use it with TLT (won't work if you try).

Also I fixed an issue with defense focus tokens being spent needlessly under certains circumstances. Hit probabilities are not affected, only defense token "chance to keep" are.

Finally, the host I was using is on lockdown so I can't update it. To work around it I've now put this on a Web redirect and switched hosts, here are the new links:

Redirection domain: xwingcalculator.ddns.net

Full version with pie chart: http://xwingcalculat...et/diceuip.html

Full version with line chart: http://xwingcalculat...et/diceuil.html
Basic HTML version: http://xwingcalculat...net/diceui.html

Have a nice Friday

Edited by IronWardog

Added Weapons Guidance.

This is very cool. Can I request adding Juke?