mtasa-blue icon indicating copy to clipboard operation
mtasa-blue copied to clipboard

Add information to MTA Server List ("rules" table provided by ASE)

Open Fernando-A-Rocha opened this issue 1 year ago • 0 comments

Is your feature request related to a problem? Please describe.

In order to easily improve the Server Browser by showing more server information to the client, we should merge #3761 which adds new default "rules" that a server can set to define its description, social media URLs, etc. All of this information can already be stored in the rules key-value pairs of the server's ASE query response (Port 22126 UDP by default).

So, we need a way to obtain this information in the client, to then display it correctly in the Server Browser (e.g. showing a server's tags).

Describe the solution you'd like

The Server Browser obtains the server list from MTA's servers https://github.com/multitheftauto/mtasa-blue/blob/55d39225254c0b9961c1423b0d5695beff20072b/Client/core/ServerBrowser/CServerList.h#L43-L60

See https://master.multitheftauto.com/ase/mta/ (list of server info such as name, player count, etc in ASE format), which can be fetched and parsed using a script such as https://github.com/Fernando-A-Rocha/ase2json_py

Image

Several things need be done, imo:

  • Add new ASE Flag to return the Rules table which you can also call Rules Map or Rules List (see Client/core/ServerBrowser/CServerList.h)
  • Modify the Master server list MTA service (requires backend access) to return the data
  • Edit the C++ scripts so they can fetch and parse the string key-value pairs from the Rules table fetched
  • (FUTURE) Revamp the Server Browser UI to parse and use the new information

Describe alternatives you've considered

Doing nothing will unfortunately not allow us to make progress in getting the issues #3761 resolves easily, without having to refactor/rewrite A LOT of code.

Additional context

Curiosities:

This is how ASE format includes key-value pairs in its structure Image

This is how OpenGSQ-Python parses the ASE response, in particular the rules part Image

Game-State is dealing with the rules table that servers provide in their ASE response properly 🥳 (not an advertisement) e.g. https://www.game-state.com/164.132.200.104:22003/ contains: Author: AGRP Team Script Version: 24.08.12

The JSON server list provided by https://mtasa.com/api/ also does not contain the server Rules array. I am unsure where this API is used, but it would be nice to also update it.

Security Policy

  • [x] I have read and understood the Security Policy and this issue is not about a cheat or security vulnerability.

Fernando-A-Rocha avatar Oct 11 '24 14:10 Fernando-A-Rocha