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 🙏

© 2024 – Pkg Stats / Ryan Hefner

serverboy

v0.0.7

Published

A gameboy emulator based off of gameboy-online and optimized to run on a server with hooks for scripting and streaming output.

Downloads

13

Readme

Serverboy

Serverboy is a pure NodeJS headless Gameboy emulator with hooks for scripting and streaming output, adapted for use by Piglet.

Serverboy has no dependencies, including browser-side dependencies like Canvas. This makes Serverboy ideal for headless streaming and scripting via low-powered environments and environments where users are not able to install additional software dependencies like Cairo.

Unlike most emulators, Serverboy's API is heavily geared towards automation and serverside projects. Serverboy doesn't auto-advance frames, so you can step forward frame by frame after running asynchronous logic. Serverboy also provides hooks for getting raw memory access, raw screen pixels, and raw PCM audio data.

This focus on automation means that Serverboy is not generally suited for regular play. There's no integrated code for displaying the screen or playing audio. It's designed to be used inside other more experimental projects. If you just want a way to play games, look elsewhere unless you're willing to build your own front-end.

Serverboy is alpha software; elements like sound are still a work in progress. The API may change over time.

Usage

The full API is available in the docs.

var gameboy = new Gameboy();
var rom = fs.readFileSync(file_path);

gameboy.loadRom(rom);

setTimeout(function () {

   //Whatever custom logic you need
   var memory = gameboy.getMemory();
   if (memory[3000] === 0) {
       gameboy.pressKeys([Gameboy.KEYMAP.RIGHT]);
   }
   
   gameboy.doFrame();
}, 0);

Integration Tests

Serverboy uses Blargg's Test Roms for integration tests to ensure that simulation accuracy doesn't change during code refactoring.

Serverboy doesn't guarantee complete emulation accuracy, just consistency with the results below. More tests and accuracy changes may be added in the future.

Credits

Serverboy is heavily based on work by rauchg, which is itself heavily based on Grant Galitz's earlier work with Gameboy Online. Most of this code originated in Grant's repo, and I've mostly been playing janitor since.

Imran Nazar's article series, Gameboy Emulation in Javascript was also an occasional help when I wanted dig into the internals of how the hardware actually worked to help with refactoring.