Skylanders: Fix infinite fall softlock at high FPS #639
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes one of the issues caused by higher framerates in the Skylanders saga: #615.
The reason why the character was respawning during long falls is because of a failsafe meant in case your character is stuck falling between geometry.
The game determines whether you are stuck with a simple method: it calculates the squared distance of your character from the position of the previous frame, then checks whether it's lower than 20². If that's true for 3 seconds, then it teleports you.
But if the framerate is higher, your distance is going to be lower than normal, and the game will consider you stuck even when falling at top speed.
Ironic...
The fix simply consists in overriding the load of 20.0, and load
20×30FPS/targetFPS
instead.(Ideally you would multiply by
deltaTime
instead of dividing bytargetFPS
, but since it's not already loaded in a register in that part, not bothering.)Before:
before.mp4
After:
after.mp4
Credits:
This is currently a draft, as this is only one version of one game, so not worth merging now. More games and versions will be added later.
I'm leaving this for documentation and for reference.
Other things for reference:
updateStuckFallingCheck
.