Skip to content

Improve demo delag interpolation and sampling#101

Merged
alcachofass merged 1 commit into
alcachofass:mainfrom
br33zy59:fix-demo-delag-interpolation
Jul 21, 2026
Merged

Improve demo delag interpolation and sampling#101
alcachofass merged 1 commit into
alcachofass:mainfrom
br33zy59:fix-demo-delag-interpolation

Conversation

@br33zy59

Copy link
Copy Markdown
Collaborator

While watching some demos, I noticed interpolation, although implemented for demo de-lagging, didn't always get applied. Opponents were shown making stepped movements, and not being interpolated between frames as they should be.

The core problem was the interpolation pathways that had been implemented were consistently being invalidated. So I replaced clamped endpoint handling with continuous interpolation and add robust pose sampling for demo delag:

  • Removed demoDelagDisplayServerTime.
  • entityPoseFromBracket: always evaluate both endpoint trajectories at their snapshot times, clamp frac to [0,1], and lerp positions/angles so frac==0/1 remain continuous with the open interval; choose solid based on frac.
  • Added demoDelagSamplePoseAtTime: prefer live snap↔nextSnap sampling, fall back to history bracket/envelope, and clamp lookups past newest history.
  • Updated CG_DemoHistory_AdjustPlayerLerpForDemoDelag and CG_DemoHistory_AdjustMissileLerpForDemoDelag to rewind endpoints by ping and interpolate using cg.frameInterpolation, with sensible fallbacks and caching.

Result: smoother, continuous motion during demo delag and fewer snapping artifacts.

Replace clamped endpoint handling with continuous interpolation and add robust pose sampling for demo delag.

- Removed demoDelagDisplayServerTime.
- entityPoseFromBracket: always evaluate both endpoint trajectories at their snapshot times, clamp frac to [0,1], and lerp positions/angles so frac==0/1 remain continuous with the open interval; choose solid based on frac.
- Added demoDelagSamplePoseAtTime: prefer live snap↔nextSnap sampling, fall back to history bracket/envelope, and clamp lookups past newest history.
- Updated CG_DemoHistory_AdjustPlayerLerpForDemoDelag and CG_DemoHistory_AdjustMissileLerpForDemoDelag to rewind endpoints by ping and interpolate using cg.frameInterpolation, with sensible fallbacks and caching.

Result: smoother, continuous motion during demo delag and fewer snapping artifacts.
@alcachofass
alcachofass merged commit 414c322 into alcachofass:main Jul 21, 2026
1 check passed
@br33zy59
br33zy59 deleted the fix-demo-delag-interpolation branch July 22, 2026 00:54
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.

2 participants