Page 1 of 1

Problems with probabilities in recipes

Posted: Sun Jul 09, 2017 10:19 am
by Grundox
So the coding is the same as the uranium processing, e.g.:

Code: Select all

results = 
  {
	{
	name = "niobium-plate",
	probability = 0.069,
	amount = 1
	},
	{
	type = "fluid",
	name = "hydrogen",
	probability = 0.414,
	amount = 1
	},
	{
	type = "fluid",
	name = "oxygen",
	probability = 0.517,
	amount = 1
	}
 }
the problem is that this doesn't work right. Sometimes I'm getting nothing sometimes hydrogen and oxygen out of one hydropyrochlore. I think what happens is that I get by certain chance the results of the recipe. That means i could get by a slim chance all three items out of one ore. That's not what I want though. I want a certain chance for the ore to be smelted into one of the listed items and not sometimes none, sometimes two at a time, etc.
Can anyone please help me with this?

Re: Problems with probabilities in recipes

Posted: Sun Jul 09, 2017 4:25 pm
by DaveMcW
I don't think that's possible.

You can copy oil-processing to get something similar, with zero randomness.

Re: Problems with probabilities in recipes

Posted: Sun Jul 09, 2017 4:32 pm
by Optera
While you would suspect setting 0.9 prodA and 0.1 prodB will result in either one that's not the case.
Every crafting cycle probability for each product is calculated separately. That means it will output products truly randomized including everything and nothing.

Multiplying input and output will change nothing.
0 probability * 30 is still 0.

Re: Problems with probabilities in recipes

Posted: Sun Jul 09, 2017 6:16 pm
by Grundox
so it is also the case in uranium processing that u may not get anything from one piece of uranium ore?

Re: Problems with probabilities in recipes

Posted: Mon Jul 10, 2017 5:20 am
by Optera
Grundox wrote:so it is also the case in uranium processing that u may not get anything from one piece of uranium ore?
Exactly.
That recipe was topic of a bug report that has been filed as working as intended by the devs.

Re: Problems with probabilities in recipes

Posted: Mon Jul 10, 2017 9:22 am
by bobingabout
That's basically why some of my recipes are as they are. instead of getting 0.25 of an item, I just multiplied everything by 4 (takes 4 times as long, cost 4x the ingredients and you get 4 times the amount of the other ingredients out.)