← Back to archive

Repo of the Day

Soubhik1000/kernelplay: A lightweight JavaScript game core library for building games and engines.

Published: Aug 30, 2026

Open repository ↗

A lightweight JavaScript game core library for building games and engines. - Soubhik1000/kernelplay

Summary

KernelPlayJS is a 2D/3D JavaScript game engine that runs in the browser and uses an Entity-Component-Script architecture modeled on Unity's ECS pattern. The library includes three swappable renderer backends (Canvas 2D, Pixi.js, Three.js) and ships with built-in systems for input handling, UI overlays, audio, animation, physics, and object pooling. It is currently at v0.5.1-beta, and the README states it is MIT-licensed.

What it is useful for

KernelPlayJS fits projects that need a browser-native game engine without the overhead of a full framework. The ECS pattern separates data (components like TransformComponent, Rigidbody2DComponent, BoxRenderComponent) from behavior (script classes with onStart and update(dt)), which keeps player, enemy, and projectile logic from tangling together.

The swappable renderer backends are useful when you want to prototype with Canvas 2D and later move to GPU-accelerated Pixi.js or full 3D via Three.js without rewriting gameplay code. Cross-device input is handled by the v0.5.0 unified Input API, which maps keyboard, gamepad, and touch to named actions like jump, attack, dash, and axes like horizontal/vertical, with priority order Gamepad → Touch → Keyboard. For UI, the v0.4.0 system provides panels, buttons, sliders, progress bars, checkboxes, and a layered HUD/Menu/Overlay system, all themeable from game.ui.theme. The AudioSource component adds spatial audio that follows entities, useful for ambient effects and enemy sounds.

How engineers can use it

Installation is documented as npm install kernelplay-js, with optional @kernelplay/pixi-renderer and @kernelplay/three-renderer packages for the non-Canvas backends, plus a CDN import map for quick experiments.

A minimal game creates a Game with {width, height, fps}, attaches a CameraComponent to a camera entity, and adds box entities with TransformComponent, BoxRenderComponent, and a ScriptComponent. The README's procedural quick start shows a red box moved with WASD or arrow keys via Keyboard.isPressed(KeyCode.W). An instantiated variant extends Game and Scene classes for cleaner organization in larger projects.

In a real game, Input.getAxis("horizontal") and Input.wasPressed("jump") replace device-specific code. HUD elements are added with game.ui.add(new UIProgressBar({...})) and updated each frame. Audio clips are preloaded with await game.audio.loadAll([...]) in a scene's init() to avoid first-play latency, then triggered with playOneShot or playLoop.

Documented limitations: this is a v0.5.1-beta pre-1.0 release, so APIs may change. The GitHub repository's license field is NOASSERTION even though the README says MIT—worth verifying before production use.