spatiebot / ab-client

A hybrid nodejs and browser client for airmash
MIT License
8 stars 5 forks source link

Frequent SCOREDETAILED requests #29

Closed wight-airmash closed 3 years ago

wight-airmash commented 3 years ago

The original client sends SCOREDETAILED in the following cases:

  1. Once at the moment of the scores table opening.
  2. Every 5 seconds, while the table is opened.

https://github.com/airmash-refugees/airmash-frontend/blob/ad2924f3a11fe60a7bc14e314f4e177041cc5527/src/js/UI.js#L989-L991

It is also important that the response packets are large enough and generate additional traffic, which may affect not only the server, but also the client.

At the moment ab-client sends a request every second since game started. This is probably done to update the player's ping values in nameplates. Of course, it is possible use case for these packages, but it seems a bit excessive to get all the data just to request ping. For this reason, it is likely that scores are put into a separate packet type SCORE_BOARD without extra stats.

It is possible that the server behavior will soon get changes and SCOREDETAILED requests exceeding the limit provided by the original behavior will be rejected.

spatiebot commented 3 years ago

Do you propose to remove the call from ab-client altogether? Or reduce the amount of requests? I was struggling with finding the right call for the score; the ping was only "collateral profit", it is surely not that important. What about if the client sends it every 10 seconds or so?

wight-airmash commented 3 years ago

I propose using the packet closer to the original use i.e. a little less frequently and at the moment when it needed (for example, to render a table with all statistics).

I was struggling with finding the right call for the score

The best way to get players' score points is with data from the SCORE_BOARD packet. The server broadcasts it every 5 seconds to all players, serializing the packet only once, while SCORE_DETAILED (SCORE_DETAILED_CTF, SCORE_DETAILED_BTR) packet is a "personal" packet i.e. the server has to serialize a unique response to each request for each player.