Talk:Crop Growth Calendars

From Stardew Valley Wiki
Jump to navigation Jump to search
This talk page is for discussing Crop Growth Calendars.
  • Sign and date your posts by typing four tildes (~~~~).
  • Put new text below old text.
  • Be polite.
  • Assume good faith.
  • Don't delete discussions.

Archive

The archived talk page can be found at https://stardewcommunitywiki.com/Talk:Crop_Growth_Calendars --margotbean (talk) 02:56, 20 February 2021 (UTC)

Ancient Fruit (Deluxe Speed-Gro) should have 22 days

The calendar for Ancient Fruit, Deluxe Speed-Gro mentions that the fruit is fully grown after 20 days. This should be 22 days. I tested this in Stardew Valley 1.5 multiple times. Does anybody else have the same result in their game? The stages are as follows in my game for Ancient Fruit with Deluxe Speed-Gro.

Growth phases
Stage Days
Stage 1 1 days
Stage 2 5 days
Stage 3 5 days
Stage 4 6 days
Stage 5 4 days

Maiken (talk) 18:41, 29 March 2021 (UTC)

You are absolutely correct, I've updated the page with the correct stages. Thanks so much! margotbean (talk) 18:53, 29 March 2021 (UTC)

Speed-Gro Mechanics

Speed-gro, Deluxe Speed-gro, and the Agriculturist profession are all calculated in the same way where they contribute to a certain percentage discount on the number of days a crop will spend in its growing stages.

For Speed-gro, the discount is 10%, for Deluxe Speed-gro it is 25%. Agriculturist will add an extra 10% discount to whatever the discount was before.

The discount is applied the moment the seed is planted. However, there are two details which complicates the calculations.

Floating point imprecision

The precise number of days discounted is multiplied using 32 bit floating point arithmetic, which has a small amount of imprecision. The result is then rounded up, which may result in surprising numbers. Let's look at an example, Green Beans with Speed-Gro.

First we have an array with the number of days the crop spends in each growing stage.

   int[] greenBeanStages = new [] { 1, 1, 1, 3, 4 };

Then we add all those numbers together to get the total number of days the crop spends growing.

   int totalDaysGrowing = 10;

This is the weird part. Floating point imprecision means that 0.1 * 10 isn't 1, it's 1.00000001490116

   float discountFactor = 0.1;
   float daysDiscounted = (float)totalDaysGrowing * discountFactor;

The number of discounted days are rounded up

   double result = Math.Ceiling( (double) daysDiscounted );

And the result of Math.Ceiling( 1.00000001490116 ) is, of course, 2. That is why Green Beans with Speed-Gro gets two discounted days, 20%, instead of just the one.

The fully grown stage

When the discount is applied, the game will decrease the number of days the crop spends in each growth stage sequentially, one day from each stage at a time, until it has removed the number of total days calculated in the last step. However, all crops have a final, fully grown stage, and sometimes the number of discounted days are enough to reach into and discount from this final stage as well. This results in a wasted discount day. Let's look at an example, Ancient Fruit planted on Deluxe Speed-gro.

Stage:
Ancient Fruit Stage 1.png
Ancient Fruit Stage 2.png
Ancient Fruit Stage 3.png
Ancient Fruit Stage 4.png
Ancient Fruit Stage 5.png
Number of days 2 7 7 7 5

This is a total of 28 growing days, and with a 25% discount that gives us 7 discounted days.

Before the discount is applied, the fully grown stage is added.

Stage:
Ancient Fruit Stage 1.png
Ancient Fruit Stage 2.png
Ancient Fruit Stage 3.png
Ancient Fruit Stage 4.png
Ancient Fruit Stage 5.png
Ancient Fruit Stage 6.png
Number of days 2 7 7 7 5 99999

Yes, 99999 is the actual number of days in the final stage. Somewhere around 900 in-game years.

Now the days are discounted, one at a time, from the different stages starting with the first stage:

1 Stage:
Ancient Fruit Stage 1.png
Ancient Fruit Stage 2.png
Ancient Fruit Stage 3.png
Ancient Fruit Stage 4.png
Ancient Fruit Stage 5.png
Ancient Fruit Stage 6.png
Number of days 1 7 7 7 5 99999
2 Stage:
Ancient Fruit Stage 1.png
Ancient Fruit Stage 2.png
Ancient Fruit Stage 3.png
Ancient Fruit Stage 4.png
Ancient Fruit Stage 5.png
Ancient Fruit Stage 6.png
Number of days 1 6 7 7 5 99999
3 Stage:
Ancient Fruit Stage 1.png
Ancient Fruit Stage 2.png
Ancient Fruit Stage 3.png
Ancient Fruit Stage 4.png
Ancient Fruit Stage 5.png
Ancient Fruit Stage 6.png
Number of days 1 6 6 7 5 99999
4 Stage:
Ancient Fruit Stage 1.png
Ancient Fruit Stage 2.png
Ancient Fruit Stage 3.png
Ancient Fruit Stage 4.png
Ancient Fruit Stage 5.png
Ancient Fruit Stage 6.png
Number of days 1 6 6 6 5 99999
5 Stage:
Ancient Fruit Stage 1.png
Ancient Fruit Stage 2.png
Ancient Fruit Stage 3.png
Ancient Fruit Stage 4.png
Ancient Fruit Stage 5.png
Ancient Fruit Stage 6.png
Number of days 1 6 6 6 4 99999
6 Stage:
Ancient Fruit Stage 1.png
Ancient Fruit Stage 2.png
Ancient Fruit Stage 3.png
Ancient Fruit Stage 4.png
Ancient Fruit Stage 5.png
Ancient Fruit Stage 6.png
Number of days 1 6 6 6 4 99998
7 Stage:
Ancient Fruit Stage 1.png
Ancient Fruit Stage 2.png
Ancient Fruit Stage 3.png
Ancient Fruit Stage 4.png
Ancient Fruit Stage 5.png
Ancient Fruit Stage 6.png
Number of days 1 5 6 6 4 99998

Note that in step 6, the discounted stage is the fully grown stage, resulting in a lost discount day.

Also note that the first stage can't be discounted to zero, so the discount skips past that stage to the next one in step 7. The other stages can be discounted to zero, it is just the first stage that can't.

The final number of days the crop will spend growing is, as demonstrated above, 1+5+6+6+4 = 22. Meaning we actually got 6 discounted days instead of 7. --Zaz (talk) 04:56, 6 December 2017 (BST)

Do you happen to know when this changed? If I remember correctly, the growth discount used to be capped by the number of growth stages (sans the final day), so the maximum anything could have been reduced by was 5. But that's good that it works this way now. It makes sense for some of the longer growing craps. --Eienshi09 14:26, 25 April 2018 (PST)

Speed-Gro Glitch

Apart from Speed-Gro Mechanics, there's another bug in ConcernedApe's codes. When he calculates the days to be removed, he doesn't consider the situation where days of the stage is less than 0 day.

Let's take grape as an example. The stage of grape is {1, 1, 2, 3 ,3} in the crops.xnb. When we have Hyper Speed-Gro and Agriculturist at the same time, the speed increase should be 0.43. 0.43 * (1+1+2+3+3) = 4.3 ≈ 5. Therefore, 5 days should be removed from the grapes' growth stage. It should take 5 days to grow and can be harvested on the 6th day. The following is the normal process:

{1, 1, 2, 3 ,3} --step 1--> {1, 0, 2, 3 ,3} --step 2-->

{1, 0, 1, 3 ,3} --step 3--> {1, 0, 1, 2 ,3} --step 4-->

{1, 0, 1, 2 ,2} --step 5--> {1, 0, 0, 2 ,2}

While in the code and game, the actual process is:

... --step 4-->

{1, 0, 1, 2 ,2} --step 5--> {1, -1, 1, 2 ,2}

Therefore, the grapes take 1 + 0 + 1 + 2 + 2 = 6 days to grow, and can be harvested on the 7th day. I have tested this in the game, and it actually takes 6 days to grow.

The growth calendar of grapes is now correct. The purpose of editing this topic is to explain how this happened. Horizon98 (talk) 16:38, 20 April 2021 (UTC)

Using module to replace this page

I have completed a module to output crop growth calendars, see Module:Crop Growth Calendars. And it works well now. You can see the page using this module here: User:Horizon98/Sandbox. I have compared the sandbox and Crop Growth Calendars, everything works well. Furthermore, translating this page can be very easy. Just translate the table Dictionary of the Module (only 30 words or sentences need to be translated), and then all calendars are translated. See this page on zh wiki: zh:作物生长日历.

Besides, the 25% Irrigated table of Unmilled Rice is incorrect now. It should take 4 days to grow instead of 5 days. I have tested in the game. Horizon98 (talk) 16:39, 20 April 2021 (UTC)