badconker / ctrl-w

Userscript pour le jeu web Mush (mush.vg)
MIT License
12 stars 20 forks source link

Browser notifications and auto-refresh #49

Open mastef opened 7 years ago

mastef commented 7 years ago
badconker commented 7 years ago

It could be a great feature :) but i don't know if it is authorized by Twinoid Scripts Rules : https://twinoid.com/g/architectoire#reglement-scripts (fr). I asked to official group.

In the meantime , I have not yet had time to test your feature but what is happening if there is an auto refresh while the player type a text in chat or he's doing something on the page ? 1 : auto-refresh anyway (bad) 2 : auto-refresh canceled (good)

mastef commented 7 years ago

Yeah @badconker I am still doing some rewrites that I want to push later. I saw that there was an active chatbox detection somewhere before, and I want to add it. Is there any other action detection currently? What annoys me about auto-refresh currently is that chats are being collapsed again while I was reading through them.

a) Also I want to change the auto-refresh to be configurable with an interval set to 5 minutes per default when window is active b) and 15 minutes when window is inactive c) When the game wasn't opened for one hour, increase inactive interval to 60 minutes

I think those changes would also go well with the twinoid rules against excessive server resource usage.

As for notifications I've improved them with stacking notifications together, and also showing the speaker's avatars when somebody is talking. Now I need to add an algo somewhere to not notify on "old" unread messages that are simply not yet marked as read.

So there's some changes coming up

mastef commented 7 years ago

Hm, I just noticed that mush returns the full html page at every ajax call - that's of course not optimal. It would've been great if they just returned some data in json format. Or at least if there was a simple ajax check to see if there's any new stuff that's worth reloading, e.g. {'new_messages':true}. That would save a lot of server processing and bandwidth.

mtbugzilla commented 7 years ago

Hi @mastef,

I checked with the Mush moderators and unfortunately they are unanimously against that feature because it would have a great impact on the balance of the game: it would be too difficult for mush players to act without being noticed. For example, if several mush players want to do something in a room before erasing the logs or if they want to convert a player before she or he has time to notice the first spike, then a notification would probably ruin that strategy and alert the human player about something that is currently happening.

Additionally, this would probably increase the load on the Mush server significantly, because most players only refresh the game a few times every few hours instead of doing it every few minutes as with your script. I see that you planned to make the refresh rate configurable, but even with a longer delay there would still be the issue of the impact on the game balance.

For your information, the chart for the scripts is also available in English: https://twinoid.com/g/architectoire#rules-scripts-en The problems are mostly in section "3. Automation".

mastef commented 7 years ago

Ok, I think those explanations are reasonable, and could be also worked around with a few minor adjustments :

Regarding notifications context it could be reduced to chat only + Something happened in mush for events. The other thing is that notifications are not persistent, they disappear after 3-5 seconds ( configurable ).

I guess the main point of it is to not have to switch to a tab all the time when there's nothing happening ( while having work to do ), not really to get a gameplay advantage.

As mentioned above - I understand the server load part. The load on the mush server is definitely something that I'm worried about, especially with the way the mush server currently replies to all ajax requests by just replying with the whole page, and not if there's something new. Also based on the current ctrl-w refresh button behaviour - that definitely seems also sub-optimal on the server-side.

After testing it myself, I actually set the auto-reload to 10+ minutes to not get spammed - ( so that's ~ a few times per hour. ) and if the user is totally idle, it increases to hourly - so with such hard-limits it would be within normal player behaviour bounds. So with a hard-limit of maximum 4-6 refreshs per hour that could fall under the rule 3 of being gentle with the server.

mastef commented 7 years ago

Another option is delaying the notifications by 1 minute after refresh. I'm all up for suggestions to make this work - again it's important to note that this is not to gain a game advantage, but to not have to check the tab all the time :)

mtbugzilla commented 7 years ago

I am not sure that the modified script would be accepted with a delay of 1 minute. The problem is when two or three mush players have to coordinate their actions to infect a human player: 1 minute may not be sufficient for them to act quickly enough, especially if they have to communicate with each other via the mush channel: typing messages and refreshing the page to get an answer can easily take more than a minute. A delay of 3 to 5 minutes may be more appropriate.

I understand that a delay of several minutes would reduce the usefulness of the script for chat messages. But I think that a delay of 3 to 5 minutes would be a minimum for the actions happening in the room, if we want to limit the impact of the script on the game balance.