Whats your favorite way to detect afk players (to eg start a kickvote)? I know there are two apm players scores but they seam to act a bit strange and i dont know if they are reliable enough.
It depends on how your game works. If you have something that's turn-based that requires every player to be present, throw in a timer that skips or ends a player's turn when it expires. If a player is actually there and needs more time, you can add a pop-up that asks "Do you need more time?" and, if the player clicks "yes," restart the timer.
Otherwise you would need to track unit movement or APM or some other measure depending on the circumstances.
Assuming this is a simple player goes afk -> kick vote, I'd have a timer for each player (arrayed integer variable, one indexed to each player at their player number, periodically (not necessarily the event)) one integer gets subtracted from the variable at all indexes every second, when it's subtracted check whether any of the possibly 15 are 0, if they are initiate your kick vote actions, every time a player mouse/key clicks/moves (dialog clicks don't count) set the arrayed timer variable at the index of the player to an arbitrary 60.
If you're just using it for some background stuff, like AFK tracking, the delay associated with the mouse/key events should be immaterial. And I don't think that it's that big of a delay nowadays, anyway.
Not sure what you mean by the APM scoring being "weird." I haven't done much work with APM myself, but AFAIK it's an average so it might never reach 0 if the player has made at least 1 action. I suspect it might be a rolling average, so it only gives the average APM for the past X seconds, but I can't confirm.
re-setting a timer with every input also came to my mind. But I guess it would create an unnessesary amount of traffic if every input has to be captured and a trigger shoots every time!? Thats why I thought it would be best to use the APM score variables, but one of them seams to be an actual (but very short termed) value and the other one... yeah is it a rolling average?
Yeah I am not worried about the performance of the code but of the trigger events. The blizzard tooltip for e.g. pressed Buttons as a trigger event is that it should only be used if absolutely nessesary because it will create a lot of network traffic.
Well supposing one APM value is very short-term, that would mean it would frequently drop to 0 if the player were thinking about his next action or had to use the bathroom or something. One of the things you could do, then, is use a While loop to detect the current APM of each player, then increment a real or integer variable for each second the player remains below a certain threshold (10 APM or something.) If the player breaks the threshold within a time span of, say, two minutes, reset the incrementing variable to 0. Otherwise, continue counting up until the incrementing variable reaches the two-minute mark, then initiate the kick-vote process on that player.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Like the title says.
Whats your favorite way to detect afk players (to eg start a kickvote)? I know there are two apm players scores but they seam to act a bit strange and i dont know if they are reliable enough.
So does anyone detect such players and how?
It depends on how your game works. If you have something that's turn-based that requires every player to be present, throw in a timer that skips or ends a player's turn when it expires. If a player is actually there and needs more time, you can add a pop-up that asks "Do you need more time?" and, if the player clicks "yes," restart the timer.
Otherwise you would need to track unit movement or APM or some other measure depending on the circumstances.
No turns.. simple real time... APM scores acts kind of weird doent it?
@Freddy2287: Go
Assuming this is a simple player goes afk -> kick vote, I'd have a timer for each player (arrayed integer variable, one indexed to each player at their player number, periodically (not necessarily the event)) one integer gets subtracted from the variable at all indexes every second, when it's subtracted check whether any of the possibly 15 are 0, if they are initiate your kick vote actions, every time a player mouse/key clicks/moves (dialog clicks don't count) set the arrayed timer variable at the index of the player to an arbitrary 60.
If you're just using it for some background stuff, like AFK tracking, the delay associated with the mouse/key events should be immaterial. And I don't think that it's that big of a delay nowadays, anyway.
Not sure what you mean by the APM scoring being "weird." I haven't done much work with APM myself, but AFAIK it's an average so it might never reach 0 if the player has made at least 1 action. I suspect it might be a rolling average, so it only gives the average APM for the past X seconds, but I can't confirm.
This topic is a bit dated but may be useful:
Retrieving APM for Triggering Player
Instead of an integer array, just use a timer array and restart the timers everytime a player does an input.
Once a timer expires, start the kick vote for the corresponding player.
re-setting a timer with every input also came to my mind. But I guess it would create an unnessesary amount of traffic if every input has to be captured and a trigger shoots every time!? Thats why I thought it would be best to use the APM score variables, but one of them seams to be an actual (but very short termed) value and the other one... yeah is it a rolling average?
Dont be worried about performance, just write easy to understand and well designed code.
Optimizing critical parts can be done later.
Yeah I am not worried about the performance of the code but of the trigger events. The blizzard tooltip for e.g. pressed Buttons as a trigger event is that it should only be used if absolutely nessesary because it will create a lot of network traffic.
@Freddy2287: Go
Well supposing one APM value is very short-term, that would mean it would frequently drop to 0 if the player were thinking about his next action or had to use the bathroom or something. One of the things you could do, then, is use a While loop to detect the current APM of each player, then increment a real or integer variable for each second the player remains below a certain threshold (10 APM or something.) If the player breaks the threshold within a time span of, say, two minutes, reset the incrementing variable to 0. Otherwise, continue counting up until the incrementing variable reaches the two-minute mark, then initiate the kick-vote process on that player.