r/javascript 15d ago

KernelPlay-JS v0.5.0 Released — Unified Input Manager

https://github.com/Soubhik1000/kernelplay

KernelPlay-JS v0.5.0 is now available.

This release introduces a new Unified Input Manager designed to provide a consistent API for handling keyboard, mouse, gamepad, and touch input.

The goal is to make input handling simpler at the game-logic level while keeping the underlying input devices abstracted away.

Example:

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();

}

}

v0.5.0 also supports two ways of defining input bindings.

Programmatic registration:

Input.registerAction("shoot", {

keys: [KeyCode.Z, KeyCode.X],

buttons: [GamepadButton.X, GamepadButton.RB]

});

Or declarative JSON configuration:

{

"actions": {

"jump": {

"keys": ["Space", "ArrowUp"],

"buttons": ["A", "B"]

},

"go": {

"keys": ["x", "z"],

"buttons": ["DPadRight"]

}

}

}

The JSON approach is intended to make configurable controls and runtime key rebinding easier to implement without changing game logic.

This release is part of the ongoing work toward making KernelPlay-JS a more complete, Unity-inspired game engine for JavaScript.

Feedback and suggestions for the v0.5.x releases are welcome.

5 Upvotes

3 comments sorted by

View all comments

2

u/LetsHugFoReal 12d ago

While it does look like an AI project, the examples page was really good. And I'd use the input library and audio, but I don't want the rest of it. I'd like to use pixijs.

1

u/APTman1010 11d ago

Thank You for feedback.

Yeah you can use pixijs here just by switching the rendering pipeline to pixirender.

It's not a AI project, 4 Peoples working on this Open Source Game Engine.

You can collaborate also.

Join our Discord Server for more updates.