A lightweight JavaScript game engine inspired by Unity's Entity-Component architecture. Perfect for learning, prototyping, and building small-to-medium 2D games.
Powerful features that make game development simple and enjoyable
Unity-inspired ECS architecture for flexible and modular game object composition.
Canvas 2D, WebGL 2D, and Three.js 3D rendering pipelines for maximum flexibility.
Built-in 2D/3D physics with collision detection, rigidbodies, and realistic movement.
Comprehensive keyboard and mouse input handling with easy-to-use APIs.
Organize your game with scenes and seamlessly switch between levels.
Efficiently render 2D sprites and animated textures for dynamic visual effects.
Define complex character animations and behaviors with a flexible state machine.
The camera is now a full Entity (game object) in your scene, allowing for more flexible controls and behaviors.
Small footprint, no dependencies (except Three.js for 3D), fast load times.
Install via npm or use CDN - your choice!
npm install kernelplay-js --save
<script type="importmap">
{
"imports": {
"kernelplay-js": "https://cdn.jsdelivr.net/npm/kernelplay-js@latest/dist/kernelplay.es.js"
}
}
</script>
import { Game, Scene, Entity } from "kernelplay-js";
import { TransformComponent, BoxRenderComponent } from "kernelplay-js";
class MyScene extends Scene {
init() {
const box = new Entity();
box.addComponent("transform", new TransformComponent({
position: { x: 300, y: 200 }
}));
box.addComponent("renderer", new BoxRenderComponent({color:"red"}));
this.addEntity(box);
}
}
class MyGame extends Game {
init() {
const scene = new MyScene("Main");
this.sceneManager.addScene(scene);
this.sceneManager.startScene("Main");
}
}
new MyGame({ width: 800, height: 600, fps: 60 }).start();
Join developers creating amazing games with KernelPlay.js