Skip to content
Snippets Groups Projects

Afktimer

Closed Ashnal requested to merge bird/Kart-Public:afktimer into master

Adds an afktimer

Default off. Keeps track of player inputs with a timer. Whenever input changes, the timer is reset. Whenever the node sends a netxcmd, the timer is reset.

Defaults off, but has four CVARS:

  • afkspectimer - how long someone must be idle to be forced spectator in seconds
  • afkspecignoreadmins - whether force spec applies to admins
  • afkkicktimer - how long someone must be idle to be kicked in seconds
  • afkkickignoreadmins - whether kicking applies to admins

EDIT: Only will force spectate during races, after the race start countdown.

Now only has two cvars:

  • afkspectimer - On/Off, whether the force spectate feature is active.
  • afkkicktimer - how long someone must be idle to be kicked in seconds
Edited by Sal

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Ashnal changed the description

    changed the description

  • Code itself looks fine and I've always wanted this feature. Not really a fan of how much Cvar complexity it adds for what little it accomplishes though.

    For context, in dev I've been keeping hidden options to an absolute minimum, and the ones that go in menus need to not be confusing or have significant overlap. Right now this would need an entire section of a menu screen dedicated to an AFK timer, which rubs me the wrong way.

    Could this be narrowed down to what server hosts might actually want to adjust? I feel like most options here will just get settled on as the "best values for server hosts", and won't get modified that often. While I can see the potential use case for "spectate timer, then a second kick timer", it feels like it's a really roundabout way of just having a long kick timer, could it just be a toggle between the two? I'm not really convinced that server hosts won't ever want ignoreadmins off, but I guess I wouldn't mind the option if it had to stay. I also don't feel like minimum players matters, I think you could just check for player counts less than 2 so someone waiting in free play doesn't get kicked out, or if that's not ideal, just remove the option entirely.

    tl;dr: my ideal Cvar setup would be "timer length", "kick or spectate", and if it had to be there, "ignore admins y/n"; make minimumplayers always 2.

  • I also think the cvars could be condensed a bit, but while I wouldn't use it personally, I can see a use-case for simultaneously enforcing AFK-spec and AFK-kick. Maybe you want to force-spec people after a short delay to make sure they're not obstructing play while they answer the door, but you also want to be able to force-kick people who are just squatting on the server doing nothing but taking up a slot.

    One cvar for a force-spectate timer (can hit admins, always enforced if the server is at 2+ players) and one cvar for a force-kick timer (can't hit admins, only enforced if the server is at maxplayers / ingamecap) seems cleanest without compromising on functionality?

    (I really don't feel strongly about enforcing both at once, but if it were set up like that, you also wouldn't really gain anything w/r/t simplicity by removing it—instead of two timer cvars, it'd be one timer and one mode-switch cvar. So may as well, I guess.)

  • That sounds good too! I just want it to be more simple -- 2 is a lot more reasonable than an entire 5 that most people will never touch (there's an extra cvar not stated in the description) :V

    Edited by Sal
  • My thought: The game has several hardcoded "best guess" timers already, including the 20 seconds you can join the game at the start of the round and not be instantiated as a spectator. I imagine the AFK spectator timer would be the same sort of thing that nobody would WANT to change very much if at all, and the slot kick timer would be the one which admins would want to change a lot depending on server context.

    Only other thing I can think of is some sort of UI alart for the timers about to be hit.

  • Author Developer

    Oh, good feedback! Originally I didn't think this needed to go into the menu, as it is mostly a tool for dedicated servers, which don't have a menu. Also, I wasn't sure of what the best settings would be, so I made them all configurable.

    Now though, I've been running this for a couple months on my server, so I have a good handle on what settings work well. I can take that and reduce the number of CVARs I think.

    I can probably reduce it to just the spec timer and kick timer. Does that sound about right?

    And Tyron, you're right on the money about my intentions and how I currently use it in my server. Speccing is to prevent people from obstructing the track in the very short term while they use the restroom/answer the door/get snacks etc. The kick timer is there for people who just left the game running for whatever reason and are taking up slots (but only while the server is almost full, since hogging a slot doesn't matter if others can still get in).

    I had originally ran into some issues regarding the countdown at the end of races and the voting screen. People would go afk during that time and get a little upset that they'd have to re-enter the game when they came back. For this reason the timer shouldn't ever be lower than the end of race timeout countdown.

    I currently run the spec timer a bit longer for that reason on my server. I may adjust the code a bit so that time during intermission doesn't count, so you can have lower spec timers that only go off during a race maybe.

    Here's a question for ya'll, do you think it's acceptable for someone to drag out the vote timer while they are afk? I know this happens all the time currently, but do you think it would be preferable to spec someone who is afk during vote, so that way if everyone votes it can proceed quicker?

    I'm leaning towards making the counter only count up as afk time if it is during vote or race before you've crossed the finish line, I'd appreciate some more opinions on the matter. I could also, with some logic changes, make the spec timer equal to just below the vote timer. So if you are afk during an entire vote, you get specced and won't be blocking people at the starting line. That would also remove spectimer as a cvar ...

  • Fair point about being intended for dedicated servers, but I still would argue that those kind of options should probably be intended for menus just because it does make the entry barrier lower, even for dedicated server hosts. When there's less hidden options, questions about hosting would be less of "does what I'm looking for even exist" and more of "what's the name for this option in the console"!

    (BTW, doesn't exactly need to go into the menu for this version if you don't feel like diving into the dumpster that is the menu code. Mainly just mentioning so I don't have to figure out what to do with them myself whenever I get around to finishing v2's redone menu system :P)

    I do think this should only run during gamestate == GS_LEVEL rather than always. Idling during vote is fine and I'd say it does not deserve kick/spectate personally, the intermission/vote timers themselves are what's meant to keep things moving during those screens. But making someone who was afk for the entire vote spectate at the beginning of the next race sounds good too!

  • Author Developer

    Alrighty, I'm working on making the timer only count during vote and level. DO you think it should be default on? I had it default off as an inclusion for birdhouse, since I like stuff to be optional in that.

    I was considering a default of 19 seconds, that lines up with the default vote time of 20 seconds. Scenario: Player is racing and finishes, they get get up while everyone else is still finishing. During player.exiting, timer is is reset, so that doesn't count. Timer does not roll during intermission. Timer starts again during vote at 0. Player does not return to vote, is spectated at 19 seconds, one second before default vote time, so they will not obstruct the start of the race.

    A thought I had with this line of logic would be to just make the timer always be votetime-1 seconds, rather than be a configurable cvar. Its a time that works in race .... unless a server pops up that likes to use really long vote timers I guess.

    As for the kick timer, if I had to go with a default I'd say 15 minutes is a generous default. I've been running 15 minute kick timer for a while now without any afker reports, nor any complaints from people who got kicked with this time.

    Edited by Ashnal
  • Ashnal added 1 commit

    added 1 commit

    • 12f1474e - Remove CVARs for admin ignoring

    Compare with previous version

  • Counterpoint: What about votetime plus one, because people can take some time to figure out what to vote and I don't know if up/down inputs while looking at the voting list are communicated over the net, only the vote finalisation

  • Author Developer

    I can answer that. Inputs are counted during voting. Specifically any directional input, a vote, or chatting. So it would only trigger if someone was afk for the entire voting time. Votetime-1 also prevents them from diluting the vote pool with their auto-random vote.

    There is a bit of an edge case I just discovered though that I need to adjust. If you vote right away, then wait without input, you'll cross the threshold during the roulette. So I have to fix that circumstance.

  • Ashnal added 1 commit

    added 1 commit

    • 07a28963 - Adds some more nuance to the afktimer

    Compare with previous version

  • Maintainer

    I'll say this here as well; I'd like some warning on the hud that tells the player they're about to be spectated/kicked.

  • Author Developer

    Do you think a pm from the server, like the motd, would be sufficient?

  • Maintainer

    Considering how often the motd goes ignored, probably not. I was also thinking of something that'd be vsibile for a few seconds.

  • Author Developer

    So, something more like a client specific CSAY?

  • Maintainer

    Yeah that could work.

  • Ashnal added 1 commit

    added 1 commit

    • 712453c2 - Implemented server pms as warnings for the afktimer

    Compare with previous version

  • Ashnal added 1 commit

    added 1 commit

    Compare with previous version

  • Ashnal added 2 commits

    added 2 commits

    • 4298aa72 - Change afkspectimer CVAR to On/Off default On
    • 580845d8 - Reapproach. Force spec only happens during race.

    Compare with previous version

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
Please register or sign in to reply
Loading