Frequently Asked Questions
This is a tool for calculating dice probabilities and outcomes for X-Wing Miniatures by Fantasy Flight Games. The goal of the tool is to aid players in list building, target selection and token spending by helping to develop intuition about the probabilities of various outcomes.
Computing simple dice probabilities by hand is straightforward, but more complex scenarios involving many tokens and multiple attacks (twin laser turret, gunner, etc) become tedious and error-prone even when using a spreadsheet.
Rather than rely on random simulation, this tool calculates probabilities directly via an exhaustive search of all possible outcomes. This runs extremely fast (a couple milliseconds for most realistic cases) and produces accurate and repeatable results.
Source code for the tool is available on Github under the MIT license. Please feel free to browse the code, fork and/or submit issues and pull requests!
Frequently Asked Questions
What's the difference between "Basic" and "Advanced"?
Both the basic and advanced forms use the same underlying simulation. The only difference is in how the simulation parameters are presented in the user interface.
The basic form uses card and ability names directly from the game, so it should be intuitive for most people. The attackers and defenders tokens and upgrade cards are grouped in two separate sections. While it's possible to test out illegal card combinations (the form does nothing to prevent this), you are generally limited to the effects present on the available cards. A few concessions are made for clarity; for instance, the type of attack (single, multiple) is set directly rather than implicitly via upgrade cards (gunner, etc).
The advanced form is a more direct interface to the parameters of the simulation. It can express a superset of the basic form, including a wide variety of options that are not currently possible in the game. Simulation parameters are organized according to where they occur in the timing chart. A few "special effects" still reference card names when it is more concise to do so versus spelling out the underlying effect.
What's the "Alpha" form for?
The "alpha strike" form also uses the same underlying simulation, but it is organized to model several different attackers all attacking the same defender in sequence. This is useful for determining the probability of a ship being destroyed by an alpha strike before getting to fire, among other things.
The options on the alpha form are somewhat more limited due to UI space/complexity considerations, but most of the common attacks can be modeled using a combination of the options in the dropdown menu together with the available tokens and effect toggles.
- How can I link or bookmark a specific result?
How can I see the numbers?
One a result is simulated, simply hover over (or tap) any bar in the charts to see the probabilities.
Alternatively, the "Advanced" and "Alpha" forms additionally output a data table which makes it easy to copy the results into an external spreadsheet or similar.
Which effects and triggers are active?
In general, any effect that you enable is considered to be "active". Any conditions outside of tokens (such as being in arc or at a given range) are assumed to be satisfied if you enable the effect.
Since tokens can change over the coarse of an attack (particularly in multi-attack situations), effects do respect conditions related to tokens. For instance, Expertise will only be active if the owner does not have any stress tokens, while Wired will be active if the owner has one or more stress tokens.
If a weapon or effect requires spending tokens to enable the attack (for instance, many munitions require the attacker to discard a target lock to fire) do not include those tokens in the simulation. The simulation effectively begins at the attacker's initial dice roll, so that is the point in which you should set the token state.
What strategies do the attacker and defender employ?
The attacker tries to maximize the number of hits/crits. It will opportunistically prefer crits, but will not greedily "crit chase" by trying to reroll hits into crits.
The defender tries to minimize or entirely avoid taking hits. In cases where there are token spending choices, the defender will prefer to keep tokens that are more useful on defense in case there is a second attack. For instance, if a defender can spend either a focus or evade to fully evade an attack, it will normally prefer to spend the focus and hang onto the evade unless the attacker has Juke, in which case it will hang on to the focus instead. While the "optimal" choice depends on additional factors (dice, mods and tokens available to each player), this heuristic works well for the typical situations encountered in X-Wing.
Do the attacker and defender play optimally?
The short answer: in most realistic cases, yes. The longer answer: it depends how you define "optimally".
In most common situations it is possible for the attacker to simultaneously optimize for many different metrics: the maximum expected hits, the minimum probability of missing, and so on. Similarly the defender can avoid or minimize expected damage while spending as few tokens as possible.
- Complex Reasonsing: It is possible to construct situations wherein theoretically "optimal" token spending is very complicated. Recall that the goal of the tool is primarily to give players intuition about various realistic outcomes. While a computer can easily compute all possible outcomes before making decisions, it is not reasonable for a human to efficiently search a possibility space consisting of hundreds or thousands of outcomes before making each decision. Thus for the sake of predictability the tool employs heuristics that are reasonable for a human to emulate.
- Risky Decisions: For instance, if Sunny Boundary with a target lock rolls hit/crit, rerolling the crit in an attempt to get a second hit and trigger her ability increases the likelihood of three hits, but also increases the likelihood of falling back to a single hit. In general players only take additional risks in exceptional circumstances, so the tool also favors safe decisions.
- Rerolling: The tool treats the ability to reroll dice in aggregate; for instance, one upgrade that allows rerolling two dice is treated identically to two separate upgrades each granting a single reroll. This is done primarily for user interface simplicity, but it also increases the efficiency of the computation. In most cases this makes no difference but there are edge cases in which it is slightly better to reroll one set of dice first, then depending on the results decide whether to reroll others.
- One Damage on Hit: Currently the attacker's logic is not fully optimal when using "one damage on hit" weapons with multiple attacks, such as twin laser turrets. This occurs in cases where no token spending is necessary because it would be impossible for the defender to evade. This logic will be improved in the future.
Can you add [some upgrade] to the simulator?
Anything can be added given the proper time and resources. Generally things that aren't yet implemented fall into a couple of categories.
- Things with too many UI complexities or too much context.
- Things with too many decisions, or where the optimal strategy would be highly non-obvious. Many of the "spend token to do something" cards fall into this category. Deciding between multiple ways to best spend a token in multi-attack situations can be quite complicated, and results from the tool generally need to be understood in the context of the strategy employed.
- Things with unclear rules interactions. This includes cases where card combinations aren't possible in X-Wing today (due to lacking specific upgrade slot combinations or faction limitations), or cases that are possible but rarely used and thus have never received needed clarification in the FAQ.
- Rarely used upgrades, particularly in combination with another one of the downsides.
If you want a specific upgrade prioritized, please feel free to upvote or file an issue on Github.
How does C-3P0 work?
If there are any hits or crits, the defender will "guess" with C-3P0 the number of evades indicated. As this is a once per turn ability, this can only happen once in multi-attack sequences.
No attempt is made to deduce optimal values to guess as that normally requires additional context from the game state. It's generally more useful to just try different guesses in various situations and observe the results.
How does Palpatine work?
If there are any dice rolled (on attack) or any hits or crits to cancel (on defense), Palpatine will be used. Palpatine happens right after dice are rolled, before the opponent modifies them. The die that is modified by Palpatine cannot be modified further as per the game rules.
Simple logic based on the passive mods available determines which die to change. No attempt is made to do complex reasoning about potential outcomes of rerolling dice, etc.
How does Crack Shot work?
The logic for the attacker is simple: if crack shot can be used to push extra damage through, it will always be used. If it's not necessary due to the defender having extra evades or effects like "One Damage on Hit", it will not. If Crack Shot is ever used, it will show up in the Expected Token Delta chart.
The presence of Crack Shot also changes defender token spending logic: the defender will attempt to have an extra evade result available, even if that means spending tokens to that end.
In the presence of "One Damage on Hit" the defender will usually not spend anything if it can't entirely avoid the attack. If Crack Shot is present, it will still spend tokens if it can match the uncancelled hits, since even if the attacker then uses Crack Shot to push the one damage through, that is a valuable outcome as it removes Crack Shot from any follow-up attacks.