Skip to content

Conversation

ehughsbaird
Copy link
Contributor

Summary

Features "Add another form of scaling for batch recipes, enabling creation of bulk recipes"

Purpose of change

Resolves #82744 by allowing creation of bulk threshing recipes.
As discussed in #82795

Describe the solution

Allow specifying recipe scaling as either logistic (the existing mode) or linear with a max batch size.

For linear scaling with offset T, and a max batch size of M, the time taken for batch of n is (ceil(n/M) * T) + (n * (time - T))).

Move recipe batch information to it's own struct, with a variant of substructures specifying the data for whichever mode is selected.

Testing

Examine the batch time taken for the bulk and non-bulk threshed oats recipes, see that they match (e.g. 1 bulk oats is 10 oats, and so on until 5/50).

@github-actions github-actions bot added <Documentation> Design documents, internal info, guides and help. [JSON] Changes (can be) made in JSON Crafting / Construction / Recipes Includes: Uncrafting / Disassembling [C++] Changes (can be) made in C++. Previously named `Code` [Markdown] Markdown issues and PRs <Enhancement / Feature> New features, or enhancements on existing json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions labels Sep 9, 2025
Copy link
Contributor

@PatrikLundell PatrikLundell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ITEM_CRAFT_AND_DISASSEMBLY.md:

  • I would like the batch_craft_factors numbers only format to be described as legacy, to be phased out, to encourage new users to use the full format.
  • Is the "at" valure description really correct? I thought it was "savings_after". Otherwise [25, 1] would mean you'd get the reduction on everything, since you're always going to produce the "at" number. Thus, I had thought the savings in the example would be applied to the 5 beyond the limit. The savings_string code also prints '>'.
  • I think "offset" is harder to understand than "setup" or "preparation". I'd also say that 'M' defaults to 1 when not specified (you can figure that out by comparing the formulae, or assume it by using common sense, but I think being explicit is useful).
  • I'd like to see it clarified that "max" isn't the maximum size of the UI specified batches, but the maximum at which the setup cost applies before it has to be spent again.

Note that I'm usually in favor of verbose descriptions covering as much as is reasonable, and others might be less amused (and have a lower threshold for "reasonable")...

recipe.cpp:

  • batch_savings::apply():
    • I continue to dislike assignments within "if" statements...
  • batch_savings::deserialize():
    • I'd add a comment to the first section indicating it should be removed once all JSON has been converted to make it easier to find once the job has been completed.
    • I'd consider the addition of validation code rejecting illegal values (rsize < 1, rscale < 0, >= 100, offset > time (but equal could be OK: boiling 3 eggs taking the same as 1), max < 2)).

Some things want to specify a percent as a percentile in JSON
Add an option for linear batch time scaling, in addition to the existing
logistic scaling, and add a bulk threshed oats recipe to demonstrate
its use.

Variant is maybe overkill, but seemed like a natural approach to the
problem.
@ehughsbaird
Copy link
Contributor Author

I'd also say that 'M' defaults to 1 when not specified

M defaults to n when not specified.

@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Sep 12, 2025
@Maleclypse Maleclypse merged commit c4a0abe into CleverRaven:master Sep 20, 2025
29 checks passed
@ehughsbaird ehughsbaird deleted the batch-form branch September 20, 2025 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` Crafting / Construction / Recipes Includes: Uncrafting / Disassembling <Documentation> Design documents, internal info, guides and help. <Enhancement / Feature> New features, or enhancements on existing [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions [Markdown] Markdown issues and PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow larger batches for bulk crafts
3 participants