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

@weed.js/engine

v0.3.2

Published

A blazing-fast multithreaded web game engine that handles 20,000+ NPCs without breaking a sweat

Readme

WeedJS 🌿

A blazing-fast multithreaded web game engine that handles 20,000+ NPCs without breaking a sweat.

🔗 Live Demo: https://multithreaded-game-engine.vercel.app/demos

WeedJS Demo


🔥 20,000 Entities. Smooth 60fps. In Your Browser.

Most web game engines choke at a few hundred entities. WeedJS runs 20,000 with room to spare.

Built from the ground up with true parallelism using SharedArrayBuffers and 4 dedicated Web Workers:

  • Spatial Worker — Blazing-fast neighbor queries via spatial hashing
  • Logic Workers — Your game AI runs in parallel across multiple cores
  • Physics Worker — Rock-solid Verlet integration with collision detection
  • Renderer Worker — PixiJS-powered graphics running off the main thread

✨ Features That Make You Smile

🎮 Entity Component System — Clean, composable architecture
O(1) Object Pooling — Spawn and despawn with zero allocations
🦅 Built-in Flocking AI — Boids with cohesion, separation, and alignment
💡 2D Lighting & Shadows — Dynamic lights, shadow casting, muzzle flashes
🎆 Particle System — Blood splats, sparks, decals that stick to the floor
📷 Smart Camera — Smooth follow, zoom, world bounds clamping
🎬 Animated Sprites — Spritesheet support with state-based animations
🎯 Collision Callbacks — Unity-style onCollisionEnter/Stay/Exit
🎭 Scene Management — Hot-swap between scenes with full cleanup
🐛 Debug UI — Real-time FPS, entity counts, and visual debugging


💫 Stupidly Simple API

import WEED from "/src/index.js";

const { GameObject, RigidBody, Collider, SpriteRenderer, Scene } = WEED;

// Define your entity
class Zombie extends GameObject {
  static components = [RigidBody, Collider, SpriteRenderer];

  setup() {
    this.rigidBody.maxVel = 3;
    this.collider.radius = 15;
  }

  onSpawned(config) {
    this.x = config.x;
    this.y = config.y;
    this.setSpritesheet("zombie");
    this.setAnimation("walk_down");
  }

  tick(dtRatio) {
    // Your AI runs here - neighbors already calculated!
    for (let i = 0; i < this.neighborCount; i++) {
      const neighborIdx = this.neighbors[i];
      const dist = Math.sqrt(this.neighborDistances[i]);
      // Do something with nearby entities...
    }
  }

  onCollisionEnter(otherIndex) {
    // Bite them!
  }
}

// Create scene with 20K zombies
class ZombieScene extends Scene {
  static config = {
    worldWidth: 5000,
    worldHeight: 2000,
    spatial: { cellSize: 128, maxNeighbors: 1500 },
    physics: { gravity: { x: 0, y: 0 } },
  };

  static entities = [[Zombie, 20000]];

  create() {
    for (let i = 0; i < 20000; i++) {
      this.spawnEntity("Zombie", {
        x: Math.random() * 5000,
        y: Math.random() * 2000,
      });
    }
  }
}

// Run it
const game = new WEED.GameEngine({ debug: true });
await game.loadScene(ZombieScene);

That's it. 20,000 zombies chasing each other with spatial awareness, physics, and animations. All at 60fps.


🌈 Particles & Effects

// Blood splatter on collision
ParticleEmitter.emit({
  count: { min: 4, max: 8 },
  texture: "blood",
  x: this.x,
  y: this.y,
  angleXY: { min: 0, max: 360 },
  speed: { min: 0.7, max: 1.5 },
  lifespan: 6000,
  gravity: 0.15,
  stayOnTheFloor: true, // Decal!
});

// Muzzle flash
Flash.create({
  x: gun.x,
  y: gun.y,
  z: 30,
  lifespan: 80,
  color: 0xffaa00,
  intensity: 40000,
});

💡 Dynamic Lighting

class TorchLight extends GameObject {
  static components = [LightEmitter, ShadowCaster];

  setup() {
    this.lightEmitter.lightColor = 0xff6600;
    this.lightEmitter.lightIntensity = 20000;
    this.lightEmitter.height = 100;
    this.shadowCaster.shadowRadius = 20;
  }
}

Entities cast shadows. Lights illuminate. It all just works.


🎮 Input That Feels Right

tick(dtRatio) {
  if (Keyboard.isDown("w")) this.rigidBody.ay -= 0.3;
  if (Keyboard.isDown("s")) this.rigidBody.ay += 0.3;
  if (Mouse.isDown) {
    // Run away from cursor!
  }
  Camera.follow(this.x, this.y);
}

🏃 Quick Start

git clone https://github.com/your-repo/weedjs.git
cd weedjs
node server/node_server.js

# Open http://localhost:3000/demos/

SharedArrayBuffer requires CORS headers. The included server handles this for you.


🌿 Why "WeedJS"?

Because it grows fast, spreads everywhere, and just won't die.

Also, this engine is dope.


📄 License

ISC


Stop counting entities. Start making games. 🎮