rtcwmp-com / rtcwPro

RtcwPro - Competition Mod for Return to Castle Wolfenstein
http://rtcwpro.com
GNU General Public License v3.0
26 stars 6 forks source link

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

Closed donkz closed 1 year ago

donkz commented 2 years ago

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.

rtcw-nihi commented 2 years ago

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).

donkz commented 2 years ago

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.

rtcw-nihi commented 2 years ago

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

rtcw-nihi commented 2 years ago

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.

krazykaze81 commented 2 years ago

@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

rtcw-nihi commented 2 years ago

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.