Repository navigation
fix: correct hand grenade slide friction/deceleration - #91
Open
andrewcaluzzi wants to merge 1 commit into
Open
andrewcaluzzi wants to merge 1 commit into
andrewcaluzzi wants to merge 1 commit into
Conversation
A landed grenade's brake (unk94) is applied once per 60Hz field in objTick's slide loop, but each pass is also scaled by g_GlobalTimerDelta (the frame's delta). Higher frame rates and tick rates therefore get less braking per field, i.e. frame-dependent physics: grenades slide about 2.5x as far as the N64 at 60Hz and 5x at tickhz 120. The fix uses a fixed 3.0 instead (matching gunfire.c's PLAYER_LAUNCH_CADENCE), which is approximately what the N64 applied at 20fps. Demo playback keeps the original line so attract demos stay in sync. Fixes murkantor#90
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Goal
The goal of this PR is to resolve an issue with the engine's handling of hand grenade slide/deceleration at higher-than-N64 FPS counts. Issue #90 details the current state.
Description
A landed grenade's brake (unk94) is applied once per 60Hz field in objTick's slide loop, but each pass is also scaled by g_GlobalTimerDelta (the frame's delta). Higher frame rates and tick rates therefore get less braking per field, i.e. frame-dependent physics: grenades slide about 2.5x as far as the N64 at 60Hz and 5x at tickhz 120.
The fix uses a fixed 3.0 instead (matching gunfire.c's PLAYER_LAUNCH_CADENCE), which is approximately what the N64 applied at 20fps. Demo playback keeps the original line so attract demos stay in sync.
Fixes #90
Type of Change
Please delete options that are not relevant.
How Has This Been Tested?
Footage of control vs. fix
grenade-vanilla-vs-fix.mp4
Please describe every way you've tried to break the game. How did this not break other features the game has?
Thorough automated testing
Notes
unk64is clamped to 0.03–0.15.I also manually tested in various levels (Surface 1, Dam, Cradle) with all weapons/infinite ammo
Checklist