Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Browser notifications and auto-refresh #49

Open
wants to merge 14 commits into
base: dev
Choose a base branch
from
Open

Conversation

mastef
Copy link

@mastef mastef commented Jan 17, 2017

  • Updated README.md with install instructions
  • Added auto-refresh ( 1 minute when window active, 5 minutes when tab inactive )
  • Added browser notifications ( will notify outside the tab, and focus on click )
    • Will not notify if the tab is active
    • Currently the following notifications are integrated :
      • You have X unread messages
      • Cycle change about to happen / Cycle change just happened

Refreshes game every minute if tab active, and every 5 minutes if tab
is not active

Counts unread messages

Sends a browser notification if tab inactive when :
- You have X unread messages
- Cycle change about to happen
- Cycle change just happened
@badconker
Copy link
Owner

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)

Numeric indexes with disabled options were started to be messy. E.g.
option 4 is disabled, and next option 5 doesn't exist, as it's the
"new" 4. Changed this by switching over to option names as keys.

It also makes the template a bit more readable, as values are adressed
with their keys and not indexes. ( opt[2] -> opt.refresh )

Compatible with existing cookies.
@mastef
Copy link
Author

mastef commented Jan 18, 2017

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
Copy link
Author

mastef commented Jan 19, 2017

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
Copy link

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
Copy link
Author

mastef commented Jan 25, 2017

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
Copy link
Author

mastef commented Jan 26, 2017

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants