gamedig / node-gamedig

Query game servers and not only! Node.JS/Deno/Bun or Bash (via the CLI).
https://www.npmjs.com/package/gamedig
MIT License
608 stars 146 forks source link

Support for RAGE MP #49

Closed kotbrain closed 4 months ago

kotbrain commented 7 years ago

Multiplayer for GTA 5 will be released soon. It will also be possible to get information about the servers there. Will you implement multiplayer support and how soon?

https://www.youtube.com/watch?v=gs_2zVSDLzw

mmorrisontx commented 7 years ago

Is this different from FiveM?

twamp22 commented 7 years ago

Appears to be a different mod. RageMP seems to be a JS/NodeJS client/server, whereas FiveM is mainly C variants. RageMP is however closed source it would seem, while FiveM is open source.

mmorrisontx commented 7 years ago

This game does not seem to have a query protocol at all unfortunately 😒. Someone would need to write a plugin for rage.mp which keeps track of the connected players and exposes it in some way.

eduardozgz commented 4 months ago

RageMP seems to use these endpoints for querying servers on their official website (https://rage.mp/servers and https://rage.mp/masterlist/):

I have been using the first endpoint for a few years, and it works fine. If you are okay with querying the servers using these endpoints, I would be happy to make a PR. I will implement this in a fork for my Discord bot, as I need it for my own use.

CosminPerRam commented 4 months ago

As we already have a bunch of games that rely on master servers to get a server's informations, this could be done for ragemp too, opening for further research.

@eduardozgz thanks for pointing this out (:

xCausxn commented 4 months ago

V2 Endpoint is grouped so in order to find a specific server is could either be: key === ip:port or needing to loop through each servers array in each key to find it. Probably a combination of both so if key is ip and port its a quick lookup, otherwise fallback to server loop.

Example

{
    "id": "grandrpen",
    "servers": [
      {
        "id": "rage2.gta5grand.com:22005",
        "name": "πŸ›‘[EU][US][voice] [roleplay] Grand RolePlay | Server 2 | discord.gg/gta5grandcom [1.1]",
        "lang": [
          "en"
        ],
        "players": {
          "amount": 789,
          "max": 3000,
          "peak": 797
        }
      },
      {
        "id": "rage3.gta5grand.com:22005",
        "name": "πŸ›‘[EU][US][voice] [roleplay] Grand RolePlay | Server 3 | discord.gg/gta5grandcom [1.1]",
        "lang": [
          "en"
        ],
        "players": {
          "amount": 775,
          "max": 5000,
          "peak": 775
        }
      }]
}

However the id could also be domain:port rather than ip:port

V1 / Non Versioned endpoint as stated is not grouped, but the key will either be ip:port / domain:port. Example

{ 
  "nami.swat-gw.de:22005": {
    "name": "SWAT GANGWARS 2.0 | discord.gg/swat-gw | PVP, Daily Loot, ... [1.1]",
    "gamemode": "gangwar",
    "url": "rage.mp",
    "lang": "de",
    "players": 0,
    "peak": 12,
    "maxplayers": 300
  },
  "de4.gta5grand.com:22005": {
    "name": "Γ°ΕΈβ€Ίβ€˜[DE][voice] [roleplay] Grand RolePlay | SERVER 4 | discord.gg/gta5grandcom [1.1]",
    "gamemode": "roleplay",
    "url": "gta5grand.com",
    "lang": "de",
    "players": 176,
    "peak": 177,
    "maxplayers": 3000
  }
}

If it was always ip:port we could of just resolved the ip from the address before hand and matched. Not that this is a problem just will be slightly more inefficient in matching.

Players info is purely just count and maxplayers, havent looked more to see if possible to get players, but it seems like they chose to keep that hidden from both a performance standpoint (high player counts) and also preventing people finding specific players e.g.g streamers