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

rngine

v0.3.1

Published

React Native 2D game engine powered by Nitro Modules

Readme

Rngine

A React Native game engine for building 2D games, powered by Nitro Modules for high-performance C++ game logic.

Installation

npm install rngine react-native-nitro-modules

react-native-nitro-modules is required as this library relies on Nitro Modules.

Usage

import { GameEngine, configure, update } from 'rngine';

configure({
  tickRate: 60,
  world: { width: 800, height: 800, color: '#1a1a1a' },
  entities: [
    {
      id: 'player',
      px: 400,
      py: 400,
      width: 40,
      height: 40,
      color: '#00ff00',
    },
    {
      id: 'enemy_1',
      px: 100,
      py: 100,
      width: 40,
      height: 40,
      color: '#ff0000',
      vx: 1000,
    },
    {
      id: 'enemy_2',
      px: 200,
      py: 200,
      width: 40,
      height: 40,
      color: '#ff0000',
      vx: -1000,
    },
  ],
  systems: [
    {
      // runs every tick for all enemies
      ids: ['enemy'],
      onTick: (enemies) => {
        enemies.forEach((enemy) => {
          // reverse direction when reaching world edges
          if (enemy.px <= 0 || enemy.px + enemy.width >= 800) {
            update({ id: enemy.id, vx: -enemy.vx });
          }
        });
      },
    },
  ],
  paused: false,
});

export default function App() {
  return <GameEngine style={{ flex: 1 }} />;
}

Concepts

Entities are the objects in your game world. Each entity has a position, size, color, and velocity. See Entity.

Systems define your game logic. Each system declares which entities it cares about via ids and runs every tick receiving those entities. See System.

World defines the game world dimensions and background color. Entities outside the world bounds are automatically clipped. See World.

Entity Querying

Entity ids use _ as a hierarchy separator, which enables prefix matching in systems and functions like update. Querying 'enemy' matches all entities whose id starts with enemy_. So enemy_1, enemy_magician_1, and enemy_warrior_2 are all returned. Querying 'enemy_magician' narrows it down to only magician entities. Querying 'enemy_magician_1' is an exact match.

This makes it easy to build entity groups naturally through naming. No extra configuration needed.

// matches enemy_1, enemy_magician_1, enemy_warrior_2
{ ids: ['enemy'], onTick: (entities) => {} }

// matches only enemy_magician_1, enemy_magician_2
{ ids: ['enemy_magician'], onTick: (entities) => {} }

// exact match
{ ids: ['enemy_magician_1'], onTick: (entities) => {} }

API

configure(config)

Sets up the game engine. Call this before anything else.

| param | required | type | default | description | | ---------- | -------- | ---------- | ------- | ------------------------------------- | | tickRate | ✓ | number | - | Game logic updates per second | | world | ✓ | World | - | World dimensions and background color | | entities | | Entity[] | [] | Initial entities to spawn | | systems | | System[] | [] | Systems to run each tick | | paused | | boolean | true | Whether to start paused |

spawn(entity | entity[])

Spawns one or more entities into the world. Skips duplicates by id.

despawn(id)

Removes the entity with the given id, or all entities matching the given prefix.

update(entityUpdate | entityUpdate[])

Updates one or more entities. Only the provided fields are changed. Matches entities by exact id or prefix.

pause()

Pauses the game loop. Systems stop running.

resume()

Resumes the game loop.

Contributing

License

MIT


Made with create-react-native-library