Detection chances for Tactical/Strategic DE missions and Troop Columns

Share strategy and tips here.
Post Reply
Psieye
Posts: 829
Joined: Thu Apr 06, 2017 12:27 am

Detection chances for Tactical/Strategic DE missions and Troop Columns

Post by Psieye »

An extension to the discussion in this past thread. I'm using this script to generate these numbers. Graphs would be nice but I won't be making them myself (at least, not today).

EDIT: the numbers were based on a flawed formula. Corrected down below with new numbers in a more intuitive format.
Last edited by Psieye on Mon Aug 21, 2017 11:48 am, edited 1 time in total.
My three 8-man GOp squad Commander campaigns:
1st
2nd
3rd
faket15
Posts: 111
Joined: Fri Jun 30, 2017 6:41 pm

Re: Detection chances for Tactical/Strategic DE missions and Troop Columns

Post by faket15 »

You forgot to divide the chance in each roll by 4.
Psieye
Posts: 829
Joined: Thu Apr 06, 2017 12:27 am

Re: Detection chances for Tactical/Strategic DE missions and Troop Columns

Post by Psieye »

Just to confirm, you're saying my script should look like this for the return value of functionChance()?

Code: Select all

discoveryPctChancePerDayPerHundredMissionIncome/4 * surplusIntel/100
My three 8-man GOp squad Commander campaigns:
1st
2nd
3rd
faket15
Posts: 111
Joined: Fri Jun 30, 2017 6:41 pm

Re: Detection chances for Tactical/Strategic DE missions and Troop Columns

Post by faket15 »

Psieye wrote:Just to confirm, you're saying my script should look like this for the return value of functionChance()?

Code: Select all

discoveryPctChancePerDayPerHundredMissionIncome/4 * surplusIntel/100
Exactly. The game multiplies the chance by (number of hours between rolls)/24 and the number of hours between rolls is 6.
LordYanaek
Posts: 940
Joined: Mon Jan 23, 2017 1:34 pm

Re: Detection chances for Tactical/Strategic DE missions and Troop Columns

Post by LordYanaek »

Psieye wrote:An extension to the discussion in this past thread. I'm using this script to generate these numbers. Graphs would be nice but I won't be making them myself (at least, not today).
Psieye, just to be sure, your script returns a chance per "tick" like this :

Code: Select all

1 ticks -> 0% 
2 ticks -> 0% 
3 ticks -> 0% 
4 ticks -> 0% 
5 ticks -> 1.8750000000000044%
Is a tick 6 hours or a day? :arrow: EDIT : looks like it's 6 hours, just noticed the line below your script in the other thread.
It's interesting. I wish i could have a simple spreadsheet formula but it's probably not possible due to the loop in the function. Anyway i plan to run that script various activities once i have confirmation what a "tick" is. Thanks for this (works nicely in Firefox console BTW).
faket15 wrote: Exactly. The game multiplies the chance by (number of hours between rolls)/24 and the number of hours between rolls is 6.
facket, if i remember correctly, some time ago you corrected me about the amount of intel generated by a rebel each day. Can you remind me the exact amount of intel generated by a level 1 rebel. I think it will be easier to use for me if i re-write that formula to take a number of rebels as input rather than intelPerDay.
Psieye
Posts: 829
Joined: Thu Apr 06, 2017 12:27 am

Re: Detection chances for Tactical/Strategic DE missions and Troop Columns

Post by Psieye »

Yes, a tick is 6 hours. I've been meaning to re-visit this over the weekend but uh... things got interesting in my campaign. Let's see if I can rip myself away from LW2 to write this up better. Oh and if you want to put this into spreadsheets, I can update the script to spit out CSVs.
My three 8-man GOp squad Commander campaigns:
1st
2nd
3rd
LordYanaek
Posts: 940
Joined: Mon Jan 23, 2017 1:34 pm

Re: Detection chances for Tactical/Strategic DE missions and Troop Columns

Post by LordYanaek »

I don't think it will be required, i think finally managed to understand your script enough to dissect the functions and variables into spreadsheet columns which mean i'll be able to get all the output i want directly once i finish arranging a monstrous table :lol:

The script is probably cleaner but at least once i have it in a spreadsheet i can just change a few parameters such as number of rebels, avenger scan, presence of tower and such and get all the results updated immediately.

joinrbs actually already created a similar spreadsheet but it was for some specific missions only and i always wanted a more global version, looks like i finally found the formulas required thanks to your script.

Next step will be plotting this against number of days left to infiltrate :geek:
Psieye
Posts: 829
Joined: Thu Apr 06, 2017 12:27 am

Re: Detection chances for Tactical/Strategic DE missions and Troop Columns

Post by Psieye »

Script updated:

Code: Select all

function discoveryChance(intelPerDay, requiredRebelMissionIncome, discoveryPctChancePerDayPerHundredMissionIncome, ticks) {
    const currentIntel = ticks * intelPerDay / 4;
    const surplusIntel = currentIntel - requiredRebelMissionIncome;
   
    if (surplusIntel <= 0) {
        return 0;
    }
    
    return discoveryPctChancePerDayPerHundredMissionIncome/4 * surplusIntel/100;
}

function calculateCumulativeSuccessChance(intelPerDay, requiredRebelMissionIncome, discoveryPctChancePerDayPerHundredMissionIncome, ticks) {
    let cumulativeFailChance = 1;
    let ret = [];
    for (i = 1; i <= ticks; i++) {
        cumulativeFailChance *= (1 - discoveryChance(intelPerDay, requiredRebelMissionIncome, discoveryPctChancePerDayPerHundredMissionIncome, i)/100);
        cumulativeSuccessPct = (1-cumulativeFailChance)*100;
        
        ret.push(Math.round(cumulativeSuccessPct)+"%");
    }
    
    return ret;
}

function printResultsSet(requiredRebelMissionIncome, discoveryPctChancePerDayPerHundredMissionIncome, totalTicks, scientistAdvisor, radioTower) {
    for (j = 1; j <= 13; j++) {
        let intelPerDay = j * 5;
        if (scientistAdvisor) {
            intelPerDay *= 1.2;
        }
        
        if (radioTower) {
            intelPerDay *= 1.2;
        }
        
        resultsSet = calculateCumulativeSuccessChance(intelPerDay, requiredRebelMissionIncome, discoveryPctChancePerDayPerHundredMissionIncome, totalTicks);
        
        console.log(j + ", " + calculateCumulativeSuccessChance(intelPerDay, requiredRebelMissionIncome, discoveryPctChancePerDayPerHundredMissionIncome, totalTicks).join(", "));
    }
}

printResultsSet(100, 30, 40, true, true);
For each row in the output, the first number is "number of rebels on intel job". Then each subsequent item is the cumulative success chance after X ticks. Hmm... I could tinker this further as what we really want to know is "what should I put in to get X% chance of discovery by Y ticks?" But for now, I have a 7-man hack mission to play.
My three 8-man GOp squad Commander campaigns:
1st
2nd
3rd
LordYanaek
Posts: 940
Joined: Mon Jan 23, 2017 1:34 pm

Re: Detection chances for Tactical/Strategic DE missions and Troop Columns

Post by LordYanaek »

Finished my spreadsheet (i think the numbers should be correct). Still room for improvement and more parameters to consider.
Thanks for the script as it gave me the basis to build the spreadsheet :)
Psieye
Posts: 829
Joined: Thu Apr 06, 2017 12:27 am

Re: Detection chances for Tactical/Strategic DE missions and Troop Columns

Post by Psieye »

New script:

Code: Select all

function discoveryChance(intelPerDay, requiredRebelMissionIncome, discoveryPctChancePerDayPerHundredMissionIncome, ticks) {
    const currentIntel = ticks * intelPerDay / 4;
    const surplusIntel = currentIntel - requiredRebelMissionIncome;

    if (surplusIntel <= 0) {
        return 0;
    }

    return discoveryPctChancePerDayPerHundredMissionIncome/4 * surplusIntel/100;
}

function calculateTicksForSuccessThreshold(intelPerDay, requiredRebelMissionIncome, discoveryPctChancePerDayPerHundredMissionIncome, maxTicks, successThreshold) {
    let cumulativeFailChance = 1;

    for (let i = 1; i <= maxTicks; i++) {
        cumulativeFailChance *= (1 - discoveryChance(intelPerDay, requiredRebelMissionIncome, discoveryPctChancePerDayPerHundredMissionIncome, i) / 100);

        const cumulativeSuccessPct = Math.round((1-cumulativeFailChance)*100);

        if (cumulativeSuccessPct >= successThreshold) {
            return i;
        }
    }

    return -1;
}

function printRebelsToDetect(requiredRebelMissionIncome, discoveryPctChancePerDayPerHundredMissionIncome, scientistAdvisor, radioTower) {
    const maxTicks = 60;

    for (j = 1; j <= 13; j++) {
        let intelPerDay = j * 5;
        if (scientistAdvisor) {
            intelPerDay *= 1.2;
        }

        if (radioTower) {
            intelPerDay *= 1.2;
        }

        const requiredTicks_80 = calculateTicksForSuccessThreshold(intelPerDay, requiredRebelMissionIncome, discoveryPctChancePerDayPerHundredMissionIncome, maxTicks, 80);
        const requiredTicks_95 = calculateTicksForSuccessThreshold(intelPerDay, requiredRebelMissionIncome, discoveryPctChancePerDayPerHundredMissionIncome, maxTicks, 95);

        if (requiredTicks_80 != -1) {
            const extra = requiredTicks_95 == -1 ? "" : " " + requiredTicks_95/4 + " days to detect with at least 95% chance.";
            console.log(j + " rebels need " + requiredTicks_80/4 + " days to detect with at least 80% chance." + extra);
        }
    }
}

printRebelsToDetect(100, 30, false, true);
Some output from this, assuming Lv 1 rebels, no Faceless, radio tower and no scientist:

=== Normal UFO lead ===
Duration: 5-9 days

6 rebels need 8 days to detect with at least 80% chance. 9.75 days to detect with at least 95% chance.
7 rebels need 7.25 days to detect with at least 80% chance. 9 days to detect with at least 95% chance.
8 rebels need 6.75 days to detect with at least 80% chance. 8.25 days to detect with at least 95% chance.
9 rebels need 6.25 days to detect with at least 80% chance. 7.5 days to detect with at least 95% chance.
10 rebels need 5.75 days to detect with at least 80% chance. 7 days to detect with at least 95% chance.
11 rebels need 5.5 days to detect with at least 80% chance. 6.75 days to detect with at least 95% chance.
12 rebels need 5 days to detect with at least 80% chance. 6.25 days to detect with at least 95% chance.
13 rebels need 4.75 days to detect with at least 80% chance. 6 days to detect with at least 95% chance.

=== Super UFO lead ===
Duration: 5-9 days

5 rebels need 8 days to detect with at least 80% chance. 10 days to detect with at least 95% chance.
6 rebels need 7.25 days to detect with at least 80% chance. 8.75 days to detect with at least 95% chance.
7 rebels need 6.5 days to detect with at least 80% chance. 8 days to detect with at least 95% chance.
8 rebels need 6 days to detect with at least 80% chance. 7.5 days to detect with at least 95% chance.
9 rebels need 5.5 days to detect with at least 80% chance. 6.75 days to detect with at least 95% chance.
10 rebels need 5.25 days to detect with at least 80% chance. 6.5 days to detect with at least 95% chance.
11 rebels need 4.75 days to detect with at least 80% chance. 6 days to detect with at least 95% chance.
12 rebels need 4.5 days to detect with at least 80% chance. 5.75 days to detect with at least 95% chance.
13 rebels need 4.25 days to detect with at least 80% chance. 5.5 days to detect with at least 95% chance.

=== Find Facility lead ===
Duration: 9-12 days

5 rebels need 11.75 days to detect with at least 80% chance. 14.5 days to detect with at least 95% chance.
6 rebels need 10.5 days to detect with at least 80% chance. 12.75 days to detect with at least 95% chance.
7 rebels need 9.5 days to detect with at least 80% chance. 11.75 days to detect with at least 95% chance.
8 rebels need 8.5 days to detect with at least 80% chance. 10.75 days to detect with at least 95% chance.
9 rebels need 8 days to detect with at least 80% chance. 10 days to detect with at least 95% chance.
10 rebels need 7.5 days to detect with at least 80% chance. 9.25 days to detect with at least 95% chance.
11 rebels need 7 days to detect with at least 80% chance. 8.75 days to detect with at least 95% chance.
12 rebels need 6.5 days to detect with at least 80% chance. 8.25 days to detect with at least 95% chance.
13 rebels need 6.25 days to detect with at least 80% chance. 8 days to detect with at least 95% chance.

=== Smash & Grab ===
Duration: 9-13 days

3 rebels need 10.25 days to detect with at least 80% chance. 12 days to detect with at least 95% chance.
4 rebels need 8.25 days to detect with at least 80% chance. 9.75 days to detect with at least 95% chance.
5 rebels need 7 days to detect with at least 80% chance. 8.5 days to detect with at least 95% chance.
6 rebels need 6.25 days to detect with at least 80% chance. 7.5 days to detect with at least 95% chance.
7 rebels need 5.5 days to detect with at least 80% chance. 6.75 days to detect with at least 95% chance.
8 rebels need 5 days to detect with at least 80% chance. 6 days to detect with at least 95% chance.
9 rebels need 4.75 days to detect with at least 80% chance. 5.75 days to detect with at least 95% chance.
10 rebels need 4.25 days to detect with at least 80% chance. 5.25 days to detect with at least 95% chance.
11 rebels need 4 days to detect with at least 80% chance. 5 days to detect with at least 95% chance.
12 rebels need 3.75 days to detect with at least 80% chance. 4.75 days to detect with at least 95% chance.
13 rebels need 3.5 days to detect with at least 80% chance. 4.5 days to detect with at least 95% chance.

=== Troop Column ===
Duration: 9-12 days
NB: ignores the bonus detect chance from Str that Troop Columns have.

3 rebels need 9.5 days to detect with at least 80% chance. 12.75 days to detect with at least 95% chance.
4 rebels need 8.25 days to detect with at least 80% chance. 11 days to detect with at least 95% chance.
5 rebels need 7.25 days to detect with at least 80% chance. 9.75 days to detect with at least 95% chance.
6 rebels need 6.75 days to detect with at least 80% chance. 8.75 days to detect with at least 95% chance.
7 rebels need 6.25 days to detect with at least 80% chance. 8.25 days to detect with at least 95% chance.
8 rebels need 5.75 days to detect with at least 80% chance. 7.75 days to detect with at least 95% chance.
9 rebels need 5.5 days to detect with at least 80% chance. 7.25 days to detect with at least 95% chance.
10 rebels need 5 days to detect with at least 80% chance. 6.75 days to detect with at least 95% chance.
11 rebels need 4.75 days to detect with at least 80% chance. 6.5 days to detect with at least 95% chance.
12 rebels need 4.75 days to detect with at least 80% chance. 6.25 days to detect with at least 95% chance.
13 rebels need 4.5 days to detect with at least 80% chance. 6 days to detect with at least 95% chance.

=== Tactical DE ===
Duration: ??? (at least 10 days minimum for all but Conditioning)

8 rebels need 11.5 days to detect with at least 80% chance. 15 days to detect with at least 95% chance.
9 rebels need 10.75 days to detect with at least 80% chance. 14 days to detect with at least 95% chance.
10 rebels need 10.25 days to detect with at least 80% chance. 13 days to detect with at least 95% chance.
11 rebels need 9.5 days to detect with at least 80% chance. 12.5 days to detect with at least 95% chance.
12 rebels need 9 days to detect with at least 80% chance. 11.75 days to detect with at least 95% chance.
13 rebels need 8.75 days to detect with at least 80% chance. 11.25 days to detect with at least 95% chance.

=== Strategic DE ===
Duration: ??? (at least 10 days minimum for all but Air Patrols)

6 rebels need 10.5 days to detect with at least 80% chance. 13.75 days to detect with at least 95% chance.
7 rebels need 9.75 days to detect with at least 80% chance. 12.5 days to detect with at least 95% chance.
8 rebels need 9 days to detect with at least 80% chance. 11.5 days to detect with at least 95% chance.
9 rebels need 8.5 days to detect with at least 80% chance. 10.75 days to detect with at least 95% chance.
10 rebels need 8 days to detect with at least 80% chance. 10.25 days to detect with at least 95% chance.
11 rebels need 7.5 days to detect with at least 80% chance. 9.75 days to detect with at least 95% chance.
12 rebels need 7 days to detect with at least 80% chance. 9.25 days to detect with at least 95% chance.
13 rebels need 6.75 days to detect with at least 80% chance. 8.75 days to detect with at least 95% chance.
My three 8-man GOp squad Commander campaigns:
1st
2nd
3rd
Post Reply