Skip to content

Fixes #3215: Ice isn't slippery for rocks #3226

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

goncalof148
Copy link

@goncalof148 goncalof148 commented Mar 27, 2025

Since the ice floor wasn't being recognized as ice, specially on the hills on level "Tip of the Ice", the floor didn't have the slippery feature. I changed the tile attributes to address this problem and added a condition on the rock logic to include a slippery property on ice. Now tux can throw a rock to hills and it will slide back down due to the slippery property.

Video: https://youtube.com/shorts/B_z0Fx5yYJc?feature=share

Closes #3215

Since the ice floor wasn't being recognized as ice, specially on the
hills on level "Tip of the Ice", the floor didn't have the slippery
feature. I changed the tile attributes to address this problem and
added a condition on the rock logic to include a slippery property
on ice. Now tux can throw a rock to hills and it will slide back
down due to the slippery property.
@goncalof148 goncalof148 changed the title Fix #3215: Ice isn't slippery for rocks Fixes #3215: Ice isn't slippery for rocks Mar 28, 2025
@goncalof148
Copy link
Author

@tobbi could you check this, please?

257 257 257 257 257 273 273 273 273
257 257 257 257 257 273 273 273 273
257 257 0 257 257 0 0 273 273
257 257 257 257 257 0 0 273 273
Copy link
Member

@Hypernoot Hypernoot Apr 7, 2025

Choose a reason for hiding this comment

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

@Rusty-Box The ice slopes aren't slippery. Was that intended? (tiles/snow/icechunk.png)

@Hypernoot
Copy link
Member

Hypernoot commented Apr 7, 2025

It looks like the behaviour is almost the same, both in master and this PR. So what was actually fixed?

  1. non-ice solid flat tiles - In both versions, the rock stops instantly. That is correct.
  2. solid flat ice - In both versions, the rock slides for approx. 1s and then it stops. Wasn't that supposed to be different?
  3. solid ice slope - In master, the rock stops instantly, unless it is given an initial speed. In this PR, the rock slowly slides down and jitters occasionally.
  4. unisolid flat ice - In both versions, the rock just stops.
  5. unisolid ice slope - In both versions, the rock just stops.
  6. non-ice solid tiles with unisolid flat ice overlay - same as case 3
  7. non-ice solid tiles with unisolid ice slope overlay - same as case 4

@goncalof148
Copy link
Author

goncalof148 commented Apr 10, 2025

@Hypernoot @Rusty-Box @tobbi could you check this last version?

Solid Flat Ice: I decreased the friction
Solid Ice Slope: Now there is a minimum force to throw the rock
Unisolid flat ice and slope: I updated that part

Copy link
Member

@Hypernoot Hypernoot left a comment

Choose a reason for hiding this comment

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

I didn't test it in-game but I suspect that anything essential has changed, except that the ice friction was decreased. So that fixes point 1. The rest remains.

If this PR shall be treated as a partial fix, then all you need is decreasing one value, the ice friction. And you can drop all the other changes.

@goncalof148
Copy link
Author

@Hypernoot I thought I fixed the problems! Could you help me identify the right tiles? On the code I can't identify them by their type.

… when the rock falls down the slopes and the friction feels more natural.
@goncalof148 goncalof148 requested a review from Hypernoot May 31, 2025 00:04
Copy link
Member

@Hypernoot Hypernoot left a comment

Choose a reason for hiding this comment

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

I revoke my review. It looks like I can't delete this post, so just ignore this lol

@Hypernoot Hypernoot self-requested a review May 31, 2025 09:34
Copy link
Member

@Hypernoot Hypernoot left a comment

Choose a reason for hiding this comment

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

Your code is equivalent to:

  if (m_on_ground || (hit.bottom && m_on_ice)) {
    // Full friction!
    m_physic.set_velocity_x(m_physic.get_velocity_x() * (1.f - (GROUND_FRICTION * (m_on_ice ? 0.3f : 10.f))));
  }

This is almost the original code, except that two values are changed.

Can you tell me why you changed the non-ice friction from 1.0 to 10.0? Nobody complained about that.

@goncalof148
Copy link
Author

@Hypernoot the non-ice friction value changed by mistake! I will fix that! I had changed the GROUND_FRICTION constant and then also changed that value and forgot to change!

@goncalof148 goncalof148 requested a review from Hypernoot May 31, 2025 21:04
Copy link
Member

@Hypernoot Hypernoot left a comment

Choose a reason for hiding this comment

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

almost ^.^

@@ -177,9 +177,9 @@ Rock::collision_solid(const CollisionHit& hit)
m_at_ceiling = true;
}

if (m_on_ground || (hit.bottom && m_on_ice)) {
if (m_on_ground || (hit.bottom && m_on_ice)) {
Copy link
Member

Choose a reason for hiding this comment

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

You accidentally messed up indentation.

@goncalof148 goncalof148 requested a review from Hypernoot June 1, 2025 14:25
@goncalof148 goncalof148 closed this Jun 8, 2025
@goncalof148 goncalof148 reopened this Jun 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Ice isn't really slippery for rocks
2 participants