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

demeter-2d-engine

v0.1.3

Published

A web-first GPU accelerated 2D game engine and editor foundation.

Readme

Demeter 2D Engine

Demeter is a web-first 2D game engine and editor. It is built for creators who need a browser-based tool to make 2D games, not as a single game project.

Current Scope

  • Web studio interface
  • GPU-accelerated 2D viewport through WebGL2
  • Scene, layer, and object model
  • Rect, circle, and text objects
  • Object selection, dragging, duplication, deletion, and property editing
  • Automatic shape recognition and project-wide shape expansion
  • Undo and redo
  • Project save and load as JSON
  • Chunked project save and load for large scenes
  • Spatial index, collision layers, ECS data storage, sprite atlas helpers, static-layer cache, and worker-based logic helpers
  • Adaptive virtual-load shield with 10B primary, 50B reserve, and 100B insurance tiers
  • Runtime performance readout
  • Public browser API exposed as window.Demeter

Install

npm install demeter-2d-engine
import {
  DemeterEngine,
  createDefaultProject,
  createObject,
  createMillionObjectWorld,
  createTenBillionVirtualWorld,
  createFiftyBillionVirtualWorld,
  createHundredBillionVirtualWorld,
  createVirtualLoadShield,
  scaleProjectShapes,
  SpatialIndex,
  CollisionWorld,
  createDefaultECS,
  TextureAtlas
} from "demeter-2d-engine";

Run Locally

npm run dev

Open:

http://127.0.0.1:5176

Verify

npm run check

Renderer Load Test

Run the local server, then open:

http://127.0.0.1:5176/benchmarks/load-test.html

The load test measures visible 2D quad rendering in the browser GPU path and reports smooth and usable object-count limits for the current machine.

Latest local benchmark notes are in docs/BENCHMARK.md.

For the million-object logic target, open:

http://127.0.0.1:5176/benchmarks/million-logic-test.html

The current typed-array LogicWorld path has been measured with 1,000,000 lightweight logic objects, quality 100%, and 60 FPS target passing on the local benchmark machine.

For the 10-billion-object virtual world target, open:

http://127.0.0.1:5176/benchmarks/ten-billion-virtual-test.html

This path uses a procedural indexed world: 10,000,000,000 objects are addressable and queryable, while only camera-visible objects are materialized and rendered each frame.

The latest local run passed the 60 FPS target with 12,030 visible objects, quality 100%, and 2.3 MB virtual-world memory.

Project Files

Demeter project files use readable JSON with the .demeter.json suffix. Large scenes can also be saved as chunked JSON with the .demeterchunks.json suffix, splitting object data into chunks so loading, diffing, and future streaming are easier.

Both formats can be loaded from the studio through the same Load JSON button.

Optimization Systems

  • SpatialIndex skips broad full-scene scans for large object sets.
  • CollisionWorld adds layer/mask-based broadphase collision checks.
  • ECSWorld stores gameplay data in typed arrays for lower memory pressure.
  • TextureAtlas and SpriteBatch prepare sprite batching by texture.
  • StaticLayerCache stores stable layer results with bounded LRU cleanup.
  • LogicWorkerClient moves heavy logic stepping into a Web Worker.
  • VirtualLoadShield protects huge virtual worlds with a 10B primary tier, a 50B reserve tier, and a 100B insurance tier that lowers visible workload before FPS enters a dangerous range.
  • detectWebGPU() probes WebGPU support while WebGL2 remains the current production renderer.

Virtual Load Shield

Demeter does not store 10B, 50B, or 100B full JavaScript objects in memory. It keeps those worlds virtual and only materializes what the camera can see. The load shield adds a second safety half around that model: if the current tier cannot keep FPS safe, it lowers the visible workload and moves from the 10B primary tier to the 50B reserve tier, then to the 100B insurance tier.

import {
  DemeterEngine,
  createHundredBillionVirtualWorld,
  createVirtualLoadShield
} from "demeter-2d-engine";

const shield = createVirtualLoadShield();
const world = createHundredBillionVirtualWorld();
const engine = new DemeterEngine({ canvas, overlayCanvas, loadShield: shield });

function frame() {
  world.update(1 / 60);
  const stats = engine.renderVirtualWorld(world);
  console.log(stats.loadShield.tier, stats.qualityPercent);
  requestAnimationFrame(frame);
}

Shape Expansion

The engine can automatically recognize common 2D shapes and enlarge them in one pass. The scaler handles built-in rect, circle, and text objects, plus custom objects that expose dimensions, radii, or point lists.

import { scaleProjectShapes } from "demeter-2d-engine";

const summary = scaleProjectShapes(project, { factor: 2 });
console.log(summary.scaled);

In Demeter Studio, use Expand x2 in the Objects panel to double the current scene's shapes and scene bounds.

Commercial Direction

Demeter is intended as a web engine and editor that other people can use to create games. The current implementation avoids game-specific content so the product remains focused on engine authoring, project editing, and runtime foundations.