CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.31k stars 4.13k forks source link

Re: #48673 Nearly impossible to craft when missing proficiencies #48925

Closed deadcutlass2 closed 3 years ago

deadcutlass2 commented 3 years ago

Describe the bug

48673 related. Crafting success rates while missing a proficiency do not line up to the numbers listed.

Steps To Reproduce

  1. Create a character with 11 intelligence and a 4 in a skill.

  2. Attempt a level 4 craft with a 2x failure multiplier. (A 71% success rate without the failure multiplier.)

  3. Observe your failure rate is 99.98%

Expected behavior

A relative failure rate change.

Additional context

Adding this issue because it still seems to need to be addressed. I've created a google sheet to demonstrate the success/failure chances for a variety of variables, as well as listing possible expected chances based on interpretations.

Link: https://docs.google.com/spreadsheets/d/1IZagItfgAKeAcsCKjQ1ugvzIizY8S6aA85zbLOAhhQM/edit?usp=sharing

actual-nh commented 3 years ago

Ping: @eltank, @pehamm?

pehamm commented 3 years ago

I just saw that @I-am-Erk is working on a major rewrite of the failure code in #46153, so it is on the devs radar. That is almost certainly the best way to tackle this issue once Erk has more time for the project.

ghost commented 3 years ago

Isn't the so-called success rate (or rather a failure multiplier) just to pass 1 check and not to complete the item, like how you repair gear you have to pass a series of multiple checks with a chance to do nothing, damage the item, destroy it, or repair it.

For crafting there are multiple checks to see if you make progress, make no progress, lose progress, or have the item be destroyed (checked at 100% base duration to craft( ?) in which case things that affect your crafting speed like workbenches and NPCs helping out will improve your success of finishing the items by reducing the potential amount of checks).

Some items are impossible to craft when you factor in the failure rate multiplier and crafting time multiplier (which potentially increases the number of checks you have to go through or increases the amount of time it takes before the check occurs). Each time you make progress is when you succeeded in a check.

msg

Note the amount of time it takes to craft the item will affect the failure rate, "1x more likely to incur fail" (it means 2x failure since "more likely" means add to base rate). Even when missing the proficiency itself doesn't include a failure multiplier, the failure rate is increased and is likely multiplied by other failure multipliers. It could be that it checks for success at every 1x base crafting time and at the end of the item's completion, this could make it worse once you factor in failure multipliers as crafting time will multiply your chances of failing by increasing the number of checks you have to pass.

This could balloon up to absurd numbers that may not be intended.

cg hc

Not sure about your spreadsheet because your "x2 failure multiplier" should mean "x1 more likely to incur failure". "x2 more likely to incur failure" could mean passing through a check twice or double the failure percentage (doubling means x2 failure rate), both mean different things. Having higher skill levels than the crafting requirements also give bonuses to success rate among other things.

The way it looks like it's being calculated in-game to finish an item successfully is a probability of a probability of a probability, of .... you get the picture. I have no clue why they decided to make the proficiency multipliers multiplicative on each other instead of additive either unless they wanted the difficulty to explode with missing proficiencies.

I agree that skill checks are needless complicated and reading what the recipe/estimate says might not really reflect the real probability of crafting the item successfully. I'm even unsure if the crafting recipe shows the right information, you would have to pick apart the code to see what really happens.

actual-nh commented 3 years ago

For crafting there are multiple checks to see if you make progress, make no progress, lose progress, or have the item be destroyed (checked at 100% base duration to craft( ?) in which case things that affect your crafting speed like workbenches and NPCs helping out will improve your success of finishing the items by reducing the potential amount of checks).

If so, is this an unintended interaction? @kevingranade?

pehamm commented 3 years ago

@Evrze I am pretty sure that is not how the code works. The code rolls the point where the next failure will happen up front based on the code in crafting.cpp, incorporating skill, intelligence, recipe difficulty and proficiencies. This can either be after 100% completion (in which case the craft will not fail) or before. Then for each turn crafting, the game merely checks whether the failure point has been reached, and awards experience, proficiency progress, weariness and so on. Once that point is reached, a failure is triggered, can incorporate component destruction and progress loss. After this, a new failure point is set, which again may be after 100% completion or before. That is my understanding on what goes on in crafting.cpp and activity_actor.cpp, at least.

ghost commented 3 years ago

Yeah, by checks I did not mean just rolls, I meant requirements in general that includes things like thresholds and preconditions. Things like batch crafting and crafting a singular item will produce different results in the way you interpret it as well.

I know you can lose progress before 100% completion, this is because your 100% completion will be modified by a time and failure multiplier and you can lose progress midway, especially in bad crafting situations like crafting on the ground that gives a .7 modifier. That why I assumed the base checks (1x check) were scaled by 100% base crafting speed (or 1) and 100% base crafting duration (without the time multipliers) and a crafting session can at 100% item completion include multiple of these checks or less if you have things that can vastly improve these threshold points. You can reach the failure point threshold if you crafting on the ground with crafting for instance because it slows down your crafting speed or passes a check because you created the item fast enough that the failure threshold has not been reached.

This means you can have that completion threshold before or after, this can easily be seen in batch crafting (whose checks I assume are scaled per 1x base crafted item time rather than the entire batch than crafting a singular item).

I did say that the recipe numbers are misleading if you interpret it as a word problem, the code might not reflect the number that it pulls (even if it does essentially the same thing), it becomes even more increasingly complicated when you add the mitigation from the proficiency awarded midway and the penalties from weariness, and such, naturally these numbers will fluctuate during a long crafting session, you might be in pain (your pain is decreasing) from something and it influences your intelligence, affecting your crafting modifiers, etc.

EDIT: After looking through the files it looks like NPCs reduces the base crafting speed rather than increase crafting speed like workbenches which provide for a different effect that likely preserves the success rate but cuts down time, they also add a bonus to success rolls at a value of half a skill level.

I think it's also of some confusion to players whether " 'x times' more likely to incur failure" meant to multiply the failure rate by x, add x to base, it has to pass through twice as many checks for failure or success, or something else entirely.

TheLyca0n commented 3 years ago

This actually makes the wilderness survival challenge impossible over the chopper failing 50+ times (I don't honestly know I got sick of hunting for flint), you'll likely die of hypothermia or thirst/unclean water without being able to craft stone tools.

Not sure how many other items/proficiencies this impacts but its extremely frustrating none the less and can turn a easy craft like a clay pot into a two week grind for the proficiency

deadcutlass2 commented 3 years ago

AFAIK, it does a single skill roll divided by a difficulty roll per attempt, then divide that by the product of all the proficiency failure multipliers and if this value is less than 1, it puts a fail at some point in the remainder of the craft. Pehamm opened #48924 stating how this effect caused failures to unusually end up at the end of a crafting recipe, especially if you fail multiple times in a row. With my understanding, changing the crafting speed would not affect the instances of whether the recipe would fail or not.

Since I-Am-Erk already had this on his radar. I think it would be best to just put a bandaid fix on this for now so that it's better than "technically playable". #48924 looks like it could possibly do this, since it would change the pass/fail system of current to a a system where it slaps a fail a few percentage points down the road, meaning you should be able to eventually craft the item, and the higher the fail multiplier, the more fails you'd have until you craft it, by a factor of the fail multiplier.

ghost commented 3 years ago

I think the numbers do line up but it goes against player expectations so it doesn't make sense for them to fail so many times, especially with hidden mechanics and numbers that will affect their success rates. Naturally, all calculated expected results from players will be off since the player won't know what to do with the numbers to get anything useful other than speculating about it. The recipe will give you estimations but will not factor in various things and calculates its own base amounts, if you have a speed penalty or speed buff it will not reflect any of it in the numbers but the duration it takes to craft will be affected. This is probably because the time estimate is linked to a base amount of moves (100) rather than scaling to player speed.

In the early game, especially with you don't have the available stats, skills, and probably suffer from multiple crafting modifier penalties to further add to the problem.

The modifiers are probably multiplicative to make early, less demanding work easier but will make the higher tier recipes with 3+ proficiencies missing extremely difficult to finish.

After looking into it again from a player perspective, it makes more sense if you switch how you think:

2bs

The default value for failure is 1x (due to the fact that the failure multipliers are multiplicative across all proficiencies and will be added to your base failure) if not specified to be overridden by a failure multiplier and is used to be multiplied to other failure multipliers to end with a total amount.

Since the crafting time is longer than normal, you are more likely to reach several failure threshold points between starting and completing the item which could be seen as additional checks and rolls for how much you lose component and progress wise. That is base on the assumption that the crafting speed multiplier is a multiplier for gaining progress in 'x' amount of time.

If you have a 1.5x speed crafting multiplier and a 1.5x time penalty, they should cancel each other out to be 1x by divisibility (1.5x/1.5x=1x). Although it will not modify your failure multiplier, you may see an increase in an ability to finish a craft from finishing the item faster before various failure point thresholds (if the thresholds have any time dependency which may not be the case), leading to a lower amount triggered failures because the item is already completed, the rest of the failures thresholds don't matter, if you were to continue crafting, you would continue failing and seeing more failures if you stop the craft and lower your crafting speed modifier.

If it doesn't then at least it's a huge time sink, if the crafting time after proficiencies are missing is x4 crafting time multiplier and you have a .5x total crafting speed (crafting on the ground and stacking other penalties) then it takes x8 time then normal to finish it.

The crafting system was once overhauled from an absolute system since I played and several changes have been made that made the calculations more realistic but complicated at the same time, and calculations while crafting are in progress. Several PRs are torn between making it more realistic and simplifying it.

deadcutlass2 commented 3 years ago

failures are not added to base failure, it is divided from your skill roll. If a missing proficiency says 1.0x more likely to incur failures, it does not change anything. Fail thresholds are based on percent completeness of recipe, not time spent crafting.

ghost commented 3 years ago

1.0x more likely to incur failure is the wrong wording for it the grammatically if you want to imply a failure rate base 1.

It should be "0x more likely to incur failure" or "1x as likely to incur failure" (which is effectively saying nothing at all).

Since more implies an increase, when "more than" is used in math it means add to base, "more likely" would mean add to base likeliness ("likely" implies probability).

Naturally, this could just be a grammatical mistake and lead to a misinterpretation of what it does, as the code does not have to reflect what the recipe says.

But I've also seen: 20lnx7y68od61

This seems nonsensical unless they both add to base, even the time should perhaps be interpreted as such, " 'x times' as long as normal" would mean take the base value 1 and add the modified amount. Or there is some weird formula in the code to it all and you shouldn't even interpret it as add to base.

Also, It does look like failures aren't considering crafting speed after testing with 1000x crafting speed modifiers like you said.

ghost commented 3 years ago

I'm not sure if the difficulty was intended or not for crafting, but it looks pretty normal if you go by add to base convention and then factor in the chance of item destruction and loss of progress, the only thing I would consider would be tuning down the numbers.

Doing the math it looks consistent under the add to base convention.

x2 more likely to incur failures and it means to multiply the failure rate (or multiplier) of 3, or 300% failure rate.

Since you're 3 times as likely to incur failure, it means you have 3 times more successes to pass if you want to preserve the same base success rate.

3/.71=4.22 and consider it an average amount of success checks that must be passed before item completion. Obviously, you can't have .22 of a check though.

This means you have to go through the equivalence of at least 4 continuous successes in order to craft with no failures.

If the success rate is 71% the failure rate is 29% With a failure multiplier of 3 you get: 3(.29)=87% chance to fail This is a 13% success chance after being modified by the multiplier In order to have 4 successful checks in a row with no failures it's (.13)^4=0.00028561 If its 4.22 then (.13)^4.22= 0.000182322785 They're both roughly .02% success chance or 99.98% chance to fail. Of course, this probably isn't what actually happens, but it works out to be around the same.

deadcutlass2 commented 3 years ago

What I'm talking about is the math of how it works, based on lines 948-1053 of crafting.cpp. While your example there comes up with a similar number that I did, it is not what's in the code.

It rolls two sets of dice, one for skill (skill*4)d(16+int), and one for difficulty, (req*4)d24.

It then divides these two rolls to get a ratio.

It then divides this ratio by the failure multiplier, which is the product of all the failure multipliers listed in crafting.

This number is then used as a percentage, then multiplied by the percent remaining in a craft. This number is then added to the current progress percent as the failure threshold. When the crafting percentage hits the failure threshold, the recipe stops, possibly loses progress or components, and allows you to try again.

If the number from the skill roll divided by the difficulty roll is greater than 1, the failure point is put over 100% completion, so the recipe completes without incident.

The success chance is based on some formulas from @pehamm from the PR listed at the top and represent the chance that skill roll will be greater than difficulty roll, thus being a success. In my math, the difficulty roll is multiplied by the proficiency failure rate when factoring for the failure rate without proficiency, as it is the divisor of the division with a fraction.

as well, whatever times more likely to incur failures very specifically is a multiplication, not an addition. 1*4=4, it's the identity property of multiplication. Your katana example looks bugged.

ghost commented 3 years ago

If you add a number to rate or multiplier, it will come out to be a multiplication to other numbers that it modifies because you add to a multiplier, and an exponent is a form of multiplication in itself. The only addition in place is the addition to base amounts which acts as multipliers.

In magiclysm the staff of lesser magi has a mana regeneration modifier of .5 to increase the mana regeneration to 1.5, 1 is the base (100%) and you want 50% more mana regeneration so you add .5 to it. This is because there are other mana multipliers and you want to stack additively not multiplicatively.

The failure rates and duration increase stack multiplicatively across each but will ADD to base (1, to represent 100% of something but this value could be less to represent less than 100% base value) rather than multiplying it from my understanding but it could be slightly different.

The katana shows .1x more likely to incur failure (its rounded) after being multiplied failure rate because its (1.12*1) failure chance, which is also 1+.12. 1 would represent your base rate of x1 failure, you and .12x to it and it works out. This is the same with the time multiplier.

If I gave you 10% (or .1 base value) more money than what you have it doesn't mean I'm taking away 90% of your money, it means 10% of your money gets added on. If you're 10% more likely to succeed it means your success rate is increased, not lowered. This is like how you can treat a base value of 1 as 100% of something.

This was my interpretation of x2 more likely to incur failure: It will require you to do more work (you can consider it a reduction of your efficiency, as a multiplier for the average amount of fail point threshold you encounter or an increase in the amount of work) and will increase your failure chance.

Note: There are always different methods of solving in math that will give the same results.

Let's say you have to do the equivalence of 300% degrees of completion or progress (or you can treat it as completing 100% completion of a new task and modify it) to finish an item (because it in order to finish the item at 71% efficiency, then you take 3/.71=4.22 to find the ratio you need to be a multiplier for your efficiency in order to complete the task given to you. This should be the average amount of thresholds that must be passed with no incidents.

You can treat this as 1/4.22=.237 or 23.7% as your new work efficiency for the harder task, and will still mean there will be 4.22 average of 4.22 thresholds that could be passed since each threshold should be seen at around 23.7% progress of the new item that you're crafting.

Your efficiency is fine but your workload is increased, or you can consider it a reduction to efficiency because multiplication is communitive either can be considered true to that specified instance.

Then there is the failure rate multiplier that will additionally reduce your chances of successfully crafting.

If 29% is treated as a base failure chance (which could be the wrong number, the base failure rate could just be fixed at 25% to 35% and 29% is your modified failure rate from the base, this would require a new calculation).

Naturally, I did not account for the loss of progress or item destruction, since I did not know the rates, but if they are only triggered on failures, and you need consecutive successes of not trigger the threshold (which means you don't pass the failure point threshold per check due to rolling a high number for that threshold) in order to not trigger the failure, calculating outcomes for failure is much more difficult especially without knowing the rates.

"If the number from the skill roll divided by the difficulty roll is greater than 1, the failure point is put over 100% completion, so the recipe completes without incident."

Yeah, the ratio is a value of difficulty. You can have 200% efficiency or success chance (treat this as part of your skill roll), but only need to do 100% degree degrees of work/item completion at base difficulty. It naturally a ratio greater than 1 (or 100%), or over a 100% modified success chance or efficiency to complete the given task after calculating difficulty. Naturally, the failure threshold point can be set to 200% item completion.

Even if this is true, without the proficiencies there can be enough difficulty multipliers to make a threshold value of 200% item completion turn into an effective success of less than 100%.

I'm sure we're both doing the math wrong in our own way based on our own interpretations.

actual-nh commented 3 years ago

If it's adding to a multiplier, then instead of "#x times as long as normal", it should be "#x times longer than normal" or equivalent.

ghost commented 3 years ago

I agree, it makes no sense grammatically, especially after getting all the proficiencies the katana duration to craft is decreased.

actual-nh commented 3 years ago

In #46082, I believe @anothersimulacrum was partially working on the grammatical issue. (I am losing track of whether there is indeed an interaction happening between eventual success likelihood and modifiers to how much time is needed.)

ghost commented 3 years ago

I probably should clarify on math if want to try it out for yourself:

First, you need to consider the base failure and success chance of the craft, to do this you need to fulfill all the requirements but not more or less (you can treat this as base 1 of all values tied to this). No modifiers that increase your crafting or going over the requirements

Let's say it's 75% success rate; base 1 of success rate would be 75% (or .75) Let's say it's 25% failure rate; base 1 of failure rate is 25% (or .25)

Now let's say it's going to incur a penalty at x2 times more than the base to failure. base (2) =.50 base (1 + 2) = base (3) 3 (base failure rate) = 3 (25%) =75% This means you're 3 times as likely to incur failure.

Your success rate is now (1-.75)= 25% or seen as penalizing success as (.75-.50)=25%

Let us say you have now some modifiers that increase your base success rate by 8%.

1.08 (75%)=81% (.81-50)=31% Your new success rate is 31% to pass a failure point threshold without triggering failure.

The amount of failure point thresholds you encounter at base 1 of everything is on average is 1/.75= 1.333 to complete an item. It is 2 times more likely to incur failure which increases the number of failure thresholds you encounter, this means add 2 to base 1. threshold base (1+2)= 3(1.333)=4

(If the failure modifier was x50 then it would be (1+50)=51(1.333)=67.98 as the number of threshold points that are split into the craft)

To find the chance of crafting successfully in this state without incident: (new success rate of passing a failure point threshold without triggering) to the power of (number of thresholds that can occur on average in completing the item)

(.31)^4 = .0092 or .9%

To craft without failure is still extremely unlikely but there are only 4 threshold checks on average so you won't since too many mats even if you fail, lose progress, or destroy the item.

You get the idea, you treat everything as base values and multipliers that will affect the base amount and they will improve be reduced. You can throw in all the modifiers that influence failure and success and you can calculate your overall success rate for consecutive success and such.

The issue is with failure effects being more complicated to calculate since there are multiple outcomes to that but it is possible to list them all in a table if you know the probability of each case and how it affects progress and how often it destroys the item.

If the modified failure rate is massive, you just have to eat the failure messages and accept feeding the mats into it or grind the proficiency before attempting since the multipliers can get extremely high that you just can't compensate for it and have to accept losing progress or item destruction every time you go past the failure thresholds.

The thing about crafting is that if you are able to complete all the failure point threshold without the item being destroyed you can still successfully craft it because you're still making progress towards the item completion. This is a failure condition calculation that will be based on threshold numbers that must be passed, degree of progress lost, and item destruction among other things.

Note: in this example, you can have a final success rate higher than 100% to push the threshold higher and easily craft without incident, you can also have a magnitude of failure rate higher than 100% with its own implications, it is the same as the "more likely to incur failure message" you see on the crafting recipe when missing proficiencies, I can sort of see why this method was implemented.

In general, it's not good to think about success rates with this proficiency system but think in orders of magnitude doing a task better or worse than normal.

deadcutlass2 commented 3 years ago

Again, that's literally not how it works.

ghost commented 3 years ago

I'm pretty sure it's because the game just shows the wrong info in the recipe and the recipe doesn't show anything useful.

My base interpretation is wrong because I'm expecting the base state to be the "normal state" with all the relevant proficiencies and don't know how it's modified and the "normal state" is different from my example which leads to different numbers you have to add.

kat1 kat2

Here the time multipliers look normal for the katana and it isn't adding to base, it's just a multiple. When it's being mitigated it seems like the display can show misleading info and the "x0 as long as normal point" is shown even when it doesn't even reduce the duration.

It's literally the same time as having your proficiencies missing (at least on the display).

20lnx7y68od61

I think the math, in general, is just not going to line up with what's displayed so it's just going to be nonsense because what displayed is nonsense and inaccurate.

You can only expect the code to line up with what the code is doing.

actual-nh commented 3 years ago

Again, that's literally not how it works.

Are you going off of the display and recipes, or off of the code? If off of the code, then there appear to be differing interpretations of it.

ghost commented 3 years ago

I'm going off your numbers and looking a bit at the code, what you consider a "success" is what I consider a "consecutive success" of not triggering a failure.

You would use the base rate scale to a specific recipe because each recipe has its own difficulty, which should be as effective as incorporating the difficulty rolls, and each recipe has its own numbers, threshold multipliers, efficiency, etc.

This is the only way I can see if you want to see the math line up with the code, which is what I assumed you were trying to do, to me it looks reasonable.

You're probably looking at it wrong, it's just an x2 failure multiplier or x3 failure multiplier if you want to see the math lineup, you have to incorporate other factors.

Honestly, you can have a failure scaling with a "negative success" and still complete a craft, you just treat them as failure factors and calculate the average number of thresholds you have to go through from the base value of succeeding normally from the recipe.

For example: if you have a 2% success chance having no proficiencies, and a 98% failure rate you do not use the "x18.8 more likely to incur failure" on the 98% but on the base failure rate of that specific recipe. To me, it makes sense and seems to line up.

deadcutlass2 commented 3 years ago

I'm going off the code, specifically lines 948-1053 of crafting.cpp

If the roll of crafting_success_roll is over 1, set_next_failure_point places the failure point at above 100% completion, thus the recipe succeeds entirely.

If that same roll is less than 1, set_next_failure_point places the failure point at whatever your roll was percentage in the remaining portion of the recipe.

So if you start crafting a 50% completed item, and you roll a 0.6, you will have a failure at 80% completion. 60% of the way through the remaining 50%. If you roll a 1.2, you will have a failure at 110% recipe completion, since this is after 100%, you will succeed on the craft.

This means the probability of success for a craft is the probability that crafting_success_roll outputs a number greater than 1.

crafting_success_roll has 3 notable parts in it, skill_roll, diff_roll, and prof_multiplier.

skill_roll is 4*skill level dice, with 16+intelligence sides, adjusted for a few factors, such as mutations diff_roll is 4*recipe level dice, with 24 sides prof_multiplier is the product of multiplying all the failure rates for that recipes proficiencies.

line 1030, the target of #48673, it has the output of the crafting_success_roll as ( skill_roll / diff_roll ) / prof_multipler

As @pehamm explained in the original PR, the chance that skill_roll/diff_roll is greater than 1 can be expressed through some math that he posted there. These formulass are what I used to make the google sheet.

eltank commented 3 years ago

@Evrze Please check out issue #46662 as well. If you have certain books nearby when you're crafting the predicted failure text will be wrong. You can tell it's happening if you see "(Mitigated)". #48658 should fix that, but it hasn't been reviewed. Try again with no books nearby and see if it makes more sense.

ghost commented 3 years ago

Yeah, and you have to calculate consecutive successes afterward.

Because the degree of difficulty crafting 1 item until completion is increased by a multiplier. This base success rate is the success rate to generate a failure point above 100% completion.

You can simulate the degree of difficulty is increased by using base values as well. Your base difficulty is 1 recipe if everything else is treated as base 1 and you have all the requirements. Then you can scale up the base values by 2, 3 or whatever you like to simulate "x more likely to incur failure".

This was why I was 1 divided by the success rate of completing an item at around "base value" to use as a difficulty multiplier for the threshold values to generate a multiplier for it.

This is difficulty is scaled up to a "x more likely to incur failure". This is equivalent to placing more threshold points equal to a degree of the base values. Every failure point threshold has to be greater than 1 or 100% and every time it checks for progress and exp a new one is generated.

This means that you have to consecutively generate a higher failure point successfully by trying to get awarded before reaching that threshold. The amount of checks is a base value that is getting scaled up.

If you have a 23% "success", the failure threshold is at 26% progress, and you're awarded exp at 25% chance, you get the chance to generate a new threshold that is higher now and keep going from there.

This is the property of consecutive successes modified by the degree of threshold point that could be generated because there is a chance to generate a lower threshold and fail. The degree of difficulty is scaled to the recipe (my threshold multiplier).

You can also calculate from your base success chance and scale up the difficulty which was from view point as you preserve the multipliers/modifiers from you would simulate a similar event.

Naturally, you should get a very low number.

You should not really consider it a 23% success chance and more of work efficiency rating. Even if you have a 23% success chance after being modified and you do NOT have to generate a failure point threshold higher than 100% for the total craft until the very end. However, this is not always the case, it is dependant on the number of threshold checks that will be placed into the item progress.

The 23% chance is not treated as 23% chance for item completion if it is the new "success" value after being reduced (is what I think you're expecting).

EDIT: Think of it this way, the normal base value, if you have all the proficiency, is base 1 difficulty, or base 1 likeliness to incur failure. increase this base by 2 because you are x2 more likely to incur failure.

Now you have base (3) difficulty, or x3 times as likely to incur failure after adding x2 more likeliness to incur failure.

I'm pretty sure this is what the code is supposed to be doing.

KurzedMetal commented 3 years ago

This is a game breaking bug IMO.

I hope this issue gets fixed soon, makes playing in latest Experimentals very hard.

Has someone figured out which is the last build that is not affected by this?

ghost commented 3 years ago

The effective bonuses from stats and skills bonuses from base stats are should be divided by the base difficulty, so while you technically could compensate for it and craft to 100% item completion 100% of the time you'll need multiple of those stat and skill bonuses over the have the same effect.

This is probably what I forgot to include and why I said you should test on values based on "base 1" to not have to worry about that.

It makes sense to divide them since the bonuses they give are scaled to the recipe, if the requirements essentially are 3 times as high they should naturally count as 3 times as low if you want to preserve the same effective percentage.

I think the difficulty is unintended, but the code is working as it should.

The modifiers should be scaled down to .5 to 1 on the entry recipes or "50% more likely to incur failure" to "100% more likely to incur failure", equal to base (1.5) and base (2) of the recipe requirements respectively.

deadcutlass2 commented 3 years ago

@Evrze the way you are describing it now would be roughly if #48924 goes through.

Currently however, it sets the next failure threshold as at a mark related to the remaining percentage of the craft. This means having a higher completion % on the craft does absolutely nothing to change how likely your next attempt is to craft it. If you roll 0.5 every time, you will go 50%, 75%, 82.5%, 93.75% and so on and so forth (not accounting for progress loss on failure). Rolling a failure means you don't complete the craft. Rolling a success means you complete the craft. Each attempt, though it looks like you are making progress, is independent of each other. Having a higher percentage complete does not influence your likelihood of succeeding on the craft.

This is in lines 1042-1053 of crafting.cpp.

@KurzedMetal it'd be the build before merge of #48673, 22 days ago.

ghost commented 3 years ago

I'm not describing that, I'm saying it should be a geometric system (what we have now) instead of working towards linear. The generation of these fail points triggers should be based on the base values difficulty, which will scale the values accordingly to the other multipliers like missing proficiency penalties.

It depends how many "awards" for progress you get through, it has to regenerate a new value each time you get it. And it should be marking the related progress to 100% completion of the craft.

Rolling a 100% post threshold does nothing if it gets recalculated and does it in the beginning if it's going to generate a new one because you did it on the first roll but need to go through 10 more.

The degree of successfully passing this should be off the base value off success, this would generate a fail point threshold around what it considers the base value, I treated this as a difficulty to pass on to the new generated "success" which is actually a form effectiveness of work.

For base (1) if had a 71% success rate and only need to on average maybe see 1/.71 fail point threshold every craft, but now you're doing base (3).

Effectively if base (1) is considered 100 units of work, base (3) is considered 300 units of work, but you see the "item progress" of the base (1) as going towards 100% as well as base (3) going to 100% as you craft that item.

You can scale base (3) down to see a modified "success" rate as your new form of work efficiency and calculate based on that, however, the amount of threshold generated will be scaled from base (1) to base (3).

So, 3*(1/.71) to see an average amount of thresholds that you can usually see generated if you scale to 100% item completion in portions of 100/4.23.

(23.64%, 47.28%, ....) and if you trigger a failure and loss of progress, after you make up a value of progress equal to "23.64%" of item completion, you are expected to run into a failure point threshold/progress check based on the average amount of thresholds that should be placed into 100%.

If your modified success rate is 23% after the base failure subtraction and scaling down skills, it is a representation of a probability, like how 71% chance was the ability to trigger a post 100% threshold value a 23% chance to trigger a success (awarded exp, regenerate new failure point) where item progress is greater than 23.64%.

To calculate consecutive successes for this craft to succeed would be expected to be (.23)^4.22= 0.00202530982 or .02% to successfully craft without incidents by trigger an item threshold greater than 23.64% for 4.22 times. You will just about never expect to get a 100% failure point in the beginning and it will not matter, nearer to the end of the craft is where you will expect to see it.

You should remember at base (3), it is 3 times more degree of work, that 23% has the ability to generate a value greater than 100% of item completion similar to how well your base (1) success rate at 71% has the ability to generate a failure point threshold value greater than 300% for item completion.

The threshold generated should be (1+"x more likely to incur failure") and geometrically scaled to be placed based on the degree of difficulty from the base craft.

The modified success rate is to pass through 1 threshold and generated a no failure outcome and be able to generate new value, any number above the degree of progress is acceptable. The average number of threshold check will be preserved and should be tied to item progress or "units of work" you have you do.

If you want to preserve base scaling and difficulty then keeping how it currently is, works.

Your average amount of failing should be correlated to a multiple of the base (1) amount of failing, if you haven't failed enough you may not be able to finish a craft successfully, leading to clumping of failures at the end if you start with high rolls, and if you easily pass your first few thresholds you might see more in the end, if you fail a lot in the beginning, you might see less in the end.

The only way to offset this is with high enough bonus crafting modifiers that will be divided by the base difficulty to modify your success chance. If you have 20k Int you don't have to fail at all. It will try to generate failure threshold points maybe 200 times in a crafting session with each progress check but you can clear them all since they will be clumped way over 100% item progression.

This is to preserve probability but the probability is not real, frequency is real. The probability of consecutive success is so low in some cases the code will try to reflect it in the frequency, this is reasonable to me and should be how psuedo-randomness works.

It's there to show a frequency of events that are supposed to simulate a probability.

If you have a .02% success chance of occurrence you need to reflect this value with frequency (to craft an item with 100% completeness without incident).

This is can only be done with consecutive successes "x" amount of times, each success roll is dependent on succeeding the previous one. You do not roll failures in consecutive successes (if you do how could it be consecutive successes?), if you succeed in a roll you do not simultaneously fail it, or can any failure happen in any of the rolls, this is not how it works.

I guess you could clump it up as 1 independent event, and there is a .02% chance to successfully an item without incident under "x" conditions. for (.23)^4.22= .02%

The frequency of that observed outcome in 10000 crafts should be around 2.

I'll spell it out to you: 23% success chance to pass the first roll for passing failure threshold check -> (.23)^1= 23% success chance 23% chance to pass the second roll but must pass first roll-> (.23)^2= 5.29% success chance 23% chance to pass threshold but must pass 1st and 2nd roll -> (.23)^3 =1.217% success chance 23% chance to pass the 4th roll but must pass all previous rolls -> (.23)^4 = .28% success chance

If 23% chance is tied to 25% progress of an item then you're done. If 23% chance is tied to 20% progress of an item, you're not done, and need another roll. (.23)^5=.064% If 23% chance is tied to 22.5% progress of an item, you can go ahead and use (100/22.5) to account for the missing 10% progress that needs to be complete -> (.23)^4.444 =.0145%

You can see how your new success chance is different so how the failures will cluster will also be affected.

Naturally, through progress to each phase, you will see a clustering of fails if you succeed early because your chances of cumulative success are low and failure points will be generated accordingly, by failing you will clear the "average thresholds" and failures that should have occurred and help you complete the item if you have succeeded too much in the beginning at a low success rate.

pehamm commented 3 years ago

This is difficulty is scaled up to a "x more likely to incur failure". This is equivalent to placing more threshold points equal to a degree of the base values. Every failure point threshold has to be greater than 1 or 100% and every time it checks for progress and exp a new one is generated.

That is not what happens in the game, and I believe this assumption is why it feels like we are talking past each other in this discussion.

When you start crafting, the game determines the exact progress point at which you will fail or whether you succeed on the first try. The game knows you will fail at 48% even when you are at 0%. Only when that point is reached will a new point be created and that point will not change until you reach it during crafting.

ghost commented 3 years ago

The code does it's own thing but in general, the math behind it seems to be consistent. The spreadsheet is interpreting the percentage of success and failure, which is what I normalized to.

The generation of failures should be tied to the current success rate, when the game awards you with exp and such it also recalculates a new success rate that will be their percentage for the next craft session. Look at how the new success rate is changed in each progress tick to "pass" with a consecutive success, it does go down.

The ticks are tied to progress.

Failure point generation is tied to the current success rate, the success rate goes down.

It's preserving probability and reflects it in the frequency of events, which can also be calculated in a single step or split into steps. Consecutive success means lower and lower success rates to fully pass at each check point, this happens. The game knows you will get a guaranteed failure too, this happens.

Because you "normalize" values to make success chance and failure chance add up to be equal to 1, or 100%.

They can be values greater than 1 or 100% and there is a method to normalize them for calculating percentages, technically everyone is crafting with "negative success" in an interpretation if you like to go by percentages.

You can have a failure chance of 133% for a craft in order to complete in 1 sitting without incident, what does this mean:

you have a "negative success" of 33.33%: -33.33% success chance equivalent to: and a 133.33% failure chance

This implies you will always fail before you start, the failure point generated will be behind item progress.

You can normalize to make success a positive value:

treat 133.333% failure chance as a base (4) failure chance where base (1) failure = 33.33%

now you have: 66.666% success chance and a 33.333% failure chance

However, you are "x4 times as likely to incur failure" (multiplication of base) or "x3 times more likely to incur failure" (addition to base) than the base value. This will be multiplicative or additive with other modifiers will you as long as you need base (1) failure chance = 33.33% With the addition of other modifiers that should stack multiplicatively or additively as long as the value of base (1) failure chance =33.33% or .3333

You can stack it will a modifier that gives x7 more likely to incur failure and such, as long as x7 more likely to incur failure has the same base amount, otherwise that must be normalized to the same value in order to be made sense of for the new calculation.

Essentially, with "negative success" or crafting with failures, whatever you want to call it, you pushing your failures into other points by creating a new normalized point.

If you want to interpret percentages: Since you cutting up the craft and pushing your failure threshold points backward, you must compensate for the failures that you did not do, and MUST fail at a certain point.

I noted before that using probability and percentages before can misleading because of this point, only through a base conversion can they be considered for any use. This is also why the display for the recipe is so wonky sometimes due to the normalization points of the craft (you are trying to work towards a 0x multiplier in order to have base 1 crafting).

This is why you see failure clusters at high percentages because you were pushing failure points before your craft started into after your craft started by creating a new normalized point to calculate from.

From a mathematical standpoint, it makes sense. I'm convinced that no one understands the math anyways when they see it at first.

What the code seems to be doing is consistent but counterintuitive to people but is actually depicting an event that should be expected to happen by "normalizing" new points to calculate from.

You can do the same thing that pulling the values and using the formula the game provides or just not normalize the value to scale to percentages for calculating success or failures.

If a failure point threshold is ensured and cannot be passed, it means you have begun crafting with at least a 0% success rate but can be less than 0 (this is because the numbers were normalized from positive non-0 numbers).

If you craft with negative success, the code should try to preserve an average number of failures and success depends on the base values and multipliers of that specific craft over x amount of thresholds you are trying to pass. You can determine an expected number of failures (along with other things like the necessary degree of progress lost) and successes order to fully craft an item.

By knowing the multiplier for the base value as percentages you can use them to calculate other expected results.

deadcutlass2 commented 3 years ago

I still don't know what your math is trying to do, but I put it in the table so you could see the results of it at more than just the one value.

ghost commented 3 years ago

Base addition and base multiplication scale everything up geometrically (multiplicatively) on anything that is tied to it.

You know your difficulty for base (1) as your starting point then work towards the base (x) where "x" is the modifying amount of incurring failure.

You can treat the example I gave about as:

base failure chance (1/4)= (1.333/4) = =.33 = 33%

Effectively it reflects the same as the code where a value of 4 is similar to the proficiency multiplier. This is also equivalent to saying it is "3x more likely to incur failure" or "x4 as likely to incur failure" and it will go back to the original value of having a 133% failure chance to successfully craft in 1 sitting without incident.

Naturally, at base (1/4) or base (.25), this is not your real chance of success and failure, and what is tied to it has to be scaled up accordingly If you want to treat the final result of your craft base (1).

Everything tied to your base (1/4) or base (.25) crafting must be scaled up to the final craft base (1) if you want to treat it as such, the number of average failures, the number of average successes, the number of progress checks, etc.

Let's not consider negative successes, but crafting with failures, which is what most players will be doing, this is because it is tied to skill rolls after being modified by the base with a multiplier (which is the equivalent to base addition, division, or multiplication for failure/success chances).

It is confusing since I'm treating base 1 as a whole of something, and there are multiple ways to approach it.

actual-nh commented 3 years ago

Might I suggest changing the title to something like "99.99% failure rate when crafter is missing proficiencies", or otherwise emphasize what appears to need to be fixed in 0.F?

ghost commented 3 years ago

Also, by default, the proficiency modifier (in the code) is 1. The base for having them 100% proficiencies or 1.

It. does not start as 0, that is because you would get a divide by 0 error.

Recipes modifiers of "x more likely to incur failure" must add to this. You can use the "x times as likey to incur failure" instead which is the recipe failure multiplier as you noted below.

If you were going by x2 more likely, it is a (1+2)=3 proficiency multiplier: "x3 as likely to incur failure" or "x2 more likely to incur failure".

I don't know if I've made enough sense.

deadcutlass2 commented 3 years ago

image

ghost commented 3 years ago

That is consistent (mostly because the recipe failure modifiers are already off and can display 0.1x times values, meaning base 1.1).

actual-nh commented 3 years ago

pehamm just added some graphs to #48981 that demonstrate exactly how much of an overshot the current system is.

I-am-Erk commented 3 years ago

See https://github.com/CleverRaven/Cataclysm-DDA/issues/48981#issuecomment-849995704 for what I suspect is the solution to this.

ghost commented 3 years ago

I don't know what you have expected when the code you showed me shifted the time multiplier all towards failure rates. If it says x5 rate on the top when missing a proficiency, that failure rate is enforced throughout the segments of the craft from 1x all the way to x5.

It's set to do continuous die rolls, you do your failure rolls even when it's at 10% a ton if you're segmented.

I don't know what the problem is, it's a great feature for showing how continuous die rolls are done. You have your success rate with your success chance going against a failure chance and failure rate modifier that needs to be fully expressed at the end of the craft.

You set the code to run opposite of what it was originally set to do, the output is what it actually hides from you and lets you see as your progress going up before if you wanted to do a success roll (1).

Let's keep the continuous die rolls and unpassable failure points, it actually quite an accurate depiction of what the game actually did.

You're held fully accountable for each failure roll you did in that 10% segment, at the end you're held fully accountable for all your failure rolls as well, it's just skewed to x5.

I don't know what's wrong, the rates are literally showed to you from the screen.

Do people not know what failure rate 5x means 500% failure rate that will affect their failure chances? These are all tied to normal rates and normal chances, that's what it has always been modifying. No one ever seemed to calculate the normal point associated with it and just skipped over it.

I'm wondering if people can't read.

If they can't read how can they even read the code. I'm simply in a constant state of confusion.

It is x5 failure rate from the normal point, which should always be centered on success=failure points. You should expect it to be a 50-50 chance.

The skewness has to be expressed since you fucked up the code to shift the "time multiplier" that was spreading the rolls and inverted it's meaning to pushes it into more failures in fewer rolls.

It's actually a great system already to show the continuity of the rolls for success and failures you do, everything you do is set to affect everything up ahead, but there will be some parts that will be impossible to clear.

This is already consistent with how probability works, I don't know what people expect.

If it shows it being rigged, and you know it's rigged, why the hell would you expect to succeed in the end. Don't have delusional expectations of what your rolls can do. It looks like everything is fully functional and can even be kept like this, maybe even should be kept like this.

Mom-Bun commented 3 years ago

Locked for now as this issue seems to be getting spammed by one user in particular.

actual-nh commented 3 years ago

@deadcutlass2, others: Could you check out the fixes in #49046?

I-am-Erk commented 3 years ago

Yes I suspect this is dead now. Please ping me if not and I'll reopen.