Skip to content

Use bounded client aim origin for terrain validation#122

Merged
ogyrec-o merged 1 commit into
mainfrom
fix/issue-386-bounded-client-aim-origin
May 27, 2026
Merged

Use bounded client aim origin for terrain validation#122
ogyrec-o merged 1 commit into
mainfrom
fix/issue-386-bounded-client-aim-origin

Conversation

@ogyrec-o

Copy link
Copy Markdown
Member

Summary

Uses the client-sampled ray origin for terrain interaction traversal only when it is close to the server-authoritative interaction origin.

Why

frevenengine/freven-engine#386 rapid LMB smoke still had a rare rollback after #120:

  • FaceMismatch was fixed.
  • Most rapid break actions commit.
  • A rare break could still be rejected with Occluded.

#121 and frevenengine/freven-vanilla#91 exposed the exact trace: the client requested one target block, while the server ray from a slightly different interaction origin hit the adjacent block first. The observed drift was normal movement/input sampling drift, not previous-action ordering.

For modern client/server interaction, the server should not blindly trust arbitrary client ray origins, but it also should not validate aiming from a later/different pose when the client-provided aim origin is close to the authoritative origin. This PR makes that contract explicit and bounded.

What changed

  • Adds max_client_ray_origin_delta_m to TerrainInteractionValidationPolicyV2.
  • Uses intent.ray.ray_origin_m for DDA traversal only when it is within that bound of authoritative_interaction_origin.
  • Falls back to authoritative_interaction_origin when the client origin is too far away.
  • Keeps Occluded strict: if the bounded trace hits a different block first, validation still rejects.
  • Adds regression coverage for the exact near-edge drift class observed in frevenengine/freven-engine#386.

Boundaries

  • no Vanilla source changes
  • no engine source changes
  • no Boot changes
  • no protocol changes
  • no unbounded client raycast trust
  • no server authority weakening
  • no client prediction as authority
  • place face/contact validation remains strict

Validation

  • cargo +stable fmt --all -- --check
  • cargo +stable test --locked -p freven_block_api terrain_interaction
  • cargo +stable test --locked --workspace
  • cargo +stable clippy --locked --workspace --all-targets -- -D warnings
  • git --no-pager diff --check

Related:

@ogyrec-o ogyrec-o self-assigned this May 27, 2026
@ogyrec-o ogyrec-o merged commit 9c7e38d into main May 27, 2026
1 check passed
@ogyrec-o ogyrec-o deleted the fix/issue-386-bounded-client-aim-origin branch May 27, 2026 17:17
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