Jimboom7 / AlphaJong

A Mahjong AI for Mahjong Soul
GNU General Public License v3.0
396 stars 54 forks source link

AFK detection triggered on firefox #54

Closed keyarz closed 2 years ago

keyarz commented 2 years ago

it will pop out AFK detection windows on firefox and activate auto draw & discard for you makes you lose the game

Jimboom7 commented 2 years ago

Did you minimize the browser or use another tab while the game was running? It's okay to use other programs while the bot operates, as long as the game is open. But if you minimize the game it will be detected as afk.

keyarz commented 2 years ago

No i didn't minimize or change tab, i have dual monitor, it just not compatible with firefox not sure why? Is there a chance my firefox addon (adblock) blocking it? It run smooth on chrome which is what i using now. Also, what's the max value of these constants? i didn't see it in comments. Have no idea how far i can go with the value.

cbrt729 commented 2 years ago

In my case, chiitoitsu strategy sometimes runs out of time and causes AFK warning, especially in tenpai.

yangruihan commented 2 years ago

In my case, chiitoitsu strategy sometimes runs out of time and causes AFK warning, especially in tenpai.

This happens to me too, run out of time three times will trigger afk pop-up window

Naelle2 commented 2 years ago

same in some rounds it takes too long for the bot to take a turn and make the afk timer pop up. But in the following rounds it doesnt happen idk about chrome cuz the latest bot is super slow all around and freeze the game if i use it on chrome.

legomeaker101 commented 2 years ago

there are two things i believe are causing this: the standard afk (which always happens and causes the bot to restart the page) or the took too long to act. this one might be one of 2 things: your computer is too slow for the bot (causing it to take too long with each turn) the bot isn’t active

yangruihan commented 2 years ago

These happen frequently on my mobile device

keyarz commented 2 years ago

same in some rounds it takes too long for the bot to take a turn and make the afk timer pop up. But in the following rounds it doesnt happen idk about chrome cuz the latest bot is super slow all around and freeze the game if i use it on chrome.

try to activate the low spec mode in parameters

keyarz commented 2 years ago

These happen frequently on my mobile device

How to use this in mobile? Mind to share?

keyarz commented 2 years ago

there are two things i believe are causing this: the standard afk (which always happens and causes the bot to restart the page) or the took too long to act. this one might be one of 2 things: your computer is too slow for the bot (causing it to take too long with each turn) the bot isn’t active

I think find out what's the reason now, seems like it count as tabbing if I opening a new window(maximized) with same browser, even though I'm not tabbing or minimizing. And the probable reason is it disconnected, after reconnecting the bot stop itself if you're not checking the autostart new game box

yangruihan commented 2 years ago

These happen frequently on my mobile device

How to use this in mobile? Mind to share?

Android:you can use kiwi broswer which can use tampermonkey plugin. You can download from Google play

iOS: you can download Userscripts safari plugin from App store, which like tampermonkey allow to run user script on Safari

Then open majsoul web page, enjoy yourself

Naelle2 commented 2 years ago

same in some rounds it takes too long for the bot to take a turn and make the afk timer pop up. But in the following rounds it doesnt happen idk about chrome cuz the latest bot is super slow all around and freeze the game if i use it on chrome.

try to activate the low spec mode in parameters

is this thread talking about the old ai? If yes i apologize my problem is for the new 1.3.0 beta. i have no problem with the old ai.

yangruihan commented 2 years ago

same in some rounds it takes too long for the bot to take a turn and make the afk timer pop up. But in the following rounds it doesnt happen idk about chrome cuz the latest bot is super slow all around and freeze the game if i use it on chrome.

try to activate the low spec mode in parameters

is this thread talking about the old ai? If yes i apologize my problem is for the new 1.3.0 beta. i have no problem with the old ai.

In new 1.3.0 beta, there also is a parameter to control AI level PERFORMANCE_MODE , you can change it to make it faster.

keyarz commented 2 years ago

same in some rounds it takes too long for the bot to take a turn and make the afk timer pop up. But in the following rounds it doesnt happen idk about chrome cuz the latest bot is super slow all around and freeze the game if i use it on chrome.

try to activate the low spec mode in parameters

is this thread talking about the old ai? If yes i apologize my problem is for the new 1.3.0 beta. i have no problem with the old ai.

Where can i get the 1.3 version? I couldn't see it anywhere I'm referring to 1.2.1 which is what I using now 1 2 1

yangruihan commented 2 years ago

same in some rounds it takes too long for the bot to take a turn and make the afk timer pop up. But in the following rounds it doesnt happen idk about chrome cuz the latest bot is super slow all around and freeze the game if i use it on chrome.

try to activate the low spec mode in parameters

is this thread talking about the old ai? If yes i apologize my problem is for the new 1.3.0 beta. i have no problem with the old ai.

Where can i get the 1.3 version? I couldn't see it anywhere

I'm referring to 1.2.1 which is what I using now

1 2 1

You can find it in this PR https://github.com/Jimboom7/AlphaJong/pull/46

keyarz commented 2 years ago

After a day of testing, I can now confirmed if you covering the windows with any windows(maximized) on top, it will became AFK. Regardless what browser you're using I'm on Win 10 64bit

Jimboom7 commented 2 years ago

After a day of testing, I can now confirmed if you covering the windows with any windows(maximized) on top, it will became AFK. Regardless what browser you're using

Thank you for confirming this. I had the suspicion something like this might the problem, but I could never exactly determine it. To be honest, I think it's not possible to prevent this by code. It seems to be the "Occlusion Tracking" feature which is mentioned here, so it's not related to the game, but to the browser. I did a quick google search and there seem to be some ways to turn it off, I will check if that works and add it to the documentation.

In my case, chiitoitsu strategy sometimes runs out of time and causes AFK warning, especially in tenpai.

That was related to a bug in version 1.2.1 and will be fixed when 1.3.0 is released.

keyarz commented 2 years ago

After a day of testing, I can now confirmed if you covering the windows with any windows(maximized) on top, it will became AFK. Regardless what browser you're using

Thank you for confirming this. I had the suspicion something like this might the problem, but I could never exactly determine it. To be honest, I think it's not possible to prevent this by code. It seems to be the "Occlusion Tracking" feature which is mentioned here, so it's not related to the game, but to the browser. I did a quick google search and there seem to be some ways to turn it off, I will check if that works and add it to the documentation.

In my case, chiitoitsu strategy sometimes runs out of time and causes AFK warning, especially in tenpai.

That was related to a bug in version 1.2.1 and will be fixed when 1.3.0 is released.

I see, I wish this project will elevate to be a command prompt like bot in the future to get rid of this Haha Btw, I really need that detail(documentation) on the constants value so i can know what to change, i have no idea how to make it more offensive because i don't know how far the value can go or which value to change.

Jimboom7 commented 2 years ago

I tested different things and found these browser settings: Chrome: Go to chrome://flags/#calculate-native-win-occlusion and set it to disabled. Firefox: Go to about:config and set widget.windows.window_occlusion_tracking.enabled to false.

That should prevent the browser from checking if another window is on top. The game still needs to be the active tab and not minimized though, there is no simple way to turn that throttling off.

Btw, I really need that detail(documentation) on the constants value so i can know what to change, i have no idea how to make it more offensive because i don't know how far the value can go or which value to change.

The parameters are reworked in the 1.3.0 version, I can't tell you much about the old ones besides "just try it out". If you want to make it more offensive raising the FOLD_CONSTANT is probably your best bet.