Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: stack comestibles regardless of rot #4320

Merged
merged 10 commits into from
Mar 10, 2024

Conversation

scarf005
Copy link
Member

@scarf005 scarf005 commented Mar 9, 2024

Purpose of change

  • improve QOL by allowing 10h and 11h old pancakes to stack
  • improve performance a tiny bit by not having 123 kinds of slightly different food around

Describe the solution

  • Added option group to configure comestible merging.
    • the new stacking strategy is enabled by default.
    • you can rollback to previous strategy via setting it legacy
    • by default, only comestibles that's up to 75% fresh can be merged (tweakable)
    • by default, comestibles that has up to 25% similar freshness can be merged (tweakable)
  • On item merging, the rot is set to weighted average of their rotness and charges
    • mixing small fresh food with huge amount of near rotten food won't make it much fresher and vice versa

Describe alternatives you've considered

  • allow mixing two items not by freshness compared to shelf life, but similarities between the two?

Testing

image

Solid comestible

solid.mp4

Liquid comestible

liquid.mp4

have to change the option before testing.

also updated stacking_over_time test to test both legacy and new behavior.

Additional context

related: #3057

@github-actions github-actions bot added the src changes related to source code. label Mar 9, 2024
@Lamandus
Copy link
Contributor

Lamandus commented Mar 9, 2024

How is the freshness threshold working?

@scarf005 scarf005 force-pushed the feat-stack-comestible branch from ee2a85c to 05b32c2 Compare March 9, 2024 06:47
@github-actions github-actions bot added the tests changes related to tests label Mar 9, 2024
@scarf005
Copy link
Member Author

scarf005 commented Mar 9, 2024

  1. freshly spawned item is 100% fresh.
  2. rotten item is 0% fresh.
  3. when freshness threshold is set to 0%, item of any freshness can be merged.
  4. when freshness threshold is set to 75%, only very fresh items can be merged.
  5. when freshness threshold is set to 100%, only items of identical freshness can be merged.

I think similarity check for item rotness would be better but i wasn't able to figure out equation that worked well. my attempt was to use ratio between two, but then item with 0 rot counter (spawned right away) and item with 1 rot counter (spawned 1 second before) won't merge because their similarity ratio was 0 (equation: const ratio = (a: number, b: number) => Math.min(a, b) / Math.max(a, b) * 100)

@Lamandus
Copy link
Contributor

Lamandus commented Mar 9, 2024

can you put the option menu in line with the others? Because that is the only one that is using that system except for logging. Should we use drop downs for all other of that kind or go back to the old system.

grafik
see here for example autosave and sound

@scarf005
Copy link
Member Author

scarf005 commented Mar 9, 2024

i think we should migrate everything to groups in the long term (DDA did that), thus i applied option groups to newly added ones.

@Lamandus
Copy link
Contributor

Lamandus commented Mar 9, 2024

looks good, do you intend to change the system? Or is it the final version?

@scarf005
Copy link
Member Author

scarf005 commented Mar 9, 2024

oh, i'm intending to change it to merge based on similarities to freshness

edit: done.

@scarf005 scarf005 requested review from Lamandus and chaosvolt March 9, 2024 22:25
Copy link
Member

@chaosvolt chaosvolt left a comment

Choose a reason for hiding this comment

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

Here's hoping nothing big was missed in testing...

@scarf005 scarf005 merged commit e253538 into cataclysmbnteam:main Mar 10, 2024
13 checks passed
@Lamandus
Copy link
Contributor

Here's hoping nothing big was missed in testing...

Actually if wasn't tested with the new system....

@scarf005 scarf005 deleted the feat-stack-comestible branch March 10, 2024 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
src changes related to source code. tests changes related to tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants