r/javascript • u/APTman1010 • 3h ago
KernelPlay JS v0.6.1 β Introducing the Time System!
github.comI'm excited to share another update to KernelPlay JS!
KernelPlay JS v0.6.1 introduces a dedicated Time System, giving developers more control over game timing, frame updates, and gameplay speed.
What's new?
The Time System provides several useful properties:
Time.deltaTimeβ Scaled delta time. Becomes 0 when the game is paused.Time.unscaledDeltaTimeβ Raw delta time, which continues advancing regardless of time scale.Time.fixedDeltaTimeβ Base fixed-step interval in seconds.Time.timeβ Total scaled elapsed time.Time.unscaledTimeβ Total unscaled elapsed time.Time.timeScaleβ Controls the speed of gameplay.Time.fpsβ Current frames per second.
Time Scale Control
You can now control gameplay speed directly through the Game instance:
game.; // Slow motion
game.; // Pause gameplay/physics
game.; // Normal speed
For example:
1.0= Normal speed0.25= Slow motion0= Paused
The distinction between scaled and unscaled time is especially useful when creating pause menus, slow-motion effects, and gameplay systems that need to keep running independently of the game time scale.
This is another step toward making KernelPlay JS a more complete and flexible game development framework.
More improvements are coming!
What would you build with the new Time System?