User:PSGarak/Sandbox/Warplan

From Fallen London Wiki

This calculator will guide you through a Campaign of Parabolan Warfare by deciding the correct options to play at each Stage and values of Advance! and Campaign Morale, based on your character's stats and your own valuation of the different items that might be consumed.

By using this calculator, you are making the decision that you would rather let a spreadsheet play the game for you. You should only use this tool if you already find grinds to be joyless, or a higher EPA is better motivation than gameplay.

Using this Calculator[edit]

The first set of inputs is straightforward. The choice of campaign only affects the number of actions spent on narrative after each stage.

The second set of inputs is the relative Action costs for the various items that can be spent (or gained) via the various actions on the campaign trial. This calculator works by converting all resources into an "action cost" equivalent, so items are valued based on the number of actions to replenish those spent. Ravages of Parabolan Warfare are valued based on the actions to clear them after the campaign. The default values assume all resources can be obtained at 2.5 EPA, and that Ravages take 1 action to clear.

The results of the calculator will show tables of the expected actions to complete the Parabolan Campaign from any given point, as well as the optimal choice at that particular point. If Airs-dependent actions are worth playing, then the tables will list the best non-Airs choice, as well as all Airs-dependent choices that should be played if available.

Note that in some cases, more than one choice might be optimal. The calculator will select only one as optimal, with the choice depending on implementation details.

Get My Personalized Battle-Plan[edit]

 template = User:PSGarak/Sandbox/Parabolan War
 form = parameters
 result = warplan
 param = Watchful|Watchful|300|int|0-400
 param = Shadowy|Shadowy|300|int|0-400
 param = Dangerous|Dangerous|300|int|0-400
 param = Persuasive|Persuasive|300|int|0-400
 param = Campaign|Campaign|Yourself|select|The Cats,The Fingerkings,The Chessboard,Yourself
 param = General|Chosen General|None|select|None,Cat,Snake,Chess
 param = null|Item Costs, in Actions to Acquire:||fixed
 param = Cost_Ravage|Curing Ravages of Parabolan Warfare|1|number|0-10
 param = Cost_Psalm|Apostate's Pslam|1|number|0-10
 param = Cost_Sign|London Street Sign|1|number|0-10
 param = Cost_Self|Memory of a Much Lesser Self|1|number|0-10
 param = Cost_Glass|Glass Gazette|1|number|0-10
 param = Cost_Wing|Wing of a Young Terror Bird|1|number|0-10
 param = Cost_Plaque|Correspondence Plaque|0.2|number|0-10
 param = Cost_Light|Memory of Light|0.2|number|0-10
 param = Cost_Solacefruit|Solacefruit|0.2|number|0-10
 param = Cost_Viric|Trace of Viric|0.2|number|0-10
 param = Cost_Feather|Royal-Blue Feather|0.2|number|0-10
 param = Cost_Claw|Silvered Cat's Claw|0.04|number|0-10
Fingerkings loading...
 

How it Works[edit]

This calculator is based on a classical optimization technique called Dynamic Programming. (Despite the similar name, this bears no relation to "dynamic programming languages" like JavaScript or Lua.) The core concept is that results are computed starting from the end of the campaign working backwards rather than from the beginning, calculating actions-to-goal rather than actions-spent. When considering the options available at any particular state, the outcomes of those options will have already been computed, so the arithmetic to choose which is best because very simple.

As an example, consider the table below, showing results for the Writhing River, calculated with default values. Results in the table are computed from the bottom up, and from left to right. When calculating the results for the cell highlighted in purple ( 0 x Advance! & 5 x Campaign Morale), the other highlighted cells indicate the outcome of all the possible actions that might be taken in the Writhing River. The total Actions-to-Complete from those points in the Campaign have already been calculated. We can then compute the expected Actions-to-Complete for each of the available options, taking into account its outcomes, success probability, and resource cost. The option with the lowest expected Actions-to-Complete is recommended as the best option, and its Actions-to-Complete is stored as the value for the current cell.

Dynamic programming example.png

Calculations[edit]

Some actions (like most Safe Progress options) always produce the same amount of Advance! on success or failure, but have different resource costs. For a given Advance! a and Morale m, the Actions-to-Goal value A(a, m) can be computed as

where p is the probability of success, and cs and cf are the resource costs of success and failure. The constant 1 is the action spent on playing the option. The value a + 1 assumes the Safe Progress increases Advance! by 1, and would be replaced by other values as necessary.

Spending Morale is a slightly different situation, where success & failure both always spend Morale but one only gives Advance!. For this situation, the formula is modified slightly. Note that no Morale options cost resources, so the c terms are ignored.

Most other options work slightly differently, where costs are accrued on failure but neither Advance! nor Morale is modified. In these cases, the formula can be derived by observing that with a success probability p, one success will require 1/p attempts and incur (1-1/p) failures.

As before, the a + 3 term is an example for early-stage Fast Progress options, but other options modify Advance! and Morale in different ways.

Airs[edit]

The impact of Airs-dependent options are tricky to account for. They cannot always be attempted, which is straightforward to accommodate. The more difficult issue is that on failure, sometimes the option can be re-attempted and sometimes it cannot.

The Actions-to-complete value for an Airs option Aa(a, m) depends in part on the value for the best deterministic option available, Ad(a, m). With a success probability p, and assuming Airs options are available exactly 1/3 of the time, the value Aa(a, m) can be calculated as:

This equation definesAa in terms of itself, which represents re-attempting on failure. The fact that the option is not always available to play then also encapsulates the fact that it is not always avaialble to re-attempt. Solving this recurrence relationship for a closed-form value of Aa yields the following:

To decide whether the Airs value should be taken or not, we find when , i.e. when . Airs values should be played when the following is true:

In other words, the fraction on the right describes how much better the success result of the Airs option needs to be compared to the best deterministic option in order to be worth playing.