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

Rigidity slider fix #5778

Merged
merged 6 commits into from
Jan 17, 2025

Conversation

Patryk26g
Copy link
Contributor

@Patryk26g Patryk26g commented Dec 29, 2024

Brief Description of What This PR Does

Hopefully this fixes the rigidity slider issue. The problem was mainly with the division by 0.

Related Issues

Closes #4150

Progress Checklist

Note: before starting this checklist the PR should be marked as non-draft.

  • PR author has checked that this PR works as intended and doesn't
    break existing features:
    https://wiki.revolutionarygamesstudio.com/wiki/Testing_Checklist
    (this is important as to not waste the time of Thrive team
    members reviewing this PR)
  • Initial code review passed (this and further items should not be checked by the PR author)
  • Functionality is confirmed working by another person (see above checklist link)
  • Final code review is passed and code conforms to the
    styleguide.

Before merging all CI jobs should finish on this PR without errors, if
there are automatically detected style issues they should be fixed by
the PR author. Merging must follow our
styleguide.

@revolutionary-bot
Copy link

The lead programmer for Thrive is currently on vacation until 2025-01-07. Until then other programmers will try to make pull request reviews, but please be patient if your PR is not getting reviewed.

PRs may be merged after multiple programmers have approved the changes (especially making sure to ensure style guide conformance and gameplay testing are good). If there are no active experienced programmers who can perform merges, PRs may need to wait until the lead programmer is back to be merged.

@dligr dligr requested review from a team December 30, 2024 13:24
@dligr dligr added the review label Dec 30, 2024
@dligr dligr added this to the Release 0.8.1 milestone Dec 30, 2024
@dligr
Copy link
Member

dligr commented Jan 4, 2025

I have found a new corner case:

  1. Set mutation cost at 1.9
  2. Place two cytoplasms
  3. Drag the rigidity slider to get the MP to 7
  4. Skip two slider steps with a mouse press; the MP ends up at -1

It seems like the issue is that the step cutoff calculations don't take into account the extra 1 that may be added due to rounding

@Patryk26g
Copy link
Contributor Author

I think this corner case is working properly now

@dligr
Copy link
Member

dligr commented Jan 8, 2025

I have found another corner case:

  1. Set mutation cost at 0.2
  2. Get to editor
  3. Place some hydrogenases to get MP to 1
  4. Move the rigidity slider three steps and it becomes immovable

@Patryk26g
Copy link
Contributor Author

I have found another corner case:

I took care of it as well

@hhyyrylainen hhyyrylainen requested a review from dligr January 16, 2025 08:07
Copy link
Member

@dligr dligr left a comment

Choose a reason for hiding this comment

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

The only issue I could find now is that when choosing rigidity though clicking while having low enough MP, there might be more steps cut off than needed.
For example, with the MP cost modifier of 1.9:

  1. Switch to any membrane type
  2. Move rigidity one step left
  3. Click somewhere on the right part of the slider

The slider's value would then be one step away from the right value due to excessive cut off

@Patryk26g
Copy link
Contributor Author

The only issue I could find now is that when choosing rigidity though clicking while having low enough MP, there might be more steps cut off than needed. For example, with the MP cost modifier of 1.9:

  1. Switch to any membrane type
  2. Move rigidity one step left
  3. Click somewhere on the right part of the slider

The slider's value would then be one step away from the right value due to excessive cut off

Well that seems like a really rare case and not that problematic. I think that in order to cover this one I would actually need to rewrite the whole function from scratch because I don't see any other solution

Copy link
Member

@hhyyrylainen hhyyrylainen left a comment

Choose a reason for hiding this comment

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

This fixes the primary bug but as @dligr found out this leaves 1 or 2 MP when trying to move too far in one step, which is a pretty noticeable bug when playing with the slider.

As this has been open for a while and fixes the game locking up, I'll merge this but open a follow up issue.

@hhyyrylainen hhyyrylainen merged commit 3d9aae2 into Revolutionary-Games:master Jan 17, 2025
4 checks passed
@hhyyrylainen
Copy link
Member

Opened the new issue: #5821

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Rigidity slider breaks when trying to move it at exactly 0 MP
4 participants