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

samengine

v1.9.0

Published

A TypeScript game library to make HTML Games

Readme

Samengine 🎮

A lightweight, TypeScript-first web game engine framework for building 2D games and maybe 3D Games in the Future.

Features

  • 🎯 Simple game loop management
  • 🎨 Rendering system with text and sprite support
  • ⌨️ Input handling (keyboard & mouse)
  • 📦 TypeScript support out of the box
  • 🛠️ Build tools included
  • 📝 Logging utilities
  • 💾 Save/Load system

Info

For better Infos read the Docs

Quick Start

# Make sure both of them have the same Version

npm init
npm install samengine
npm install samengine-build
npx samengine-build --new
npx samengine-build

Basic Game Loop

import { startEngine, setupInput, dlog, renderText
} from 'samengine';

const { canvas, ctx, applyScaling, virtualWidth, virtualHeight

} = createCanvas({ fullscreen: true, scaling: "fit",
virtualWidth: 1920, virtualHeight: 1080 });
setupInput(canvas, virtualWidth, virtualHeight);

function init() {
  dlog('🎮 Game initialized!');
}

function gameLoop(dt: number) {
  // Clear canvas
  ctx.fillStyle = 'black';
  ctx.fillRect(0, 0, canvas.width, canvas.height);
  
  // Your game logic here
  renderText(ctx, `FPS: ${(1 / dt).toFixed(0)}`, 10, 20);
}

startEngine(init, gameLoop);

Development & Building

Using Bun (local development)

npx samengine-build                       # Start Dev Server
npx samengine-build --release             # Production build
npx samengine-build --new (newproject)    # Create a new project with a
                                          # simple Snake Clone as Template
npx samengine-build --new-empty (new)     # Create a new empty project

Config

// Project File for the Game

import { type buildconfig, new_buildconfig
} from "samengine-build";

export function defineConfig(): buildconfig {
    let config: buildconfig = new_buildconfig();
    return config;
}

API Reference

Core Engine

  • startEngine(init, gameLoop) - Initialize game loop

Rendering

  • renderText(ctx, text, x, y, color?, font?) - Render text
  • renderBitmapText() - Render bitmap font text

Input System

  • setupInput(canvas, width?, height?) - Initialize input
  • getKeyState(key) - Check key state
  • Mouse state available via input module

Types

  • Vector2D / Vector3D - Vector mathematics
  • Color - Color management
  • Rect - Rectangle collision
  • Math utilities for game logic

Utilities

  • startEngine() - Manage game loop

License

MIT

More Addons in the Game Library

  • a Full Markdown Parser (maybe for notes or easy docs, feel free to use)
  • a JSON with Comments Parser

(I dont now why i added this)

More Tools for samengine and Game Making by me lol

Commit Tags

The tags which are ending with -build are for the samengine-build Tool and the which end with -cli are for the samengine-cli package.