AgriCraft

AgriCraft

30M Downloads

conflict between "product - minimal" and "product - chance"

MBelhardi opened this issue · 4 comments

commented

when the chance, that a pruduct is produced is lower than "1" then there is a chance, that none result would be produced, even so the minimum that should be produced is defined at higher than "0":

  "products": {
    "products": [
      {
        "min": 1,
        "max": 4,
        "chance": 0.95,

in this example (defined for potatoes in my game) ther was defined that at least 1 Potato has to be produced. The chance value should only refer to values higher than the minimum value up to the maximum value. But as I said, there are often none result, even so I should get at least 1 potato, and apart from the statistics of the plants up to 95 percent additional potatoes.

commented
commented

sure can do, but that isn't the solution to this problem.

commented
commented

@MBelhardi If this is still an open issue for you, I can provide some clarification about the JSON format. The trick is that each product first has a chance of being included at all (or not) in the results. If that probability succeeds, only then is an does a quantity get selected. And that amount varies uniformly from min to max, inclusive of both, like the JSON specifies. But those other times you'll get zero instead.

A good example would be to use 10 and 20 for the min and max, and set the chance to something less than one. As you harvested these plants, you would see that either you're getting a huge amount in that range, or you're getting nothing. (Note: it gets more complicated with plants that have Gain >= 3, where the plants give products more than once.)

I'm not sure what distribution you were expecting. What is the chance supposed to represent in that case? What would it control?

There are some possible solutions that might work for you.

  • As renadi suggested, you can set chance to one to never get less than the min of that product.
  • You also can include an item multiple times in the product list, with the same or different values for the other variables. Then you can have a 100% chance of getting exactly whatever. And the amount in addition to that depends on the settings for the second copy. For example, you could create more "spiky" distributions, while still having a minimum.

Hope things work out with this. Cheers!