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] Petri Reborn #72

Open TideSofDarK opened 8 years ago

TideSofDarK commented 8 years ago

Link to your console log http://hastebin.com/kifefitoco.vhdl Link to your settings.kv http://hastebin.com/kebikozovi.vhdl Link to your schema.lua http://hastebin.com/ihopenesaz.lua Link to your Lua files that defines the functions you pull stats from http://hastebin.com/hesabavoqi.coffee http://hastebin.com/jomedupapi.lua

TideSofDarK commented 8 years ago

Updated names to be a bit shorter, is it okay? schema.lua http://hastebin.com/fubakuwizo.lua

jimmydorry commented 8 years ago

Great.

I would recommend a player value for whether they are hunter or prey (don't remember the name you gave the two teams).

I also recommend a game value for whichever team won, and a game value for duration (round or floor it).

If you need an example or are happy with this schema as it is let me know.

Make sure to update your library. A lot of small changes have been made in the last few months.

TideSofDarK commented 8 years ago

Ok thanks for answer. How should i describe game winners? Actually game is won by two specific players and not whole team. So i disabled "GAME_WINNER" to manually set winners but i dont know how

MNoya commented 8 years ago

You can do it this way:

function BuildRoundWinnerArray()
    local winners = GetPetriWinners()
    for playerID = 0, DOTA_MAX_PLAYERS do
        if PlayerResource:IsValidPlayerID(playerID) then
            if not PlayerResource:IsBroadcaster(playerID) then
                winners[PlayerResource:GetSteamAccountID(playerID)] = winners[playerID] and 1 or 0
            end
        end
    end
    return winners
end

GetPetriWinners will return a table with the playerID indexes of those that won

function GetPetriWinners()
   local winners = {}
   for playerID = 0, DOTA_MAX_PLAYERS do
       if PlayerResource:IsValidPlayerID(playerID) and PlayerIsWinner(playerID) then
          winners[playerID] = true
       end
    end

    return winners
end

How you define PlayerIsWinner is up to you

jimmydorry commented 8 years ago

You may also just be able to extend your existing winners functions. Let me look for a bit longer.

Line 595 and 616 of http://hastebin.com/jomedupapi.lua

TideSofDarK commented 8 years ago

@MNoya so i have to make stat-collection round-based to use this?

jimmydorry commented 8 years ago

No! Can you just clarify exactly who wins? I might not be understanding correctly. To me, it looks like you are setting either DOTA_TEAM_GOODGUYS or DOTA_TEAM_BADGUYS to win.

TideSofDarK commented 8 years ago

@jimmydorry there are kvns and there are petrosyans. if one of the kvns dies - he turns into mini-actor and moves to petrosyans team. however if petrosyans win - these mini-actors should lose anyway because they started as kvns

jimmydorry commented 8 years ago

Can you come up with a function that can tell you if the passed player has won or not? i.e. isPlayerWinner(player)

I don't think your current PetrosyanWin() and KVNWin() functions do what you just described.

If you can make that function, then it's rather straightforward to get the arbitrary teams working correctly.

TideSofDarK commented 8 years ago

@jimmydorry they dont because i don't need such functionality without stat-collection. but i want to submit correct winners to stats. So OK i added GameRules.Winner = DOTA_TEAM_GOODGUYS and GameRules.Winner = DOTA_TEAM_BADGUYS to KVNWin() and PetrosyanWin(). Now i can use such func to check if player is winner: http://hastebin.com/izezidobuc.lua

jimmydorry commented 8 years ago

Try this as your schema. http://pastebin.com/5tzddTTg

The important part is line 30, 122, 135. You will want to review it, as I have likely made a mistake or two.

TideSofDarK commented 8 years ago

@jimmydorry ah, that's it. http://hastebin.com/evedemapag.lua here is new schema, it should work alright

jimmydorry commented 8 years ago

What does ConvertTime() do?

TideSofDarK commented 8 years ago

@jimmydorry return string.format("%.2d:%.2d", time/60%60, time%60)

jimmydorry commented 8 years ago

You definitely don't want to format those strings. Send them as an integer math.floor(GAMEMode.FIRST_BAG), so they can be properly grouped to give ranges of time.

The other two suggestions stem back to before. You should have a team value for players (Petri or KVN), and a winning team value in the game array (Petri or KVN).

jimmydorry commented 8 years ago

For the player team, something like:

-- Team string logic
local player_team = ""
if hero:GetTeam() == DOTA_TEAM_GOODGUYS then
    player_team = "Petri"
else
    player_team = "KVN"
end

The game value for winning team, will require a bit more work.

jimmydorry commented 8 years ago

Also, I would make the ks and ps a default of ''. That way the stats for people that don't make a score on one of the teams won't drag the average down.

I would also make a player value to show if they got converted, unless you make the team string for three teams: KVN, Petri, mini-petri

And one more player value for if they ended the game dead.

TideSofDarK commented 8 years ago

@jimmydorry http://hastebin.com/ekoqopixob.lua updaed it. GameRules.Winner is set just before GameRules:SetGameWinner

jimmydorry commented 8 years ago

Alright looking good now. I would recommend considering the other three suggestions above... but this schema is ready to be approved if you are ready.

TideSofDarK commented 8 years ago

@jimmydorry you mean combine score? ok. also added BMA (became mini actor). and i dont think we need player value for dead players. http://hastebin.com/qatiyevoni.lua here is final version.

jimmydorry commented 8 years ago

Not combined. I meant blank. Lots of 0 values would pull down the average for all of the legitimate scores.

ps = petri_score or '',
ks = kvn_score or '',
jimmydorry commented 8 years ago

Your schema has been approved (with the two score fields). Please double check I didn't make any mistakes in field names or display names.

https://getdotastats.com/#s2__mod_schema?mid=99

Your schemaID is here: https://getdotastats.com/#s2__my__mods

TideSofDarK commented 8 years ago

@jimmydorry Please change First Money to First 100k Networth. Other things seems alright. Can i upload my game now? I set new schema ID and testing to false.

jimmydorry commented 8 years ago

Yes, good to go. You should share post your settings file here (with XXXXXXX for modID and schemaID).

TideSofDarK commented 8 years ago

http://hastebin.com/sufomozama.vhdl here it is

jimmydorry commented 8 years ago

Are you sure you want MIN_PLAYERS of 3?

Looks good. Let's hope you get some good data.

The graphs will start updating again on the weekend, but all of your data will be collecting in the meantime.

TideSofDarK commented 8 years ago

@jimmydorry well what does MIN_PLAYERS count? if game started as 12 players then 9 leave will it count as 12players lobby? or as 3players?

jimmydorry commented 8 years ago

12 players.

The min_players just means no stats get sent at all if it starts with less than 3 players.

TideSofDarK commented 8 years ago

@jimmydorry good to know ! then i will make it 8

jimmydorry commented 8 years ago

That will drastically reduce your number of games!

Until you get heaps of games a week, you probably want to set it at 2, and increase it as the number of fuller games increases.

TideSofDarK commented 8 years ago

@jimmydorry we do get nice amount of games. petri constantly get 8-12 place in top so its ok. you know there were times when petri was top3 custom game with 4k online. Now it barely gets 1k on weekends but still lives. Well i set it to 6 so.. dunno

jimmydorry commented 8 years ago

Good luck!

TideSofDarK commented 8 years ago

@jimmydorry Thanks for help! Have fun!

K1llMan commented 8 years ago

@jimmydorry What request I need to send to "getdotastats.com" to get top players info in Panorama? Where are listed full amount of possible requests?

SinZ163 commented 8 years ago

There currently is no public API to get information back from GetDotaStats

jimmydorry commented 8 years ago

Make an issue on what you want here: https://github.com/GetDotaStats/site/issues

I have a big backlog of features to implement. Making an issue means I won't forget it.

K1llMan commented 8 years ago

@jimmydorry https://github.com/GetDotaStats/site/issues/184 Any progress with this issue?

jimmydorry commented 8 years ago

Current priority is getting all functionality back online. I migrated the site to a beefier machine, as it is now proccessing upwards of 500 queries a second, but I had to temporarily disable the long running crons.

Keep an eye on https://github.com/GetDotaStats/site/issues/254 and https://github.com/GetDotaStats/site/issues/244

After those two is the API for leaver and player summary. And then is highscores.

That makes highscores soon, but later than originally planned.

Performance stats that made the cron changes necessary: https://getdotastats.com/#site__service_stats

TideSofDarK commented 8 years ago

sendStage2 ERROR Stat Collection: You need to call the init function before you can send stats! What can cause this?

jimmydorry commented 8 years ago

You need to look up further in the log. It means you didn't sendStage1, and as the match is not registered (to get its matchID), you can't have stats for it.

TideSofDarK commented 8 years ago

Well i set "OVERRIDE_AUTOMATIC_SEND_STAGE_2" to "true" and added statCollection:sendStage2() in GameMode:OnGameInProgress(). Is it enough or i need to do something else?

jimmydorry commented 8 years ago

No, don't do that! You just needed to look further up in the log, to see what Stage1 was saying. Either way, we had a small outage due to upgrades. You probably won't get the error any more.

SinZ163 commented 8 years ago

The Stage2 Override doesn't make stage2 magically work, it just makes it not automatically be called. sendStage2() itself checks if stage1 has been sent and received.

TideSofDarK commented 8 years ago

I started to use it a day ago because i really do need to start game only after GameSetup process. Otherway games that crash during gamesetup will count as yellow (game started). So how should i deal with OVERRIDE_AUTOMATIC_SEND_STAGE_2 ? I already have statCollection:sendStage2() in GameMode:OnGameInProgress().

SinZ163 commented 8 years ago

Phase2 / Stage2 is sent only when PRE_GAME is hit by default, and the only time you ever need to change when its sent, is if you have bad design and need to set flags after hero selection

jimmydorry commented 8 years ago

The only time you want to OVERRIDE_AUTOMATIC_SEND_STAGE_2 is when you are setting flags after the game has started (i.e. you want to delay stage2).

I doubt you are doing that, so put everything back to default.

TideSofDarK commented 8 years ago

Well then i will get rid of that override and check "game ended" ratio next day with my new updates to win condition checking. Currently i have 10% of games ended because of my shitcode so i want to fix this as soon as possible. Thanks.