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

[Bug]: Big rocks push small rocks through the floor #3105

Open
6 tasks done
weluvgoatz opened this issue Nov 20, 2024 · 1 comment
Open
6 tasks done

[Bug]: Big rocks push small rocks through the floor #3105

weluvgoatz opened this issue Nov 20, 2024 · 1 comment

Comments

@weluvgoatz
Copy link
Member

SuperTux Version

SuperTux Latest Nightly

System Information

Windows 10 64-bit

Expected Behavior

When big rocks are stacked on top of smaller rocks, they should not push the smaller rocks through the floor.

Actual Behavior

When big rocks are stacked on top of smaller rocks, they push the smaller rocks through the floor.

Steps To Reproduce Actual Behavior

Take a big rock and place it on top of a smaller rock.

Additional Information

This is probably a result of the MovingStatic collision changes I made earlier this spring, so it might be worthy to add a check to not let bigger movingstatics push smaller movingstatics through movingstatics that are larger than the small one, or normal statics.

Guidelines For Reporting Issues

  • I have read https://github.com/SuperTux/supertux/blob/master/CONTRIBUTING.md#bug-reports.
  • I have verified this isn't an issue that's already been reported.
  • I have verified this isn't a discussion, or an issue about a crash or a feature request, but rather an actual bug ─ that is, the game did something not intended.
  • I have verified this issue is not about wrong translations (use Transifex for those), or anything unsupported (e.g. third-party add-ons).
  • In this report, I have only included details about one (1) bug.
  • If I make a mistake while submitting this report, I agree to use the "Edit" feature to correct it, instead of closing this issue and opening a new one.
@swagtoy
Copy link

swagtoy commented Nov 21, 2024

I believe there is quite a bit of jank with the physics engine right now. I can confirm similar bugs occurring with many enemies i.e. Collisions do not behave well and clipping behavior in Supertux is absurdly aggressive. This bug may be independent of these things, however. Regardless, this issue does go further down the line. I will analyze a tiny bit:

A quick look at src/collision/collision_system.cpp shows that there is a forgiveness variable, and the following logic using that variable should make sense really. However, in all honesty, this forgiveness is a bit of a "hack".

static const float FORGIVENESS = 256.f; // 16.f * 16.f - half a tile by half a tile.

Why is this a hack? Well, because it just is. Once the forgiveness becomes unforgivable, then we just.. kind of warp the player through the floor. That's at least specifically why this happens.

Now, surprisingly, your issue has nothing to do with this particular instance, however, it would honestly be nice if the collision system could more appropriately handle this mishapping behavior. In fact, it could entirely prevent issues like this to begin with if we changed the way "forgiveness" worked, i.e. pushing objects back up based on the reverse of their direction, or rather, the closest surface as well as factoring the latter position (what a mouthful!). It seems the game just likes to clip crap through the floor, such a bummer on that.

The collision system for objects likely doesn't communicate well with other objects. And honestly, that's somewhat okay, it's pretty difficult to properly handle collision like this. But with stacks on stacks of enemies, this is more noticeable. Enemies that I believe try to "fall" can end up kind of pushing each other down (?). I have not checked this code in particular simply because I am lazy.

I'm going to boldly assume this code is related. It looks a bit like a cheesy hack that just slows down collision with things collision. Falling might be related, or rather, anything that pushes itself down, might be causing this kind of behavior. Some enemies, I believe can actually stack correctly, however their walking velocity (correctly) accelerates along with things, which I always found funny (that should be a feature one day? :-)

tldr This is a bug dammit. But, its a little deeper than that, because it's kind of a flaw stacked on a bug, so I felt like talking about the aforementioned bug, just so it doesn't go unnoticed here. :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants