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

game-engine-core-node

v0.2.0

Published

TypeScript/Node.js client SDK for game-engine-core

Readme

game-engine-core-node

TypeScript/Node.js client SDK for the game-engine-core gRPC server.

npm: https://www.npmjs.com/package/game-engine-core-node GitHub: https://github.com/stevenlundy/game-engine-core


Install

npm install game-engine-core-node

Pinning to a specific version

npm install [email protected]

Quick start

import { GameClient, StateUpdate, Action, drawCard, playCard } from "game-engine-core-node";

class MyAgent extends GameClient {
  onStateUpdate(state: StateUpdate): Action {
    return drawCard(); // replace with real logic
  }
}

const agent = new MyAgent("localhost:50051", "my-player");
const sessionId = await agent.joinLobby("crazy-eights");
await agent.run();
agent.close();

See examples/randomAgent.ts for a complete runnable example.


API

GameClient (abstract)

| Member | Description | |--------|-------------| | constructor(serverUrl, playerId) | Creates client with gRPC target and player identifier | | joinLobby(gameType): Promise<string> | Joins matchmaking lobby; resolves with session_id when game starts | | run(): Promise<void> | Opens bidirectional Play stream; resolves when game ends | | onStateUpdate(state): Action \| Promise<Action> | Abstract — implement your game logic here | | close(): void | Closes all open gRPC channels |

Helper functions

| Function | Description | |----------|-------------| | playCard(rank, suit, declaredSuit?) | Build a play-card Action | | drawCard() | Build a draw-card Action | | parseRichState(update) | Decode a StateUpdate into a RichState with parsed JSON payload |

Testing helpers

import { startTestServer, stopTestServer, withTestServer } from "game-engine-core-node";

// Start a CountdownGame test server (builds cmd/testserver from source)
const server = await startTestServer({ countdownSteps: 5 });
const bot = new MyBot(server.url, "p1");
await bot.run();
stopTestServer(server);

// Or with a convenience wrapper
await withTestServer({ countdownSteps: 10 }, async (srv) => {
  const bot = new MyBot(srv.url, "p1");
  await bot.run();
});

Requires go on PATH and the game-engine-core source available (set GAME_ENGINE_CORE_ROOT env var if needed).


Migration from ts-web

The Node and Web clients have identical public APIs. To move a bot to the browser:

-import { GameClient } from "game-engine-core-node";
+import { GameWebClient as GameClient } from "game-engine-core-web";

Project layout

clients/ts-node/
  src/
    client.ts              GameClient abstract base class
    actions.ts             playCard / drawCard helpers
    state.ts               RichState / parseRichState
    index.ts               public exports
    testing/server.ts      Test server helper (exported)
    client.test.ts         Jest unit tests
    integration/           Integration tests (real Go server)
    proto/                 Generated by npm run proto
  examples/
    randomAgent.ts         Minimal subclass example
  dist/                    Compiled output (after npm run build)

Development

Requirements

| Tool | Version | |------|---------| | Node | 20.x (see .nvmrc) | | npm | 10.x | | protoc | 34.x |

Commands

make install      # npm install
make build        # tsc → dist/
make test         # Jest unit tests
make test-all     # unit + integration tests (requires go on PATH)
make lint         # Biome lint
make fmt          # Biome format
make type-check   # tsc --noEmit

Regenerating protobuf stubs

npm run proto

Requires protoc and ts-proto (npm install handles ts-proto).