Skip to main content
Understanding Multisynq’s time system is crucial for building applications with animations, timers, and time-dependent behaviors. Unlike real-world time, Multisynq uses simulation time to ensure perfect synchronization across all users.

Simulation Time vs Real Time

Synchronized, deterministic time used by models
  • Source: Multisynq reflector heartbeat ticks
  • Synchronization: Identical across all users
  • Deterministic: Same time, same results
  • Access: this.now() in models
Simulation time only advances when heartbeat ticks are received from the reflector.

Core Time Concepts

📐 Simulation Time

Time since session began
  • Measured in milliseconds
  • Starts at 0 when session begins
  • Identical for all users
  • Only advances with reflector heartbeats

💓 Heartbeat Ticks

Synchronization mechanism
  • Sent by reflector to all users
  • Advances simulation time
  • Ensures synchronized execution
  • Typically ~60-120Hz

The future() Method

future() is Multisynq’s scheduling mechanism for time-based behaviors.
Schedule a method to run in the future
  • delay: Milliseconds to wait (can be fractional)
  • methodName: Method to call when delay expires
  • args: Optional arguments to pass

Common Patterns

Classic game update pattern
Countdown timers and delayed actions
Smooth object animations

Views and Time

Views use real time, not simulation time!
Views can use future() with real time

Timing Best Practices

⚡ Performance

Optimize timing frequency

🎯 Precision

Use appropriate timing precision

Debugging Time Issues

Debug timing problems

Common Pitfalls

Avoid these timing mistakes:

Next Steps

Events & Pub-Sub

Learn how events work with time-based systems

Writing a Multisynq Model

Master model development with proper timing

View Smoothing

Create smooth animations between model updates

Random

Understand synchronized random number generation
Mastering simulation time and the future() method is essential for creating responsive, synchronized applications. Always use simulation time in models and real time in views to maintain perfect synchronization across all users.