Talk:Farming

From Stardew Valley Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
This talk page is for discussing Farming.
  • Sign and date your posts by typing four tildes (~~~~).
  • Put new text below old text.
  • Be polite.
  • Assume good faith.
  • Don't delete discussions.

Deluxe Fertilizer Table

I'm testing the formulas given for crop quality chance for my own personal Stardew Valley spreadsheet. The values in the table for Deluxe fertilizer do not match the formulas given for calculating the chance. The values begin to diverge for me most notably at farming level 3. I calculate 16% Iridium, 27% Gold, 39% Silver, and 18% Regular. Starting with Iridium and working down to regular, I'm curious how the table gets 21% for Regular using the formulas given.

Also in the text below the Deluxe Fertilizer table, it says that Silver is the minimum quality when using Deluxe fertilizer, which is not displayed by the formulas.

Can anyone help me out?

--APost-It (talk) 23:25, 6 September 2021 (UTC)

Hello APost-It! Unfortunately, the user who added that table went inactive a while ago. Their comment when editing the page also got truncated, but it said something about how there may be rounding errors. So, if you have more correct numbers and would like to update the page, please do so! Thank you! margotbean (talk) 19:04, 7 September 2021 (UTC)
Thanks for the response! Yeah I can try to edit it. I wanted to double check if the in-game formulas are correct as stated on the page, but I'm not sure how to go about doing that. If they are, I can share what I have. APost-It (talk) 01:36, 8 September 2021 (UTC)
I added a code reference (it should have been done long ago, I'm so glad you asked about this subject!) -- the formula can be found in StardewValley.Crop::harvest. For your convenience, I believe the relevant portion, copied from the v1.5 code, is:
		double chanceForGoldQuality = 0.2 * ((double)Game1.player.FarmingLevel / 10.0) + 0.2 * (double)fertilizerQualityLevel * (((double)Game1.player.FarmingLevel + 2.0) / 12.0) + 0.01;
		double chanceForSilverQuality = Math.Min(0.75, chanceForGoldQuality * 2.0);
		if (fertilizerQualityLevel >= 3 && r.NextDouble() < chanceForGoldQuality / 2.0)
		{
			cropQuality = 4;
		}
		else if (r.NextDouble() < chanceForGoldQuality)
		{
			cropQuality = 2;
		}
		else if (r.NextDouble() < chanceForSilverQuality || fertilizerQualityLevel >= 3)
		{
			cropQuality = 1;
		}
Let me know if you have further questions! margotbean (talk) 18:02, 8 September 2021 (UTC)

So would the formula for actual chances be something like this:

iridium: gold chance / 2

true gold chance: gold chance * (1 - iridium chance)

silver chance: min( (gold chance * 2) * (1 - true gold chance) * (1 - iridium chance) )

normal: 1 - iridium chance - true gold chance - silver chance

LahaiRoi (talk) 13:49, 10 September 2021 (UTC)

Here are the numbers I'm getting:

LahaiRoi (talk) 14:32, 10 September 2021 (UTC)

I've looked at this for half an hour now, and I'm simply not qualified to say whether your calculations are correct. The table on the page under "Complete Formula" is correct, except for the "+ 0.01" added to the end of gold chance. I don't know where that comes from.
I don't see the accounting for silver being capped at 75% in your formulas. It may be there, I just don't seem to see it.
Your formulas for iridium & true gold seem correct to me, but I get lost at silver, to be honest. Your formula seems to be saying silver = the chance for iridium * true chance for gold * chance for iridium (again). Either I'm showing my weakness at probabilities, or helping you refine your calculations, I hope it's the latter. Either way, I think I may have given as much help as I'm capable.
Take another look, and if you think you're right, and have accounted for silver being capped at 75%, then go ahead and proceed to change the numbers in the table. If you think further discussion with me would help, please don't hesitate! I would like to be of more help, if possible! margotbean (talk) 16:47, 10 September 2021 (UTC)
Oh sorry I fixed the formula I wrote up there for silver. Its gold chance times two, not divided.
The 0.01 is actually in the code you posted above. So it is correct if we are basing it on that.
As for the 75% capped yes I did account for it by doing the following: If the sum of true gold chance and silver chance is greater than 1, then silver chance is set to 1 - true gold chance. Otherwise it is 0.75.
If you'd like to take a look at the sheet, heres the link (you'll have to remove the spaces): docs. google. com/spreadsheets/d/1_qFcwcRTiyfqGdm5LMmG-8MI3woqKowvu-1utmuYe4M/edit?usp=sharing
LahaiRoi (talk) 17:18, 10 September 2021 (UTC)
My numbers are different than what LahaiRoi got. My numbers were all the same as what the page already has for all fertilizers, except the Deluxe. I think the actual formulas are, based on the given code (forgive my pseudo code):
iridium: gold chance / 2

true gold chance: if( (gold chance * (1 - iridium chance) + iridium chance) < 1)
                     {gold chance * (1 - iridium chance)}
                  else
                     {1 - iridium chance}

silver chance: min(0.75, (gold chance * 2)) 

true silver chance: if(fertilizer quality == Deluxe)
                       {1 - iridium chance - true gold chance}
                    else if( (silver chance * (1 - iridium chance) * (1 - true gold 
                            chance) + iridium chance + true gold chance) < 1 )
                       {silver chance * (1 - iridium chance) * (1 - true gold chance)}
                    else
                       {1 - iridium chance - true gold chance}

normal: 1 - iridium chance - true gold chance - silver chance
With these formulas I replicated all the numbers in the tables for all the fertilizers, except for the Deluxe fertilizer. I will upload my full tables to this talk page tonight when I have more time.
--APost-It (talk) 17:24, 10 September 2021 (UTC)
If you are using deluxe fert then the silver chance is just max(1 - iridium chance - true gold chance, 0) because the code says: || fertilizerQualityLevel >= 3)
And if you are not using deluxe fert, then there shouldnt be any iridium calculations involved at all because the code says: fertilizerQualityLevel >= 3 &&
So normal chance is 1 - silver chance - true gold chance, and if deluxe fert is used then normal chance doesnt exist.
The gold and iridium formulas you have are good.
LahaiRoi (talk) 17:42, 10 September 2021 (UTC)
Here are my exact formulas:
gold chance (r) = 0.2*(farminglevel/10) + 0.2*fertlevel*((farminglevel+2)/12)+0.01
iridium chance = if fertlevel >= 3
                      r/2
                 else if fertlevel <= 2
                      0
true gold chance = if fertlevel <= 2
                      r
                 else if fertlevel >= 3
                      min(r*(1-iridium chance), 1-iridium chance)
silver chance = if fertlevel >= 3
                      max(1 - iridium chance - true gold chance, 0)
                else if fertlevel <= 2
                      min(min(r*2*(1-r),0.75),1-r)
normal chance = if fertlevel >= 3
                      0
                if fertlevel <= 2
                      max(1 - true gold chance - silver chance, 0)
LahaiRoi (talk) 18:09, 10 September 2021 (UTC)


Ok LahaiRoi, I've taken a look at your spreadsheet and I see where it went wrong. I think I didn't explain well what my formulas were. I'm attaching a screenshot below of some of my calculations.
Media:Fertilizer_Crop_Quality_Chances_Screenshot.png
I'm also attaching my spreadsheet. If you wish to see the formulas they are hidden within the headers.
docs.google.com/spreadsheets/d/1IwVMmuggkY2kzK6wrdUCWNndWI9r79YD3hDnvXIzbf8/edit?usp=sharing
If you look at the screenshot first, you can see that our calculations differ first at Basic Fertilizer and Farming Level 10. Our gold chances are the same. For silver, you calculate 48.4%; I have 44.3%. If you look at the way I've calculated it, I've broken down the calculation into two: first the Silver Chance Formula and then the actual Silver Chance. My Silver Chance Formula is exactly as given by the code. At Farming Level 10 with Basic Fertilizer, that is the first time that 0.75 becomes the minimum, which you can see in my calculation. Our values differ because I use that first then apply the probabilities. Looking at your calculation at the same levels (Row 29), you have min(G29*2*(1-G29),0.75) as your innermost min formula. You're multiplying the probability to the silver formula before taking the minimum. The code given above is first calculating the silver chance, then checking for iridium quality, then checking gold, finally silver. So I think your formula needs to be min(min(G29*2,0.75),1-G29) in order to follow the code.
Additionally, if I change my calculations to ignore the 75% cap to silver chance, my values match yours.
If that doesn't make sense to you, add a few intermediate columns that calculate the chance in parts. Make a column that calculates the silver chance, then another column that includes the silver chance and the probability the code checks for silver quality.
I'm confident that what I have is correct, please view my spreadsheet for the full calculations. If you compare mine to the current tables, all my percentages match, except for the Deluxe Fertilizer table, which cannot possibly be correct since it lists a nonzero chance of harvesting a regular quality. If everyone here agrees, I will edit the table.--APost-It (talk) 20:55, 10 September 2021 (UTC)
Alright I see. I changed my spreadsheet and it matches yours exactly. So ya I had it wrong.
You're good to change it. Thanks for helping me out with this.
LahaiRoi (talk) 22:21, 10 September 2021 (UTC)

XP per Day

Based on Margotbean's suggestion to move XP per Day here rather than including it in crops table in crops page. Xyrsis (talk) 22:58, 1 October 2023 (UTC)

Hello margotbean, I think XP per day is important as it is useful for determining the most efficient crops to level up your farming or foraging skills. There is slight difference to the most profitable crops as XP per day does not consider the price of seeds. I am going to use your spreadsheets to calculate the XP per day, edit on all crops table is on the way. Xyrsis (talk) 09:09, 1 October 2023 (UTC) This is the spreadsheet I used, spreadsheet.

Table added with values from last updated spreadsheet, there are few missing crops' value. To avoid controversy regarding maximum harvest and growing days, I will calculate it based on Crops page Gold per Day value then calculate XP per Day value for it. Xyrsis (talk) 23:45, 1 October 2023 (UTC)

Missing xp/d values updated. Please check. Xyrsis (talk) 00:35, 2 October 2023 (UTC)

So, this is the start of a discussion about the value of XP per day. Let's leave the discussion open before making the edits, please!
Below is a mockup of the proposed section:
XP per Day

Due to seed price, there is a slight calculation differences between the most profitable crops (Gold per day) and most XP yielding crops (XP per day). High quality crops grant the same amount of XP as normal-quality crops.

The general formula is: Minimum XP per Day = (Max Harvests × XP per Harvest) / Growing Days

Growing Days = Days to Maturity + ((Max Harvests − 1) × Days to Regrow)

Days to Maturity and Days to Regrow are listed in each table.

Max Harvests is normally 1, but for crops that continue to produce, it is the actual number of harvests that can be obtained in the growing season(s).

Spring
Crop XP XP/d
Coffee Bean.png Coffee Bean 4 1.32 1
1.63 2
Tulip.png Tulip 7 1.15
Unmilled Rice.png Unmilled Rice 7 0.86 3
1.15 4
Parsnip.png Parsnip 8 1.95
Green Bean.png Green Bean 9 2.08
Blue Jazz.png Blue Jazz 10 1.47
Garlic.png Garlic 12 2.93
Potato.png Potato 14 2.38
Kale.png Kale 17 2.91
Strawberry.png Strawberry 18 3.84 5
3.07 6
Cauliflower.png Cauliflower 23 1.98
Rhubarb.png Rhubarb 26 1.97
Ancient Fruit.png Ancient Fruit 38 3.97*
Cactus Fruit.png Cactus Fruit 14 3.04 7
4.39 8
Summer
Crop XP XP/d
Coffee Bean.png Coffee Bean 4 1.32 1
1.63 2
Hops.png Hops 6 3.74
Wheat.png Wheat 6 1.49
Hot Pepper.png Hot Pepper 9 2.67
Blueberry.png Blueberry 10 2.28
Corn.png Corn 10 1.58 1
2.09 2
Tomato.png Tomato 12 2.17
Sunflower.png Sunflower 14 1.78
Radish.png Radish 15 2.57
Summer Spangle.png Summer Spangle 15 1.93
Poppy.png Poppy 20 2.88
Melon.png Melon 27 2.27
Red Cabbage.png Red Cabbage 28 3.09
Starfruit.png Starfruit 43 3.37
Ancient Fruit.png Ancient Fruit 38 3.97*
Cactus Fruit.png Cactus Fruit 14 3.04 7
4.39 8
Taro Root.png Taro Root 16 1.65 3
2.35 4
Pineapple.png Pineapple 30 2.83
Fall
Crop XP XP/d
Wheat.png Wheat 6 1.49
Corn.png Corn 10 1.58 1
2.09 2
Eggplant.png Eggplant 12 2.34
Bok Choy.png Bok Choy 14 3.57
Cranberries.png Cranberries 14 2.53
Grape.png Grape 14 3.43
Sunflower.png Sunflower 14 1.78
Beet.png Beet 16 2.75
Amaranth.png Amaranth 21 2.99
Artichoke.png Artichoke 22 2.71
Yam.png Yam 22 2.17
Fairy Rose.png Fairy Rose 29 2.44
Pumpkin.png Pumpkin 31 2.35
Ancient Fruit.png Ancient Fruit 38 3.97*
Sweet Gem Berry.png Sweet Gem Berry 64 2.67
Cactus Fruit.png Cactus Fruit 14 3.04 7
4.39 8
1 1 season
2 2 seasons
3 Unirrigated
4 Irrigated
5 Planted on Spring 1
6 Planted on Spring 13/14
7 Planting season
8 Each season thereafter
*Assumes seed crafted for free from Ancient Seed Artifact, grown for 3 seasons.
Opinions on the value and validity of the information are welcome! margotbean (talk) 03:38, 2 October 2023 (UTC)
My bad for the edit, thanks for opening the discussion! Xyrsis (talk) 06:23, 2 October 2023 (UTC)

Notation

The formula XP=||16 × ln(0.018 × PRICE + 1)|| means round everything between the double-pipes to the nearest integer. I've seen ⌊x⌉ and [x] being used for "round to nearest integer" as well. Does anyone have any thoughts about what notation should be used on the wiki? Perhaps providing an explanation instead of relying on symbols would be better? (although this would require changing wording in all 12 languages)... Thoughts? margotbean (talk) 21:11, 18 October 2023 (UTC)