npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@kernelplay/three-renderer

v0.1.0

Published

A lightweight JavaScript 2D game engine inspired by Unity’s component system.

Downloads

116

Readme

@kernelplay/three-renderer

Professional 3D renderer for KernelPlayJS using Three.js.

Version: 0.1.0-alpha | Requires: kernelplay-js@^0.2.0, three@^0.158.0


🎮 Why Three.js Renderer?

  • Full 3D Support - Real 3D game development with WebGL
  • Advanced Lighting - Point, directional, ambient, spot lights
  • Materials & Shaders - PBR materials, custom shaders
  • 3D Physics - AABB collision detection in 3D space
  • Scene Helpers - Cameras, fog, shadows, post-processing
  • Industry Standard - Battle-tested 3D library

Use Cases: First-person games, 3D platformers, racing games, architectural visualization.


📦 Installation

npm install @kernelplay/three-renderer three kernelplay-js

Or use CDN:

<script type="importmap">
{
  "imports": {
    "three": "https://cdn.jsdelivr.net/npm/[email protected]/build/three.module.js",
    "three/addons/": "https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/",
    "kernelplay-js": "https://cdn.jsdelivr.net/npm/kernelplay-js/dist/kernelplay.es.js",
    "@kernelplay/three-renderer": "https://cdn.jsdelivr.net/npm/@kernelplay/three-renderer/dist/three-renderer.es.js"
  }
}
</script>

🚀 Quick Start

import { Game } from "kernelplay-js";
import { ThreeRenderer } from "@kernelplay/three-renderer";
import { MyScene } from "./scenes/MyScene.js";

const game = new Game({
  renderer: new ThreeRenderer(),
  width: 800,
  height: 600,
  backgroundColor: "#87CEEB"
});

game.sceneManager.addScene(new MyScene("Main"));
game.sceneManager.startScene("Main");
game.start();

🎨 Core Components

MeshComponent

Add 3D meshes to entities.

import { Entity, TransformComponent } from "kernelplay-js";
import { MeshComponent } from "@kernelplay/three-renderer";
import * as THREE from "three";

const cube = new Entity("Cube");

cube.addComponent("transform", new TransformComponent({
  position: { x: 0, y: 1, z: 0 },
  rotation: { x: 0, y: 0, z: 0 },
  scale: { x: 1, y: 1, z: 1 }
}));

// Create Three.js mesh
const geometry = new THREE.BoxGeometry(1, 1, 1);
const material = new THREE.MeshStandardMaterial({ 
  color: 0x00ff00,
  metalness: 0.5,
  roughness: 0.5
});
const mesh = new THREE.Mesh(geometry, material);

cube.addComponent("mesh", new MeshComponent(mesh));

scene.addEntity(cube);

BoxCollider3D

3D AABB collision detection.

import { BoxCollider3D } from "@kernelplay/three-renderer";

entity.addComponent("collider3D", new BoxCollider3D({
  isTrigger: false
}));

Rigidbody3D

3D physics (gravity, velocity, forces).

import { RigidbodyComponent } from "kernelplay-js";

entity.addComponent("rigidbody", new RigidbodyComponent({
  mass: 1,
  gravityScale: 1,
  useGravity: true,
  drag: 0.1
}));

🎮 Complete Example

3D Player Prefab

import { Entity, TransformComponent, Rigidbody3DComponent } from "kernelplay-js";
import { MeshComponent, BoxCollider3D } from "@kernelplay/three-renderer";
import { PlayerController3D } from "../scripts/PlayerController3D.js";
import * as THREE from "three";

export class Player3D extends Entity {
  constructor(x, y, z) {
    super("Player");
    this.tag = "player";

    this.addComponent("transform", new TransformComponent({
      position: { x, y, z },
      scale: { x: 0.5, y: 1, z: 0.5 }
    }));

    // Create capsule-like mesh
    const geometry = new THREE.CylinderGeometry(0.5, 0.5, 1, 8);
    const material = new THREE.MeshStandardMaterial({ 
      color: 0x00ff00 
    });
    const mesh = new THREE.Mesh(geometry, material);
    mesh.castShadow = true;

    this.addComponent("mesh", new MeshComponent(mesh));

    this.addComponent("rigidbody", new RigidbodyComponent({
      mass: 1,
      gravityScale: 2
    }));

    this.addComponent("collider3D", new BoxCollider3D());

    this.addComponent("controller", new PlayerController3D());
  }
}

Player Controller Script

import { ScriptComponent, Keyboard } from "kernelplay-js";

export class PlayerController3D extends ScriptComponent {
  onStart() {
    this.speed = 5;
    this.jumpForce = 10;
  }

  update(dt) {
    const rb = this.entity.getComponent("rigidbody");
    
    // Horizontal movement
    rb.velocity.x = 0;
    rb.velocity.z = 0;

    if (Keyboard.isDown("ArrowRight")) rb.velocity.x = this.speed;
    if (Keyboard.isDown("ArrowLeft")) rb.velocity.x = -this.speed;
    if (Keyboard.isDown("ArrowUp")) rb.velocity.z = -this.speed;
    if (Keyboard.isDown("ArrowDown")) rb.velocity.z = this.speed;

    // Jump
    if (Keyboard.wasPressed("Space") && rb.isGrounded) {
      rb.velocity.y = this.jumpForce;
    }
  }

  onCollision(other) {
    if (other.tag === "enemy") {
      console.log("Hit enemy!");
    }
  }
}

📚 Resources

  • Three.js Documentation: https://threejs.org/docs/
  • Three.js Examples: https://threejs.org/examples/
  • KernelPlayJS Docs: https://soubhik-rjs.github.io/kernelplay-js-demo/docs/

🤝 Contributing

See main CONTRIBUTING.md


📄 License

MIT License - Same as KernelPlayJS


🔗 Links

  • GitHub: https://github.com/Soubhik1000/kernelplay
  • NPM: https://www.npmjs.com/package/@kernelplay/three-renderer
  • Main Package: https://www.npmjs.com/package/kernelplay-js

@kernelplay/three-renderer - Professional 3D game development with Three.js 🎮