1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Hey Guest, is it this your first time on the forums?

    Visit the Beginner's Box

    Introduce yourself, read some of the ins and outs of the community, access to useful links and information.

    Dismiss Notice

End of the Match STATS

Discussion in 'Suggestions & Ideas' started by 8x, May 1, 2017.

Mods: Rainbows
  1. 8x

    8x Elimination Et Choix Traduisant la Realité Forum Moderator Tester Official Server Admin
    1. The Young Blood Collective - [YB]

    Something similar had been suggested, but not exactly the same:

    Make stats for gameplay, similar to what the steam achievements do (win or kill count for instance), for general information on the gameplay. I would like to know, perhaps at the end of a match:
    - how many blocks/doors/shops I built
    - how much stone/wood I used
    - how many tiles I dug
    - delivered hits or damage on enemy / teamkills
    - accuracy on slashes, jabs, shots
    - how many attacks I shielded
    - the height of the higher jump I made
    - how many metres I ran
    - how many explosives I used
    - how much money I wasted
    - how many trees I cut down

    I believe if Steam achievements do record some values, it wouldn't be hard to implement. @norill might have a say on this idea.
    Vampire, Nicuwins, Magmus and 6 others like this.
  2. Eluded

    Eluded Haxor Official Server Admin

    Yeah this wouldn't be hard to do I think.

    There's already GameplayEvents.as which detects when you place a block, when you damage a vehicle, when you cap a flag for example. This could just be extended to detect those other things you mentioned.

    Although creating a nice UI to display the info at the end of the game might be kinda hard since there would be a lot of information. If it was only displayed for your character it wouldn't be so bad, but if it was displayed for every player then that would be a ton of information to present neatly.
    Magmus likes this.
  3. stats needed by achievements are accumulated engine-side (implementing them was a major part of implementing achievements). but i think for your idea it would be easier to accumulate stats script-side. as Eluded mentioned there are GameplayEvents you could use for most of the stats.
  4. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Yeah I like it, this kind of thing has been floated internally a few times but I think the scope got blown out and then it sank down the todo again :) If it was "just script-side" and only for your player it wouldn't be crazy hard to do.

    I'll stick a new item on the todo to look at since it'd be nice to have something other than "dumb bugs" to work on and it might help with people's sense of progression.

    I wonder about maybe accumulating stats locally would be a good idea so you can see your own "global totals" and brag - it'd be easy af to edit the files of course, but where's the fun in that. Since it would just be on your computer there'd be no server infrastructure to worry about.
    ThePiemaster, bru-jaz and Magmus like this.
  5. makmoud98

    makmoud98 You are already DEAD Forum Moderator Staff Alumni Tester

    LAME go big or go home
    4zK, Magmus, Vamist and 1 other person like this.
  6. Fuzzle

    Fuzzle Grand Grumbler

    As a response to global statistics:
    Server-wise statistics would be rather interesting. However, it'd take its toll on performance: It'd have to constantly store values for all actors. Even worse; KAG has synchronous IO (as far as I'm concerned). Even if it's local it will affect performance.
    Last edited: May 2, 2017
  7. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Yep, that's why I'm only interested in storing a small amount of data for now and am undecided on storing global stats - the io is normal C buffered fwrite stuff so there's still a step or two between writing and hitting the disk, but this is the reason why the help stuff is laggy. It "should" be minimal perf hit for a handful of variables though.
  8. use script-side buffering maybe. keep stats in memory and dump to disk every minute or so
    Asu likes this.
  9. Asu

    Asu THD Team THD Team Forum Moderator

    I had the idea to make an extensive statistics mods (since @bunnie has been spamming me for months) and this looks like the sane solution to me. Once the texture stuff lands I might be back for some fun (I was thinking about stupid stats like activity heatmaps etc, which doesn't necessarily needs to be stored, just displayed on the match end, eventually shared at that time and ranked - could be simply synced on match ends). However, some of the ideas might need performance stresstesting because it might get bad in 32 player matches, especially since I'm fairly sure some players are forced to play at 15~20fps on bad hardware.
    What I was the most afraid of is having to patch individual scripts that would inevitably break on updates even though those are pretty sparse now. I thought of distributing such a mod as individual .patch es but that's only a workaround and that isn't convenient.

    As for storing data, TCPR is another solution, but it requires a server side solution that not everyone can use (gshost etc, but at least now the windows version supports TCPR). Today it doesn't look like people are really afraid of the blue tags so making a local mod can be a way more sane solution than the shitty hack KScript2 was using (but there was no much other choice back then). I assume that TCPR sends data in the networking thread which should be asynchronous to the main thread, which should be significantly more simple and fast.
    For a sort of global ranking using a storage backend wired up to TCPR syncing either on server start either on player join events or rank queries really shouldn't be that hard, and might be doable in a few hours of C++ writing.

    BTW, IIRC there is a hidden profiler option in KAG, but the last time I've tried it it just displayed an empty frame. Is it enabled only for debug builds, did I do it wrong or has it been dead for years?
    Last edited: May 3, 2017
    norill likes this.
  10. Geti

    Geti Please avoid PMing me (poke a mod instead) THD Team Administrator Global Moderator

    Of course - I wouldn't be hitting the disk for every read or write, the point I believe fuzzle was touching on was more is that if you end up taking lots of stats (even say 30 stats for a few hundred players) then you're going to get a short "freeze" whenever you save that out unless you're smart about it (and KAG doesn't provide any (non-tcpr) solutions for streaming or async i/o).

    For extensive server-side stuff I'd indeed probably recommend tcpr since that would have more flexible options for persisting to disk and querying it back later, like sqlite. You wouldn't have to worry about anything "blocking" and could use whatever libraries were most appropriate. I'm sure you could get the basics done in a day, but a proper "extensive" stats solution would be quite a bit of work and probably require some significant engineering kag-side as well in the form of stuff to render out your fancy stats with (graphs and so on) as well as just the bridge between tcpr and the kag-side stuff.
    Asu likes this.
  11. you could make ConfigFile.saveFile async easily, because you dont really need callbacks and everything. saving is fire and forget. loading would be a lot harder to make async, but you dont need it that much. or at all - you could make non-persistent stats for a single match only (but that would suck)
    Asu likes this.
  12. Fuzzle

    Fuzzle Grand Grumbler

    Implement three new methods: `saveFileAsync(string filename)`, `saveFileAsync(string filename, callback)` and `loadFileAsync(string filename, callback)` where `callback` is a lambda. `loadFileAsync` should pass its `ConfigFile` handle to the callback so the values can be read. Keep `saveFile` and `loadFile`: Sometimes it's necessary to block.
    Asu and norill like this.
  13. Asu

    Asu THD Team THD Team Forum Moderator

    I've begun writing the mod I'm thinking about. Will be pushed to GitHub when there's something to show.
    Last edited: May 4, 2017
    norill and Eluded like this.
Mods: Rainbows