rtcwPro icon indicating copy to clipboard operation
rtcwPro copied to clipboard

Stats: if a player quits, retain stats in json output

Open donkz opened this issue 4 years ago • 6 comments

Is your feature request related to a problem? Please describe. If a player quits before the match is over, their stats are completely missing from $.stats portion of the Json output. This is serious because the final number of clients is corrupted unless a more costly application processing is to be performed and imputing is a pain. Final number of clients also determines the game type, elo calculation, and match grouping.

Describe the solution you'd like Retain last known client stat under last known guid Maybe a logic can be: if client disconnect then copy client object to a ghost. At the end of the round output ghosts like normal players.

Describe alternatives you've considered Run through $.gamelog and collect truer number of clients. Based on their kills, impute the stats of missing people.

donkz avatar Dec 09 '21 02:12 donkz

That is already implemented and the question I have not asked is, would it be acceptable to send this data in a separate json file (containing all the proper headings)? It can be done so that this data is written in the single json file submitted but it gets very ugly with room for error (I will admit, not much time has been spent figuring out a cleaner way).

rtcw-nihi avatar Dec 09 '21 03:12 rtcw-nihi

Match submission is a wholesome event that makes it's way through the pipeline and ripples with Elo calc, summary stats, gamelog awards calc, discord notifications. Sending an additional file describing the same event would not fit. It's best if players appeared all in one place all at once.

Alternatively (ql did this and it was extra work) quitters could be nested separately under team "quitters" or something.

donkz avatar Dec 09 '21 03:12 donkz

Ah, we can easily nest them in at the end as "quitters". Will jump on this as soon as possible.

rtcw-nihi avatar Dec 09 '21 04:12 rtcw-nihi

I also meant to say the "ugly way" that keeps it entirely as it currently outputs but with the quitter's stats is to re-write the entire stats file at the end of the match....nothing complicated but very ugly. I may implement this approach first and deal with the ugliness as it would not change the JSON format.

rtcw-nihi avatar Dec 09 '21 04:12 rtcw-nihi

@rtcw-nihi Aren't the JSON outputs at the end of a round looking at

cl->pers.connected != CON_CONNECTED

So if the client is not connected it will not do anything for that client's stats

krazykaze81 avatar Jan 18 '22 18:01 krazykaze81

I did this a long time ago but I recall handling it by creating a client object and "saving" the disconnected clients stats to this object upon their disconnect and then reading in these stats at the end of the round and outputting to the json stats file.

rtcw-nihi avatar Jan 18 '22 19:01 rtcw-nihi