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

@xan105/lobby_connect

v2.1.1

Published

Discover people playing on the network using the Goldberg SteamEmu with the launch parameter to connect to their game.

Downloads

13

Readme

About

FFI bindings to lobby_connect from Goldberg SteamEmu but recompiled as a dll.

Discover people playing on the network using the Goldberg SteamEmu with the launch parameter to connect to their game.

This can be used in Node.js/Electron. 💡 Usage without Node/JavaScript is also explained down below.

Feel free to make a cool looking GUI for this 😃

Example

import { lobbyPlayerState } from "@xan105/lobby_connect";

setInterval(function(){ 
  lobbyPlayerState()
  .then(console.log)
  .catch(console.error);
}, 3000);

/*output example
[] //Nobody on the network
[ { name: 'Xan', appID: 466560, connect: '' } ] //In game
[ { name: 'Xan', appID: 466560, connect: '+connect_lobby 109212296511539930' } ] //lobby available
*/

Install

npm install @xan105/lobby_connect

API

⚠️ This module is only available as an ECMAScript module (ESM) starting with version 2.0.0. Previous version(s) are CommonJS (CJS) with an ESM wrapper.

Named export

lobbyPlayerState(): Promise<obj[]>

Discover people playing on the network.

Return an array of Player object as:

{
  name: string, //player's name
  appID: number, //game's appid
  connect: string //the launch parameter to connect to the player's game
}

Build

The dll src is located at lib\src\goldberg_emulator\lobby_connect_dll.cpp

If you want to build the dll yourself please see the build instructions for the goldberg emulator (https://gitlab.com/Mr_Goldberg/goldberg_emulator#windows). When your env is set. Run the following npm script in the root dir of this package :

npm run-script build_x86 //for x86
npm run-script build_x64 //for x64

//or

npm run-script build //for both x86 & x64

NB: npm run-script update will git pull ./lib/src/goldberg_emulator

Usage without Node / JavaScript

You can bind directly to the dynamic link library (dll) found in lib/dist with any lang that allows for FFI (Foreign Function Interface) with standard C declaration (c-shared).

Have a look at the bindings in lib/lobby.js to get a feel for it. Even if you don't know any JavaScript. It's rather simple.

There are 3 functions exported :

  • lobby_ready(int delay): int
  • lobby_player_count(): int
  • lobby_player_info(int playerIndex): <Player>

<Player> being the following Struct:

struct {
  const char *name;
  int appID;
  const char *connect;
  uint64 lobby;
};
  1. Use lobby_ready() with a delay to wait for a few seconds for connections (delay * 10) (Originally Mr. Goldberg uses 200ms). It returns 1 (true) if SteamAPI is initialized; 0 (false) otherwise.

  2. Use lobby_player_count() to get how many people they are on the network.

  3. Loop until max number of people from the above (step2) using lobby_player_info() to get each player information (Player Struct).

If you have a connect string then that's your connect argument to pass to the game; Otherwise transform the uint64 lobby to a string and append "+connect_lobby" to it.

Dont' forget credits and license and you are done :wink: