Probability-based recipe outputs are independent
Posted: Tue May 16, 2017 3:41 pm
I realize the probability calculation is currently implemented intentionally this way and that there is no effective effect on outcome for the vanilla uranium mining recipe since the probabilities are so uneven. However, I think there is a strong case to be made that the current calculation leads to unwanted outcomes for mod authors that are trying to leverage this feature in recipes using higher percentages, as the overlap means that inputs are effectively created or destroyed. It also means that any circuit network calculations that relies on traceable calculations from inputs to outputs cannot be implemented.
For example, I am trying to create a mod that incorporates a scrap/recycling mechanism for complex products, like robots or engines. The new probability recipes seem perfect for this - in theory, I can create a recipe that will create a broken part 10% of the time (and have research to unlock a more efficient recipe). I can then have a recycling path that can try to rework the broken part into a working part or to recycle it for materials. However, when I try to create a production area for these recipes that tries to use the circuit network to control the delivery of inputs and map it to scrap and outputs, it isn't possible to get it working because the independent nature of the probability calculations make it a common occurrence for a single recipe cycle to produce either both a real item and scrap item or to produce nothing. Although this is fine at a macro level, since the effect on overall production will average out over time, at a micro level using circuit networks, the numbers of inputs to outputs almost never line up at any given time. In other words, out of input resources for 10 items, it is quite likely to find that I've produced 10 working items and 1 scrap item or 8 working items and 1 scrap item. The numbers simply do not add up.
This effect is more pronounced as the probability of producing items is increased. It's not noticeable at the vanilla level for uranium mining - no one is going to notice the 0.6951% chance (actual number) of not producing U-235 or U-238 for a recipe cycle. But, it is very noticeable when the probabilities are higher (5%, 10%, 50%) and makes it impossible to do any circuit network calculations that expect recipe inputs and outputs to sum to a consistent value.
It could be possible to keep the current behavior as an opt-in by adding a flag to the recipe, but I think the common expectation is that a recipe will choose a single outcome from among its possible outcomes when the probabilities sum to 1 and that producing nothing should only be a possibility when the probabilities sum to less than 1.
Given the above, I respectfully submit that the current implementation - to treat recipe probabilities as independent events rather than dependent events (i.e., only one can occur for any given recipe cycle) - is a design and implementation bug.
For example, I am trying to create a mod that incorporates a scrap/recycling mechanism for complex products, like robots or engines. The new probability recipes seem perfect for this - in theory, I can create a recipe that will create a broken part 10% of the time (and have research to unlock a more efficient recipe). I can then have a recycling path that can try to rework the broken part into a working part or to recycle it for materials. However, when I try to create a production area for these recipes that tries to use the circuit network to control the delivery of inputs and map it to scrap and outputs, it isn't possible to get it working because the independent nature of the probability calculations make it a common occurrence for a single recipe cycle to produce either both a real item and scrap item or to produce nothing. Although this is fine at a macro level, since the effect on overall production will average out over time, at a micro level using circuit networks, the numbers of inputs to outputs almost never line up at any given time. In other words, out of input resources for 10 items, it is quite likely to find that I've produced 10 working items and 1 scrap item or 8 working items and 1 scrap item. The numbers simply do not add up.
This effect is more pronounced as the probability of producing items is increased. It's not noticeable at the vanilla level for uranium mining - no one is going to notice the 0.6951% chance (actual number) of not producing U-235 or U-238 for a recipe cycle. But, it is very noticeable when the probabilities are higher (5%, 10%, 50%) and makes it impossible to do any circuit network calculations that expect recipe inputs and outputs to sum to a consistent value.
It could be possible to keep the current behavior as an opt-in by adding a flag to the recipe, but I think the common expectation is that a recipe will choose a single outcome from among its possible outcomes when the probabilities sum to 1 and that producing nothing should only be a possibility when the probabilities sum to less than 1.
Given the above, I respectfully submit that the current implementation - to treat recipe probabilities as independent events rather than dependent events (i.e., only one can occur for any given recipe cycle) - is a design and implementation bug.