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

Mostly working Surf #36

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Mostly working Surf #36

wants to merge 6 commits into from

Conversation

Zrocket
Copy link
Contributor

@Zrocket Zrocket commented Jan 18, 2024

I think I finally figured it out. Your choice to subtract toi from the Y velocity only at ground tick 1 was messing with later gravity calculations. From my testing, subtracting it every time doesn't seem to hamper bunny hopping acceleration, but let me know if there's a problem.

There are still some very minor details that make surfing here technically different to source engine surfing (e.g. holding forward doesn't pull you down), but I'd say it's pretty close.

@Zrocket
Copy link
Contributor Author

Zrocket commented Jan 19, 2024

Having given this some thought, this is probably still a naive solution, but it does help me narrow things down. From what I can tell, having debugged and stepped though the execution, the problem is still related to the gravity calculation:

$g = gravity \cdot g_e$

Considering we only care about the player entity, the entity gravity variable $g_e$ doesn't concern us. And you do calculate gravity in relation to deltatime. This leads me to believe that our problem might rest with how player movement physics in Half-Life is calculated via the virtual frame rate:

$f_p = \tau_p^{-1}$

Where $\tau_p$ is player frame rate, and $f_p$ is the resulting virtual frame rate used for calculations.

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

Successfully merging this pull request may close these issues.

1 participant