GetDotaStats / stat-collection

Library for setting up stat collection for dota2 mods
http://getdotastats.com/
GNU General Public License v2.0
11 stars 8 forks source link

[SCHEMA] Hivemind #42

Open rapgameantimage opened 8 years ago

rapgameantimage commented 8 years ago

Console: http://hastebin.com/kojuxubayu.coffee Settings: http://hastebin.com/iraqobunut.vhdl Schema: https://github.com/rapgameantimage/hivemind/blob/master/game/dota_addons/hivemind/scripts/vscripts/statcollection/schema.lua Gamemode: https://github.com/rapgameantimage/hivemind/blob/master/game/dota_addons/hivemind/scripts/vscripts/gamemode.lua

jimmydorry commented 8 years ago

We can't support arrays like

https://github.com/rapgameantimage/hivemind/blob/master/game/dota_addons/hivemind/scripts/vscripts/statcollection/schema.lua#L74

Since you are implementing rounds, your stats get reported at the end of each round. This means that you only need to submit the game length for the round just finished, in the BuildGameArray().

You can always add onto, or change your schema at a later date... so drop the items for now if you don't have any.

@MNoya Will need to have a look at this, as he is more familiar than me with the way the library implements rounds support. This feature is not as well tested in the current version of the library, so your patience and ability to troubleshoot will be appreciated when bugs occur.

:fish:

jimmydorry commented 8 years ago

09:43 Noya the only thing necessary is just calling the statCollection:SubmitRound 09:43 Noya with an optional boolean 09:44 Noya when its the last round

The best method of testing if it works, is to try playing a game... and checking if your rounds are recorded. This won't be for testing your schema. If the normal round info works, then the schema should work too.

You can see recent games you have played by going to your public profile.

http://i.imgur.com/mjP5oVu.png

rapgameantimage commented 8 years ago

Aww, ok. I was not sure so I thought I would try ;)

I asked Noya about the rounds support in IRC a while ago and he said it's basically the same as everything else, I just have to call customSchema:SubmitRound() at the appropriate time.

I turned the array into just one variable and removed items. Are we good otherwise? Updated schema: https://github.com/rapgameantimage/hivemind/blob/master/game/dota_addons/hivemind/scripts/vscripts/statcollection/schema.lua

jimmydorry commented 8 years ago

Why are you adding the game lengths together?

Either your rounds are discrete, where progress is wiped completely between rounds... or it is continuous and should report a single game result.

And @MNoya is recommending you try statCollection:SubmitRound()

rapgameantimage commented 8 years ago

When you finish a game of Hivemind, the game asks all players if they would like to rematch, and starts over if everyone clicks yes. So I am treating a Hivemind "match" as a GetDotaStats "round". Hivemind's rounds are a separate concept and I don't feel the need for them to be separate "rounds" in GetDotaStats.

Hopefully that was not complete gibberish.

jimmydorry commented 8 years ago

In that case, you should re-initialise and get a new matchID.

rapgameantimage commented 8 years ago

Oh, I did not know I could do that. So I can just call statCollection:init() and customSchema:init() to do that?

And to submit my winner I would instead use statCollection:sendCustom({game=BuildGameArray(), players=BuildPlayersArray()})?

jimmydorry commented 8 years ago

You also need to manually send the stats at the end of each "game".

I think the process would look like:

jimmydorry commented 8 years ago

Also, don't forget to turn off rounds in your settings.kv

jimmydorry commented 8 years ago

On further consideration, you will need to remove some of the checks for data already being sent, which would mean modifying the library.

Let's see what @MNoya wants to do.

MNoya commented 8 years ago

@rapgameantimage don't worry about this, is too messy to do it at the moment, just send different rounds for now with statCollection:sendRound(bFinalRound), I'll try to clean up the library to support 'game reset' logic during this week hopefully

jimmydorry commented 8 years ago

It's statCollection:submitRound(false) by the way. Also, make sure to change that false to a true on the final round.

rapgameantimage commented 8 years ago

Hmm, ok -- if that boolean is necessary I guess I will need to make that be submitted after the players decide whether they are rematching rather than when the game actually ends.

Is the schema good though? Do I need to make any other changes?

jimmydorry commented 8 years ago

You should round your numbers (st and ht) to the nearest integer or floor it.

math.floor(split_time[PlayerResource:GetPlayer(playerID)]) or 0


You should have a version flag. Look at how PMP did it, and steal it.

https://github.com/MNoya/PMP/blob/master/game/dota_addons/pmp/scripts/vscripts/statcollection/schema.lua#L6 https://github.com/MNoya/PMP/blob/master/game/dota_addons/pmp/scripts/vscripts/pmp.lua#L3 https://github.com/MNoya/PMP/blob/master/game/dota_addons/pmp/scripts/vscripts/pmp.lua#L1255


Other than that, you are gucci.

MNoya commented 8 years ago

You can also send your own custom hero names instead of the default hero names if you want

jimmydorry commented 8 years ago

I was just thinking that too, @MNoya when I saw the bane.

Here is how enfos does it https://github.com/D3luxe/Enfos/blob/master/game/scripts/vscripts/statcollection/lib/utilities.lua#L9

jimmydorry commented 8 years ago

Your schemaID should be visible in your private mod list. http://getdotastats.com/#s2__my__mods

I wouldn't add it to your mod, until you can see that you have basic stats working.

rapgameantimage commented 8 years ago

Oh, I had my flags in my gamemode.lua. But I can move them into my schema and round my numbers.

The heroes are referred to in the code as bane, lycan, etc so I would rather be consistent.

Thanks! I will test it out.

jimmydorry commented 8 years ago

Look at how enfos does the translation. He uses all of the regular names, and reports their proper names for stats.

jimmydorry commented 8 years ago

You should check the values you are submitting. I am seeing a few 0 values for split and hero time.

jimmydorry commented 8 years ago

Something funky about your implementation. You seem to be sending the last round in each game twice, and sometimes without any custom values. Or maybe you are just not sending custom stats for the last round. I can't tell.

http://getdotastats.com/#s2__recent_games?p=3&m=104

rapgameantimage commented 8 years ago

I know, I need to fix it. Just hasn't been a high priority since the game doesn't have that many players yet anyway. On Nov 10, 2015 5:55 PM, "jimmydorry" notifications@github.com wrote:

Something funky about your implementation. You seem to be sending the last round in each game twice, and sometimes without any custom values.

http://getdotastats.com/#s2__recent_games?p=3&m=104

— Reply to this email directly or view it on GitHub https://github.com/GetDotaStats/stat-collection/issues/42#issuecomment-155594065 .

jimmydorry commented 8 years ago

It kind of screws up your stats a bit. :(

I also didn't realise that your match game value was just the round count. I thought it was a pre-select of the number of games people will play. It's already covered, so I've dropped it from your site schema. Please remove it from the schema in your mod at your earliest convenience.

Also, can you please floor your game duration? The extra precision is not necessary and is wasting space. It should look something like game.l = math.floor(game.l + v.length).

I'll make a PR for you shortly.