Overview
BetterModel’s per-player animation system allows you to show different animation states to different players for the same model instance. This is crucial for:- MMORPGs with player-specific cutscenes
- Individual quest progression animations
- Player-specific NPC interactions
- Custom emotes visible only to nearby players
- Conditional visual effects per player
How Per-Player Animations Work
Architecture
When you play a per-player animation:- The animation is tracked separately for each player
- Packets are sent individually to each player
- Other players continue to see the default animation
- The system manages packet bundlers per player UUID
Performance Characteristics
- Normal animation: 1 packet bundler for all viewers
- Per-player animation: N packet bundlers (one per viewer)
- Overhead: ~N times the network traffic
BetterModel optimizes per-player animations by:
- Using parallel packet bundlers
- Reference counting to detect when all per-player animations end
- Automatic cleanup when no per-player animations are active
Playing Per-Player Animations
Basic Per-Player Animation
Play an animation for a specific player:Multiple Players
Play the same animation for multiple specific players:Conditional Per-Player Animations
Show different animations based on player state:Per-Player Animation Events
Start Event
Detect when a per-player animation starts:End Event
Detect when a per-player animation ends:Event Use Cases
Stopping Per-Player Animations
Stop for Specific Player
Stop a per-player animation:Stop All Per-Player Animations
Stop all animations for all players:Advanced Per-Player Patterns
Quest Progression System
Show quest progress through animations:Player-Specific Emotes
Create emotes that only nearby players see:Stealth/Invisibility System
Show different models based on player abilities:Cinematic Cutscenes
Create player-specific cutscenes:Performance Optimization
Limit Per-Player Animation Count
Range-Based Per-Player Animations
Only show per-player animations to nearby players:Cleanup on Player Leave
Ensure per-player animations are cleaned up:Best Practices
Performance Guidelines:
- Use per-player animations sparingly (max 2-3 per player)
- Keep per-player animations short (< 5 seconds)
- Limit range to nearby players only
- Clean up finished animations promptly
- Monitor active per-player animation count
When to Use Per-Player Animations
Good use cases:- Quest progression indicators
- Player-specific cutscenes
- Conditional visual effects
- Temporary emotes
- Stealth/detection systems
- Permanent model states (use separate trackers)
- Continuous animations (use normal animations)
- Global effects (use normal animations)
- High-frequency updates (too much overhead)
Debugging Per-Player Animations
Logging Active Animations
Testing Per-Player Animations
Next Steps
Resource Pack Generation
Understand automatic resource pack creation
API Reference
Explore the complete API documentation
