Mendasp / NS2Plus

NS2+ mod for Natural Selection 2
10 stars 22 forks source link

Cleanup end stats and add HiveSkill Graph #77

Closed peblpebl closed 6 years ago

peblpebl commented 6 years ago

Right align table numbers. Change numbers to show .00 to align table numbers. Add hive skill graph to the end stats Change server code to generate the hiveskill graph.

GhoulofGSG9 commented 6 years ago

Sorry for the late response but I just didn't have time for this project until now.

Anyway thanks for the PR but please use tabs to indent your code next time instead of 2 spaces to match the projects code style.

I converted the spaces to tabs for this PR and also refactored the code a little so the hive skill of each player gets extracted for the team stats table and we don't have to save and send it another time.

Otherwise this PR has been merged into the Beta branch and will go out with the next ns2plus version ;)

peblpebl commented 6 years ago

I considered saving the steamId only, but did not know how fast/when a new hiveskill was calculated/updated.

GhoulofGSG9 commented 6 years ago

The server caches the player's skill until a map change occurs. So even if the skill would change in between without clearing the cache or fetching the skill directly from the hive back-end currently a skill change wouidn't be recorded.

The probability that a player starts a round at one server then joins another to finish a round there while the first server's round is still continuing so that the player can rejoin it at the end is also so low it's not really worth considering imho.

peblpebl commented 6 years ago

Hmm, this does not work, as I was not aware of rr and spectate are 2 different teamNumbers. I did not test with spectating.

GhoulofGSG9 commented 6 years ago

Additionally also all attempts to join a team are counted as teamjoins even if they fail. I'll fix the issues later today.

peblpebl commented 6 years ago

If you do that could you also fix that the hive skill graph could start at -100 instead of 0

peblpebl commented 6 years ago

CHUD_ServerStats.lua local function CHUDResetStats() ... if playerInfo.teamNumber ~= 0 then

I think the above line also fails to take teamNumber 3 into account, but perhaps it is not sent? as the network description says teamNumber is 1|2.

peblpebl commented 6 years ago

I have just seen a match where at gametime = 0 there were too many on team 2.

if playerInfo.teamNumber ~= 0 then table.insert(CHUDHiveSkillGraph, { gameMinute = 0, joined = true, teamNumber = playerInfo.teamNumber, steamId = playerInfo.steamId } ) end

I would have expected that local kCHUDHiveSkillGraphMessage = { gameMinute = "float (0 to 1023 by 0.01)", joined = "boolean", teamNumber = "integer (1 to 2)", steamId = "integer", } would have prevented it to send the message? Or is the teamnumber converted (rounded or anded) to 2?

peblpebl commented 6 years ago

Doh another bug:

    maxHiveSkill = math.max(maxHiveSkill,hiveSkill[1]/curMaxPlayers,hiveSkill[2]/curMaxPlayers)
    minHiveSkill = maxHiveSkill

should be

    maxHiveSkill = math.max(maxHiveSkill,hiveSkill[1]/curMaxPlayers,hiveSkill[2]/curMaxPlayers)
    minHiveSkill = math.min(maxHiveSkill,hiveSkill[1]/curMaxPlayers,hiveSkill[2]/curMaxPlayers)

Otherwise the graph line can go under the graph LastRoundStats - below graph.txt

GhoulofGSG9 commented 6 years ago

Ranged network parameters get clamped to the range if they are set to something outside the given range.

I'll fix the issue later today. Please open issue tickets for any further issues for proper documentation.