Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xan105/node-lobby_connect
Discover people playing on the network using the Goldberg SteamEmu with the launch parameter to connect to their game
https://github.com/xan105/node-lobby_connect
lobby nodejs steam steamemulator windows
Last synced: about 2 months ago
JSON representation
Discover people playing on the network using the Goldberg SteamEmu with the launch parameter to connect to their game
- Host: GitHub
- URL: https://github.com/xan105/node-lobby_connect
- Owner: xan105
- License: lgpl-3.0
- Created: 2020-07-08T10:27:26.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-05-23T12:39:49.000Z (7 months ago)
- Last Synced: 2024-09-16T11:55:30.777Z (3 months ago)
- Topics: lobby, nodejs, steam, steamemulator, windows
- Language: C++
- Homepage:
- Size: 12.3 MB
- Stars: 11
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
About
=====FFI bindings to `lobby_connect` from [Goldberg SteamEmu](https://gitlab.com/Mr_Goldberg/goldberg_emulator) but [recompiled as a dll](https://gitlab.com/Mr_Goldberg/goldberg_emulator/-/issues/96).
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](https://github.com/xan105/node-lobby_connect#usage-without-node--javascript).Feel free to make a cool looking GUI for this 😃
Example build with ElectronExample
=======```js
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`
Discover people playing on the network.
Return an array of `Player` object as:
```ts
{
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 :```js
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): ```` being the following Struct:
```c
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: