get5loader
get5loader copied to clipboard
[API] Support pug match(not team)
not for team,for 10 personal pug match
Related #134 . e.g. "is_pug" in "match" table.
Related question about this - the way I organized ten man's was making two teams (Pug Team One and Pug Team Two) and turned off get5_check_auths 0
. Is there another way around this so stats are still tracked per player?
I think you can put steamids in form field on front-end, and POST it to API. Not sure if I chose this wat tho.
There's several way to implement pug,but every single choice has problem :
-
Create temporary team for each pug matches. PRO:Back compatibility with get5-web CON:API will generate teams in each match(but it also generates player_stats and round_stats for every matches, so it should'nt be big issue) Plus I need to think about member picks(captain picks,random,ELO-based,manual.)
-
Add "players" column on match table PRO:API won't generate team. CON:We'll lost compatibility with get5-web cuz get5-web can't find teams. get5-web will be bugged if it can't solve team.
-
Add "match_pug" table and manage pugs with that. PRO:its completely separated with original "match" table, so it won't affect original matches. back-compatibility safe. CON:implementing it is not easy(?) Like match list(/matches) shows match by "ID DESC" order,it can't be mixed. Also original get5-web can't see those pugs.
Thoughts? @PhlexPlexico
Hmmm, I think solution 3 would be the best to go if you want to keep backwards compatibility.
What I did (option 1) when organizing pugs through discord is I had two teams (Pug Team 1 and Pug Team 2) with empty player ID fields. When the selection through discord was done, it would assign each player into the given team, then do match setup. Once match is finished, it wiped away the teams from the player column (or should have). It was a very experimental feature I put in here and here.
That was my hack solution of fixing for pugs. I understand that get5 is not intended for pugs, but yeah. That was my workaround to play with the system as it currently was.
The good option with 3 is that if you have that match_pug
table, you can always just call a union on the table, and even check if the table exists first, and display if it doesn't, that should fix some compatibility issues.
TL;DR - Option 1 is fastest and it has caveats, esp. with captain picks on front-end, can have two static teams. Option 2 is de-normalizing DB as well, would be against. Option 3 is most complete and can put in enough checks to keep backwards compatibility, but indeed hardest.
Hope that helps :)
Thanks! I'll think to go with 3rd way. There's lot of things to think about to do 3rd way :P #166
One other way of approaching this actually - send in an incomplete match structure to the game side, or just set the API key with the hostname, and get people to setup pugs in game (i.e. call /get5 from chat). Provided the match is created in the DB with the API key, it should have no issue in updating playerstats during the match, right? Then teams/etc can be determined during setup in the game... Always a possibility.
I think that also works,but ppl who knows server password can freely enter the game(get5_check_auths?
).
and other players can't kick other guy if there's no admin.
but using icomplete structure approach is good imo,I'll think about it 👍
So coming back a year later here, I think I have figured out a good approach to this that takes care of tables from being clogged up. It's a bit messy on the DB side though, since it does allow some constraints to be changed.
- Allow
NULL
values onmatch
table team_ids. On delete team set null. - Bring over team names into
team1/2_string
field in thematch
table. - Create additional field labeled
is_pug
inmatch
table (default 0/false). This can be used to track stats of players in PUGs only. - Before match create, create two teams (I do this via discord bots to select teams) and label it as "team_{captainName}".
- Create match with
is_pug
flag set to1
- Send match structure to server (complete structure!).
- On the series finish call on your API, check if
is_pug
is set to 1, delete teams fromteam
table.-
player_stats
,team
,map_stats
, andmatch
I believe will have to have loose restrictions on theteam_id
FK constraint to allow NULLs and on DELETE SET NULL.
-
- Match is recorded, stats stay recorded, and you can now sort all your data based on PUGs as well.
The front end could have a "create pug" where a user can enter 10 Steam IDs and it randomizes the teams and captains as well.
Pros of this:
- Still close to original get5 tables, one column added.
- I think it should be backwards compatible with the original get5
- Sortable data based on games being pugs or not
-
get5_check_auths
can be enforced and no one should be able to enter the game.
Cons:
- Looser database restrictions
- Need to implement maybe another page that's "create pug".
This is the approach I use and I don't think I've found any issues with it so far. The workflow I have setup is:
- Create teams
- Create match
- Do vetoes
- Select Server
- Send complete match structure
- Delete from teams once match is complete
And it seems to work pretty well, the only thing increasing is the team ID
Sorry for late res, and thanks for nice proposal! I was so inactive to maintain this project tbh, I was using a lot of my time to do for another project actually thats great approach, back-compatibility and close to original structure(only one column).
I regret that I added so much functions even though project itself isnt so stable... I'll think to implement this approach, and way to improve stability of this project xd again thank you for proposal and focusing on get5-web-go, I'm promise to maintain this project once again!
duplicate #166