r/javascript • • 22m ago

KernelPlay JS v0.6.1 — Introducing the Time System!

https://github.com/Soubhik1000/kernelplay

I'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.setTimeScale(0.25); // Slow motion
game.setTimeScale(0);    // Pause gameplay/physics
game.setTimeScale(1);    // Normal speed

For example:

  • 1.0 = Normal speed
  • 0.25 = Slow motion
  • 0 = 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?

1 Upvotes

2 comments sorted by

•

u/APTman1010 21m ago

Thanks for checking out KernelPlay-JS!

If you're interested in following development, testing upcoming features, or sharing feedback, feel free to join the community on Discord:

https://discord.gg/bHfe96EnNR

Everyone is welcome, whether you're a game developer, JavaScript enthusiast, or just curious about the project. I'd love to hear your suggestions and ideas as KernelPlay-JS continues to grow.

•

u/Opposite_Sector2145 15m ago

Watch out for logic tied to Time.deltaTime that you actually want running during pause, like UI animations or network polling. If you use deltaTime for those, they'll freeze when timeScale is zero, so use unscaledDeltaTime instead.