Skip to main content

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:
  1. The animation is tracked separately for each player
  2. Packets are sent individually to each player
  3. Other players continue to see the default animation
  4. The system manages packet bundlers per player UUID
Per-player animations increase network overhead and CPU usage. Use them only when necessary and for short durations.

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
Common Mistakes:
  • Playing per-player animations for all online players
  • Looping per-player animations indefinitely
  • Not cleaning up on player disconnect
  • Creating new AnimationModifier instances every tick
  • Using per-player animations for permanent state changes

When to Use Per-Player Animations

Good use cases:
  • Quest progression indicators
  • Player-specific cutscenes
  • Conditional visual effects
  • Temporary emotes
  • Stealth/detection systems
Bad use cases:
  • 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