DEV Community

njoyedu
njoyedu

Posted on

KernelPlay-JS v0.5.0 Is Here: A New Unified Input System for JavaScript Games

๐Ÿš€ KernelPlay-JS v0.5.0 is now released!

This release is a pretty important milestone for the project. Weโ€™ve been working on improving how games handle input, and v0.5.0 introduces a new Unified Input Manager for keyboard, mouse, gamepad, and touch input.

The idea is simple: game code shouldnโ€™t need to care where an input came from.

๐ŸŽฎ One API for Game Input

With the new Input API, common gameplay code can stay clean and device-independent:

import { Input } from "kernelplay-js";

update(dt) {
    const x = Input.getAxis("horizontal");
    const y = Input.getAxis("vertical");

    this.rb.addForce(800 * x, 800 * y);

    if (Input.wasPressed("jump")) {
        this.jump();
    }

    if (Input.isPressed("attack")) {
        this.attack();
    }
}
Enter fullscreen mode Exit fullscreen mode

Instead of checking individual keyboard keys, mouse buttons, gamepad buttons, or touch events throughout your game code, you can work with actions and axes.

That makes gameplay systems much easier to maintain.

โš™๏ธ Two Ways to Configure Input

v0.5.0 supports both programmatic input registration and declarative JSON configuration.

For code-driven projects:

Input.registerAction("shoot", {
    keys: [KeyCode.Z, KeyCode.X],
    buttons: [GamepadButton.X, GamepadButton.RB]
});
Enter fullscreen mode Exit fullscreen mode

For projects that need external configuration or runtime rebinding:

{
    "actions": {
        "jump": {
            "keys": ["Space", "ArrowUp"],
            "buttons": ["A", "B"]
        },
        "go": {
            "keys": ["x", "z"],
            "buttons": ["DPadRight"]
        }
    }
}
Enter fullscreen mode Exit fullscreen mode

This gives developers more flexibility when building configurable control schemes, key-binding systems, or different control profiles.

๐Ÿ•น๏ธ Why This Matters

Input handling is one of those systems that can start simple and quickly become messy as a game grows.

You might begin with:

if (keyboard.isDown("ArrowRight")) {
    // move
}
Enter fullscreen mode Exit fullscreen mode

Then later you need keyboard support, controllers, touch controls, remapping, multiple control schemes, and so on.

The Unified Input Manager provides a common layer between those devices and your gameplay code.

The goal is to let gameplay systems think in terms of actions like jump, attack, and move, rather than individual physical inputs.

๐Ÿ“ฆ KernelPlay-JS v0.5.0

This release is part of the v0.5.x development cycle, and there is still plenty to improve.

Some areas Iโ€™m interested in exploring next include better runtime rebinding, controller support improvements, input profiles, and additional input configuration options.

If you're building games with JavaScript, I'd really appreciate feedback on the API and the overall direction of the input system.

โญ Repository: https://github.com/Soubhik1000/kernelplay

๐Ÿ“– Documentation: https://github.com/Soubhik1000/kernelplay/blob/master/README.md

Give it a try, break something, tell me what feels wrong, and let me know what you'd like to see in the next v0.5.x release!

Thanks to everyone following the project so far. Thereโ€™s still a lot to build, but KernelPlay-JS is moving forward one system at a time. ๐Ÿš€

Top comments (1)

Collapse
 
njoyedu_5aa7ae2488212cb8a profile image
njoyedu

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:

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.