Repository navigation
Conversation
The view is drawn between the last two movement ticks, but the bob cycle and the velocity were still read from the newest tick alone. The view's bob, its lean and the sway of the gun in the hand follow those, so they stood still on the frames between two ticks and jumped on the next: at com_maxfps 125 on a 165 Hz screen every fourth picture showed the gun where it was while the eye moved on. Each tick now keeps its bob cycle and velocity beside its origin, and the view takes all three at the frame's moment between the ticks. CG_SetViewBob holds the one copy of the bob's formula, for a player state and for that moment. Two rules of movement show in a drawn cycle and are handled here, in drawing only: - A landing and a stop start the cycle again, and the same tick may advance it, so a landing at a run ends at 3, not 0. A cycle runs forward at most 0.5 a msec, so a longer step is a restart (CG_BobStep) and is shown as it is, as before. Read as a step it would sweep the gun through half a cycle. - The cycle advances only on the ground. Sliding across a tilted street the player is off it for a tick or two at a time, and the sway ran on one tick in three. The drawn cycle carries on at the rate it last ran through an airborne moment of up to 32 msec (CG_CarryViewBob). A jump is longer and holds the bob. Views that are not predicted (a demo, a followed player, an engine without the call) are unchanged, and so are the player state, its footsteps and movement. Cost: a few operations a tick and one more sin and sqrt a frame. Measured on a circle run without vsync, 330 pictures a second, as how far each frame's rate of change is from its neighbours': the eye's height 199 % before and 17 % after, the gun's yaw against the view 187 % before and 18 % after, over the same 13 degrees of sway. In recorded play on urban's tilted streets and through strafe jumps the gun no longer moves in bursts or flips after a landing. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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.
What was wrong
The view is drawn between the last two movement ticks, so it turns and moves on every frame. The bob cycle and the
velocity were still read from the newest tick alone. The view's bob, its lean and the sway of the gun in the hand follow
those two, so they stood still on the frames between two ticks and jumped on the next. At
com_maxfps 125on a 165 Hzscreen every fourth picture showed the gun where it was while the eye had moved on.
What changed
Only
code/cgame(cg_local.h,cg_predict.c,cg_view.c). No game, server or network code.between the two ticks.
CG_SetViewBobholds the one copy of the bob's formula.A cycle runs forward at most 0.5 a msec, so a longer step is a restart (
CG_BobStep) and is shown as it is, as before.time, and the sway ran on about one tick in three. The drawn cycle carries on at the rate it last ran through an
airborne moment of up to 32 msec (
CG_CarryViewBob). A jump is longer and holds the bob, as before.Views that are not predicted (a demo, a followed player, an engine without the call) are unchanged, and so are the
player state, its footsteps and movement.
Cost
A few operations a tick and one more
sinandsqrta frame.Proof
from its neighbours': the eye's height 199 % before and 17 % after, the gun's yaw against the view 187 % before and
18 % after, over the same 13 degrees of sway.
on every tick. Through strafe jumps the gun shows the landing's restart once and no longer flips after it.
🤖 Generated with Claude Code