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 🙏

© 2025 – Pkg Stats / Ryan Hefner

toubani

v0.0.4

Published

A small TypeScript 2D game helper built on top of the [ouider](https://www.npmjs.com/package/ouider) bridge. It wraps ODOM canvas APIs with a lightweight game loop, asset pipeline, sprite/scene graph utilities, tile rendering, simple physics/collision hel

Downloads

376

Readme

Toubani (tourterelle)

A small TypeScript 2D game helper built on top of the ouider bridge. It wraps ODOM canvas APIs with a lightweight game loop, asset pipeline, sprite/scene graph utilities, tile rendering, simple physics/collision helpers, camera controls, and Web Audio playback.

Features

  • Simple game loop with lifecycle hooks (preload, setup, update, draw)
  • Asset manager for images, sprite sheets, and decoded audio buffers
  • Sprite sheets and animations, plus a scene graph for transforms/parallax
  • Tile map rendering with camera-aware culling
  • Basic input handling (keyboard and mouse pressed/held state)
  • Minimal physics for AABB bodies on a tilemap and tag-based collision rules
  • Camera helper for pan/zoom/anchor transforms
  • Web Audio playback via ouider (no direct DOM audio)

Installation

npm install
npm run build   # bundles to dist/ via tsup

Toubani expects to run inside an ouider environment. Your app should already initialize ouider (e.g. OUID.config() in your bootstrap).

Quick start

Create a canvas (provided by ouider) and hand it to tulon:

import { tulon, GameContext } from "toubani";
import { ODOM } from "ouider";

const canvas = new ODOM.CanvasElement(/* ouider element */);

const game = tulon({
  canvas,
  preload(assets) {
    assets.image("player", "/player.png");
    assets.sound("step", "/step.mp3");
  },
  setup({ world, assets }) {
    // stash reusable objects on world for later frames
    world.playerImage = assets.getImage("player");
  },
  update({ dt, input, audio }) {
    if (input.isPressed("Space")) {
      audio.play("step", { volume: 0.6 });
    }
  },
  async draw({ ctx2d, canvas }) {
    const w = await canvas.width();
    const h = await canvas.height();
    ctx2d.clearRect(0, 0, w, h);
    ctx2d.fillStyle = "#20262e";
    ctx2d.fillRect(0, 0, w, h);
    // draw stuff...
  },
});

await game.init();
game.start();

Library modules

  • Game/core: Game, tulon, and the GameConfig/GameContext contracts in src/game.ts and src/core.ts.
  • Assets/audio: AssetManager loads images/sounds and builds sprite sheets; AudioManager decodes and plays sounds through Web Audio via ouider.
  • Sprites/scene: SpriteSheet, SpriteAnimation, Sprite, SpriteLayer, and a small scene graph (Scene, SceneNode, SpriteNode) for nested transforms.
  • Tiles/camera: TileRenderer and helpers for tile maps/tilesets, plus Camera2D for pan/zoom/rotation with configurable focus anchors.
  • Physics/collision: PhysicsBody for AABB tile collisions with gravity/friction and CollisionSystem for tag-based collider handlers.
  • Input: InputManager tracks key and mouse pressed/held state per frame.

Examples

See examples/simple for runnable demos:

  • src/Game.ts: side-scroller style scene showing tile rendering, physics, camera follow, and sprite animations.
  • src/checkers/checkers.ts: simple checkers board rendered on the canvas using camera transforms and click handling.

Each example has its own package.json/webpack config; install and run from examples/simple to try them in an ouider host.

Developing

  • Build: npm run build (tsup → dist/)
  • TypeScript config: tsconfig.json targets CommonJS output for the bundled library.

Notes

  • Audio uses Web Audio via ouider’s AudioContext bridge; sounds are fetched through OUID.fetch, decoded once, and played from buffers (no DOM audio elements).
  • Assets cache image sizes on load to support sprite and tile calculations.