#Player AFK Detection

1 messages · Page 1 of 1 (latest)

weary valve
#

Howdy! I made a spelling bee game, and when someone on vr takes off their headset without leaving the room, everything just breaks when it's their turn. The timer for the word stops, the word audio doesn't play, nothing that needs to fire fires until they disconnect, which can be 3-10 minutes before that happens... how can I prevent this from happening?

viscid mason
#

Well, there is a "Is player afk" chip

#

That would be my first try

#

And if that didn't work for some reason, I would check the velocity of there head, and if under a certain threshold for long enough, send them to dorm or another subroom

tawny ruin
#

you can change the interval between checks but dont make it too small

weary valve
tawny ruin
weary valve
#

Because you can try to votekick/softban them yet it doesn't work until they de-log

#

So just have room auth check for them?

#

What if room auth is frozen 💀

tawny ruin
#

basicaly this

weary valve
#

I might just have the room auth be pinged by someone random and if it doesn't get received then room auth is frozen.

tawny ruin
# tawny ruin

this might fry the net heat so you can try to decrease players that check or add some randomness (f.e. every player has 1 out of 5 chance to check everyone else)

molten sigil
#

not even

tawny ruin
molten sigil
#

3 things to note:

  • Sending an empty event to all players is extremely cheap
  • Sending an event to all players is the same net as sending it to 1 player
  • Network heat is a measure of data sent per second, if you send the signal once every second, all net heat the first signal caused will be cleared by the time the second signal is sent
weary valve
molten sigil
#

Just have everyone send a signal to everyone every second

#

If you dont receive a signal from someone after a certain timeframe (say, 5 seconds), then you know they have stopped sending pings

weary valve
#

So then how would you detect if someone doesn't receive it: and also how do you get who that is?

molten sigil
molten sigil
weary valve
#

I'm so lost lmao

molten sigil
#

have everyone tell everyone the player who sent the signal

#

You dont give a shit if they got the signal or not, you only care if they are sending signals to you

#

If they arent sending signals to you, they are frozen

#

Everyone sends everyone signals every second

#

Lets say it was a two way ping system

PlayerA sends a ping to PlayerB
How does PlayerA know that PlayerB was pinged? well, lets have PlayerB send a ping back... wait, how does PlayerB know that PlayerA received their ping?

tawny ruin
#

basicaly each iteration you save every ping into a player list
compare that list to "all players" list
if there's an elements that only shows in all players but not in your custom list that means that players doesnt send signals

prob not the best solution but first thing i could come up with

molten sigil
weary valve
#

My solution: quit 😄

tawny ruin
#

oh

weary valve
#

nah I'm just playing

tawny ruin
#

you should playe enigmatica 2: expert fr fr

#

for normal ppl, it's a very hard tech modpack for 1.12.2

weary valve
weary valve
#

sweet

molten sigil
#

Well, no...

#

For the most efficient check, check at 60hz
For a check thats good enough, you can just check after sending your ping signal

#

If you're sending a signal every second, and you assuming everyones ping is under 4000, then you can have the timeout duration be like, 5 seconds, 1 second for the ping delay, 4 for networking delays

weary valve
#

Wait what would I set their variable as?

#

Just delta time?

molten sigil
#

you set it to Instance Get Lifetime

#

that way you can check Current Lifetime - Stored Lifetime = time thats passed since last signal

weary valve
#

But what would I set the list<float> as?

#

Like when a player joins do I add their index to it or something?

weary valve
molten sigil
jaunty ether
weary valve
molten sigil
#

If your subroom supports 16 players, initialize the list to have 16 elements

weary valve
#

So just set the list to a list create with 8 items?

molten sigil
#

when the local player joins, yes

#

Alternatively, you could also set the list everytime you check

#

So, every time you check, if the list has 0 items, set it to 8 items, else do nothing

weary valve
molten sigil
#

no...

#

Send an event to all players

When the LOCAL PLAYER receives a signal from A PLAYER, get THAT PLAYERS room index, and set the value at THEIR room index to instance get lifetime

broken rover
# molten sigil yeah

Can you boot them if they're in that state of having their headset off but not being fully out of the room?

molten sigil
#

No idea about sending them to different rooms, but you can remove them from your custom game

weary valve
molten sigil
#

checking the values and setting the values are different

#

send the event Ping Time to all players once per second, all that should do is set the List Set Element

weary valve
#

Ok

molten sigil
#

I hate that circuitboard, but yes, now you have the ping system setup

#

Now you need to be able to check the time of the last ping for each player

#

btw, for a rate limit system, do this

#

Function, looks way nicer, way cheaper on chips

weary valve
#

Oh okay

#

Ok I'll check up when I get this part done

weary valve
#

There's nothing in my palette for functions

molten sigil
weary valve
#

Yup found it

#

That add is in the way what ports is it outputting to?

#

I did something wrong with it but idk what because it is not executing once per second...

viscid mason
weary valve
#

Yeah I did

viscid mason
#

Then connect that to a if

#

The result

weary valve
#

Ohp got it!

#

I had the greater than backwards

weary valve
weary valve
# molten sigil `call Rate Limiter`

Alright I got here. I changed the event to only send to others instead of all because if it's on all the list will store twice in one second. But here it's able to detect other players who are afk

molten sigil
#

the time will always be 0

#

You need to check ALL players values when YOU send a signal, so after YOU send Ping Time

#

that, or you could also do it at 30hz

#

Your check time should be less or equal to the ping delay, so with a 1s ping delay, you can check every time you send or faster (like 30hz)

#

faster is technically more accurate, but doing it every time you send should have the same effect

weary valve
#

Ok is it bad if I ask for a visual? I am very confused on what to do 🤣

jaunty ether
broken rover
molten sigil
broken rover
#

It's been a long while since i've had this happen so i may just be misremembering or it may have changed, but doesn't it affect all players in the instance?

jaunty ether
#

Why would 1 person freezing up cause other player's circuits to stop working?

weary valve
#

It doesn’t. The issue is when it’s their turn, the timer for spelling stops, which means they can’t spell and the game freezes

#

Essentially breaking it for everyone

broken rover
jaunty ether
broken rover
#

Ah, didn't know it had anything to do with room authority

tepid mica