Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add match making and improve match interactions #18

Open
wants to merge 29 commits into
base: master
Choose a base branch
from

Conversation

arthurmelton
Copy link
Collaborator

This is a work in progress pull request to try and implement some sort of match making. This is also in the works with @Acoliver102

Currently the plan is to use Glicko2 to get the rating of user.

Once the rating of a user is in the database we will use a version of the knapsack-problem to create the teams. There is a minimal function to create these teams to try and be as balanced as possible at https://pl.kotl.in/Cij84blms. For 10 players the amount of lists that will have to be made is 600 ((n/2)!*n/2). This should be fast to compute and will give us the closest the teams can be skill wise.

The plan is to try and have some way for servers to know what team won and will report back to fang what team won. Fang will store the teams it made internally allowing for fang to automatically update the scores of users without anyone having to run a command. There might also be a command telling fang to not update the scores for the current game because teams will be played that are are not the fang recommended teams.

@arthurmelton
Copy link
Collaborator Author

For getting the team that won, the server could save the team that won for 5-10 mins after the game ends so that once people click gg in fang, it can make a request for the outcome of the game. I dont know how the server can find out who won the made I know @Acoliver102 was talking to me about it in dms.

@arthurmelton
Copy link
Collaborator Author

I might also add the ability for fang to take in a file that just has the winnings and loosing built into them so we don't have to start from scratch. We could make it so that each line looks like this (the player tag would be discord snowflake of each person)

player1 player2 player3 player4 player5 player6 player7 player8 player9 player10

It could just take the first half of the players, count them as the winning and make the rest the loosing.

@arthurmelton
Copy link
Collaborator Author

It also looks like servers can tell who won by running this regex (?<=ScriptLog: \(RXPAWN_)(NAGA|GRIFFIN)(?=_CONTENT_0\) RXPAWN::DYING:DESTROYED) on the log. This is saying what guardian died, so if you get NAGA then Leiren won. If you get GRIFFIN, Grenn won. The servers could store the last games log for ~5 minuets after it is done. Once fang understands the game is done then it could make a request for the server asking for who won. If the server does not have the outcome still then it can be assumed that the game either did not finished or someone had to drop.

@arthurmelton
Copy link
Collaborator Author

I also cant get dotnet working on my device so I wont be able to add a way for the server to check for who won.

I believe BigBoot/GiganticEmu/GiganticEmu.Agent/ServerManager.cs#L25 is a way to access the logs so there would just have to be some function that applys the above regex to it.

If @Acoliver102 want to try and implement that you can, then I could add the way for fang to actually ask the server for that info.

The way for fang to ask for the data should be like a result endpoint or something that returns an object / class. This is because there could be some other info that we might want to send to fang for logging reasons.

@arthurmelton
Copy link
Collaborator Author

I have also gotten the results of ~400 games from october/november to early may. I have converted it to 285 games. I will get a local version of fang to run the numbers and see if the teams it comes with are actually usable or give something playable.

@arthurmelton
Copy link
Collaborator Author

Just played 2 games with the teams that the bot gave and they were pretty good. I think this could actually work and make match making better.

@BigBoot
Copy link
Owner

BigBoot commented May 27, 2023

Hi,

first of all thanks for you continuous efforts, even though I've been mostly unavailable, would you be interested in collaborator access to the repo so you can get your changes in faster?

As for this MR the general directions already looks great, here's some of my thoughs:

  • The whole feature should be disable-able either globally as a config option or per queue
  • The match should only count if it is set up using the "set up a server" feature
  • We need to provide some way to mark a match as "unranked", either because people decided to switch teams up anyway or because something unexpected happened during the match.
    I think for the start an additional button on the match finished/drop out menu would suffice, which then results in a Message like "The match has been marked as unranked by username, ranks will not be affected", maybe the button can first show some kind of "are you sure bla bla bla..., abuse will lead to penalties" message before actually adding the mark.

I believe BigBoot/GiganticEmu/GiganticEmu.Agent/ServerManager.cs#L25 is a way to access the logs so there would just have to be some function that applys the above regex to it.

I don't think it will be that easy, I haven't been able to redirect the stdout/stderr of the game while keeping the window hidden back then (and I don't have access to a windows machine currently where I could test this). That's why I read the log file in the ye olden days. But even there the game behaves weirdly and only write the log changes when it detects another program opening the file so I had to keep reopening the file in a loop, which then led to e.g. svens infamous feet problems 😆 I'm not sure what the best course of action would be here though. 🤔

I also cant get dotnet working on my device so I wont be able to add a way for the server to check for who won.

I'm not sure why it shouldn't work, dotnet should be available basically everywhere I think, you just need to make sure you're installing the correct version (dotnet 6) including the aspnet runtime

@arthurmelton
Copy link
Collaborator Author

Hello, hope you are doing good!

would you be interested in collaborator access to the repo so you can get your changes in faster?

Since you still hosting fang, I don't know if much would change as you would still have to manually update fang. If you setup some script on the hosting device to automatically pull the changes from the GitHub then it could be beneficial.

With all of the points you said, I do agree with them and will try and get those working in the end.

I don't think it will be that easy, I haven't been able to redirect the stdout/stderr of the game while keeping the window hidden back then (and I don't have access to a windows machine currently where I could test this). That's why I read the log file in the ye olden days. But even there the game behaves weirdly and only write the log changes when it detects another program opening the file so I had to keep reopening the file in a loop, which then led to e.g. svens infamous feet problems laughing I'm not sure what the best course of action would be here though. thinking

Since the way I am thinking of currently implementing this where fang is only going to send one request to the server. We wont need to continuously reopen the file. We should only have to read the log once. If we are going to have to read the log manually then we could also use the built in timestamp at the end of the log. That should make it so that if the game does not actually go through it wont count the game as the most previous log would be too old.

I'm not sure why it shouldn't work, dotnet should be available basically everywhere I think, you just need to make sure you're installing the correct version (dotnet 6) including the aspnet runtime

I don't know if you have ran into this issue, but I use a custom built Linux kernel and dotnet really has no idea what to do. It tries and download the version that my system needs, but because it does not recognize what I am it tries and downloads the default (the windows version). @Acoliver102 can build the agent and they might try and do the changes. I dont know how much time they will have to work on it, but I do have a windows VM if it takes him a while.

@arthurmelton
Copy link
Collaborator Author

#16 might not be needed because of this, but I am just going to keep it there just in case.

@arthurmelton
Copy link
Collaborator Author

I believe everything that bigboot said should be implemented is implemented. The only one I did not explicitly code is The match should only count if it is set up using the "set up a server" feature because this should already work. It is going to ask the server for the results of a game on a specific port. This should make it so that if a game is played on a different port or something it wont add the results.

Arthur Melton added 2 commits May 28, 2023 10:42
Some new players got confused in testing becaues they had to go to team 2 but there was only a ?team=0 and ?team=1
@arthurmelton
Copy link
Collaborator Author

Sense I am not a collaborator on GiganticEmu, @BigBoot if you could look at BigBoot/GiganticEmu#5 and or this commit. I can send screenshots on how it looks but currently it should all be working.

@arthurmelton arthurmelton marked this pull request as ready for review May 31, 2023 01:27
@arthurmelton
Copy link
Collaborator Author

arthurmelton commented Jun 1, 2023

Also for record keeping, tldr Bigboot feels that these changes should be handled in gig emu and it will use the GiganticEmu.Launcher to know the players then GiganticEmu.Web to handle the actual ratings. If you got it fully right fang is going to send something to tell the servers that the game was ranked or not then the servers will report to GiganticEmu.Web to with the scores.

@arthurmelton
Copy link
Collaborator Author

I am changing the scope of this pr to add ratings and just make the matchmaking system better all around.

@arthurmelton arthurmelton changed the title [WIP] Add match making [WIP] Add match making and imrove match interactions Jun 4, 2023
@arthurmelton arthurmelton changed the title [WIP] Add match making and imrove match interactions [WIP] Add match making and improve match interactions Jun 4, 2023
@arthurmelton
Copy link
Collaborator Author

arthurmelton commented Jun 7, 2023

This is my current checklist

  • Match Making
  • Drop button
  • Swap people
  • Ready check

@arthurmelton
Copy link
Collaborator Author

Maybe a ready check is not needed in the bot, its not done that often.

@arthurmelton
Copy link
Collaborator Author

@BigBoot This is the way I think this should work as it wont require people to link your mistforge account with discord. It will allow people to create swaps and request for a fill allowing for pretty much every way that the teams could change.

@arthurmelton arthurmelton requested a review from BigBoot June 16, 2023 13:44
@arthurmelton arthurmelton changed the title [WIP] Add match making and improve match interactions Add match making and improve match interactions Jun 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants