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
Fix glitch through celiing with Sneak Glitch #14332
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally OK but there's too many lines that show up as modified even though they weren't.
c886fa7
to
4d9db9e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for splitting the code. I like where this is going so far.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sneak code performance measurement (code: see below)
master
- sneak: 27.3 us
- no sneak: 24.7 us
PR:
- sneak: 73.5 us
- no sneak: 25.9 us
Bug 1:
- hold sneak until further notice
- hold the forward key. collide horizontally with a node
- try to jump - at some chance you can't.
- release forward key. still cannot jump
This seems to work better when being further away from spawn (e.g. 10000,10,10000)
Code for the performance measurement:
diff --git a/src/client/localplayer.cpp b/src/client/localplayer.cpp
index 1470d819a..7c122825b 100644
--- a/src/client/localplayer.cpp
+++ b/src/client/localplayer.cpp
@@ -27,6 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "map.h"
#include "client.h"
#include "content_cao.h"
+#include "profiler.h"
/*
LocalPlayer
@@ -202,6 +203,8 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
return;
}
+ TimeTaker tt("", nullptr, TimePrecision::PRECISION_MICRO);
+
PlayerSettings &player_settings = getPlayerSettings();
// Skip collision detection if noclip mode is used
@@ -494,6 +497,7 @@ void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d,
// Autojump
handleAutojump(dtime, env, result, initial_position, initial_speed, pos_max_d);
+ g_profiler->avg("Client: sneak [us]", tt.stop());
}
void LocalPlayer::move(f32 dtime, Environment *env, f32 pos_max_d)
@grorp What kind of change is needed now? |
SmallJoker reported a bug in #14332 (review) on Feb 28, which has not been fixed as far as I can see. |
The bug reported by @SmallJoker should be fixed now. I am not able to reproduce the original glitch. Hopefully due to the new collision detection logic. So, more testing that the glitch cannot be reproduced is welcome. |
Windows build failed due to:
|
Also, please take a look at the Code style guidelines and adjust newly written code accordingly. (The old code you've only moved can stay as is, that makes reviewing easier.) |
Checked. Hopefully, I do not miss something. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whereas this PR technically does what it promises, it does break the sneak glitch slightly.
- Stand in front of the pillar from the video in the main PR post
- Hold down forward key
- Hold down the sneak key
- Hold down the jump key and sneak-move up by a few steps
- Release the jump key
- master: player stops at the ledge (minus the sideway movement due to still holding forward)
- PR: falls down
Sometimes this also happens when not moving forward but I found it to be easiest to reproduce this way.
@SmallJoker |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO having header comments for obvious things in a small function like collision_check_intersection
is unnecessary.
Also, please clean up the ScopeProfiler
s and TimeTakers
you copied from collisionMoveSimple
which have since been removed by 2e89529
Review is not comprehensive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The recently mentioned sneak issue is now solved
Collision still works properly. Tested by colliding with a mob_horse
entity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
(trivially rebased after #14654) |
Fix jump-related bugs.
Check if there is free space for a jump if sneak_glitch is applied and if the player is not in a collision when the normal jump will happen.
Fix Can glitch through ceiling with Sneak Glitch #11081
To do
This PR is a Ready for Review.
How to test
See #11081.
before:
simplescreenrecorder-2024-02-01_16.11.13.mp4
after;
simplescreenrecorder-2024-02-01_16.07.50.mp4