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

photon-engine

v1.0.1

Published

Lightweight 2D game engine with ECS architecture

Readme

photon-engine

Lightweight 2D game engine with an Archetype-based ECS architecture, WebGL2 renderer, and platform-independent core.

License: MIT npm

Install

npm install photon-engine

Quick Start

<!-- index.html -->
<canvas id="photon-canvas"></canvas>
<script type="module" src="./main.js"></script>
import { Engine, Scene, Transform2D, Camera2D, Sprite } from "photon-engine";

class MyScene extends Scene {
  readonly name = "my-scene";

  onEnter() {
    const cam = this.world.createEntity();
    this.world.addComponent(cam.id, new Transform2D());
    this.world.addComponent(cam.id, new Camera2D());

    const player = this.world.createEntity();
    const pos = new Transform2D();
    pos.x = 100;
    pos.y = 100;
    this.world.addComponent(player.id, pos);
    this.world.addComponent(player.id, new Sprite(1, 0, 0, 1, 32, 32));
  }

  onUpdate(_dt: number) {}

  onExit() {
    this.world.clear();
  }
}

const engine = new Engine({ canvasId: "photon-canvas" });
engine.sceneManager.register(new MyScene());
engine.sceneManager.switchTo("my-scene");
engine.start();

Features

| Module | Description | |--------|-------------| | ECS | World, Entity, Component, System with Archetype-based queries | | Scene | Scene / SceneManager — scene switching with entity migration | | View | Camera2D — zoom, rotation, screen-to-world transform | | Renderer | Renderer — batched WebGL2 quad renderer with sprite support | | Input | InputManager — keyboard & mouse with pressed/released tracking | | Event | EventBus — typed pub/sub event system | | Math | Vec2, Mat3, Rect, Transform | | FileSystem | IFileSystem / BrowserFileSystem — injectable FS interface | | Bridge | INativeBridge / NullNativeBridge — platform adapter interface |

Platform Adapters

The core has zero native dependencies and runs in any browser. Inject adapters at construction:

// Browser (default)
const engine = new Engine({ canvasId: "photon-canvas" });

// Electron desktop
import { ElectronNativeBridge } from "photon-engine-electron";
const engine = new Engine({ nativeBridge: new ElectronNativeBridge() });

API

Engine

new Engine(config?: EngineConfig)

interface EngineConfig {
  canvasId?: string;     // default: "photon-canvas"
  width?: number;
  height?: number;
  fs?: IFileSystem;
  nativeBridge?: INativeBridge;
}

engine.start()
engine.stop()
engine.destroy()
engine.sceneManager  // SceneManager
engine.renderer      // Renderer
engine.input         // InputManager
engine.eventBus      // EventBus
engine.fs            // IFileSystem

ECS

const world = new World();
const entity = world.createEntity();
world.addComponent(entity.id, new Transform2D());
const results = world.query("transform2d", "sprite"); // Archetype[]
world.removeEntity(entity.id);
world.clear();

Repository

https://github.com/bssm-oss/Ion

License

MIT