-
-
Notifications
You must be signed in to change notification settings - Fork 491
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
Smooth badguy and other object motion when frame prediction is on #3044
Conversation
I'm gonna test this in a few. |
"A few" turned out to take a little longer. However, seems like it looks good. 👍 |
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.
Didn't test, but code looks good.
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.
Tested.
This commit extrapolates the drawn position for badguys and some other moving objects, making their motion look smoother when both the frame rate is high and frame prediction is on. This is already being done for Tux, but that is not enough to always produce the illusion of smooth motion. Without this commit one can at high frame rates see choppy motion on carried objects when Tux is running, and on quickly moving badguys, like MrIceBlock.
d4c8d4b
to
4231287
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.
Does this work with the tarantula? When I was writing the code for that I had to pull off some stinky tricks and as a result I don't think it uses velocity properly?
Also, you say "when frame prediction is on" but you don't check for this setting anywhere in this PR.
It looks fine to me, when I test it at 165Hz. (It's possible the velocity values are a bit off, but if so they aren't wrong enough to be noticeable for me.) (Note: looking at the code, the tarantula position is extrapolated via
The distances that drawing positions are extrapolated are proportional to |
@mstoeckl What do you think about implementing this, but for scripted objects? (Not related to this pr). |
Doing position extrapolation for ScriptedObjects is very low priority for me, as AFAIK they are rare and only seen moving in certain cutscenes. Also, they use MovingSprite's ::draw implementation, and could in theory be handled in a more general fashion. The next most important things to update (which I may or may not get to myself) are probably:
|
This commit extrapolates the drawn position for badguys and some other moving objects, making their motion look smoother when both the frame rate is high and frame prediction is on. This is already being done for Tux, but that is not enough to always produce the illusion of smooth motion. Without this commit one can at high frame rates see choppy motion on carried objects when Tux is running, and on quickly moving badguys, like a sliding MrIceBlock.