Implement layered animation system for players and NPCs #9

Open
opened 2026-03-17 00:51:01 +00:00 by kit · 1 comment
Owner

Players and NPCs in Source engine use a layered animation system where multiple animation sequences are blended together to create semi-dynamic movement — e.g., a walk cycle on the base layer with an upper-body gesture on top.

What needs to happen

Server side

  • Stream the active animation layers per entity: sequence index, cycle (progress), weight, playback rate
  • Source engine supports up to ~15 animation layers per entity — we need at least the first few
  • Bone transforms may need to be sent for entities using complex rigs (ragdolls, procedural bones)

Client side

  • MDL sequence parser: read animation data from .mdl/.ani files (bone transforms per frame)
  • Skeleton evaluation: given a set of weighted layers, blend bone transforms
  • Skinned mesh rendering: apply bone transforms to vertices via bone weights (already in .vvd data)
  • Interpolate animation cycles between ticks for smooth playback

Animation blending

  • Base layer: movement sequences (idle, walk, run)
  • Overlay layers: gestures, aiming, reloading — blended on top with per-bone masks
  • Layer weights control blend amount (0 = base only, 1 = full overlay)

Relates to

  • #5 (asset rendering — covers the MDL parsing foundation)
  • #2 (interpolation — animation cycles need smooth interpolation too)
Players and NPCs in Source engine use a layered animation system where multiple animation sequences are blended together to create semi-dynamic movement — e.g., a walk cycle on the base layer with an upper-body gesture on top. ## What needs to happen ### Server side - Stream the active animation layers per entity: sequence index, cycle (progress), weight, playback rate - Source engine supports up to ~15 animation layers per entity — we need at least the first few - Bone transforms may need to be sent for entities using complex rigs (ragdolls, procedural bones) ### Client side - MDL sequence parser: read animation data from `.mdl`/`.ani` files (bone transforms per frame) - Skeleton evaluation: given a set of weighted layers, blend bone transforms - Skinned mesh rendering: apply bone transforms to vertices via bone weights (already in `.vvd` data) - Interpolate animation cycles between ticks for smooth playback ### Animation blending - Base layer: movement sequences (idle, walk, run) - Overlay layers: gestures, aiming, reloading — blended on top with per-bone masks - Layer weights control blend amount (0 = base only, 1 = full overlay) ## Relates to - #5 (asset rendering — covers the MDL parsing foundation) - #2 (interpolation — animation cycles need smooth interpolation too)
Author
Owner

Part of the broader asset rendering effort in #5.

Related: #16 (position/rotation offsets) — some entity offset issues may be caused by missing bone/attachment transforms that the animation system would provide. Once this is in place, re-check #16 to see if some cases resolve.

Part of the broader asset rendering effort in #5. Related: #16 (position/rotation offsets) — some entity offset issues may be caused by missing bone/attachment transforms that the animation system would provide. Once this is in place, re-check #16 to see if some cases resolve.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kit/gmod-web-stream#9
No description provided.