PrismarineJS / prismarine-web-client

Minecraft web client running in your browser
https://prismarinejs.github.io/prismarine-web-client/
MIT License
450 stars 156 forks source link

solve ctrl+w problem #117

Open rom1504 opened 3 years ago

rom1504 commented 3 years ago

people try to use ctrl+w for sprinting

what can we do to make this less confusing?

rom1504 commented 3 years ago

related #87

Moondarker commented 3 years ago

As a first line of defense we should probably add a beforeunload event handler checking if Ctrl is pressed and saving users from accidentally closing the tab

rom1504 commented 3 years ago

yes I agree, good idea let's do it

rom1504 commented 3 years ago

https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event

rom1504 commented 3 years ago

https://stackoverflow.com/a/19538231/1658314

Karang commented 3 years ago

An other solution is to change how sprint work. In vanilla you can also double tap w to toggle sprint, so we could implement that and disable ctrl.

rom1504 commented 3 years ago

and disable ctrl

that's the problem, we can't

rom1504 commented 3 years ago

maybe displaying a warning in the loading screen "don't press ctrl+w to sprint" could do the trick I guess...

Karang commented 3 years ago

and disable ctrl

that's the problem, we can't

I meant disabling sprinting with ctrl (not using it)

rom1504 commented 3 years ago

yeah I understand but users try and exit the window

Karang commented 3 years ago

yeah I understand but users try and exit the window

If ctrl does nothing they will try once and not again when they see it doesn't work. The problem is because the feature is there, people will try to use it.

ShrimpyStuff commented 3 years ago

We could just put a warning while loading and then use the beforeunload stuff

ShrimpyStuff commented 3 years ago

I need to read all of the comments before I do because you guys said that

muelleel commented 3 years ago

and disable ctrl

that's the problem, we can't

but you can display the (browser standard) confirmation dialog. So the User wont instantly quit and also close 10 other Tabs :) You could set Sprint to another Key and also detecting Double W.

btw. Thanks for this great work here, I really like it!

AwesomestCode commented 3 years ago

and disable ctrl

that's the problem, we can't

but you can display the (browser standard) confirmation dialog. So the User wont instantly quit and also close 10 other Tabs :)

You could set Sprint to another Key and also detecting Double W.

btw. Thanks for this great work here, I really like it!

We tried doing that and it looked ugly.

rom1504 commented 3 years ago

yeah preventing closing the page feel like "ad popup" people should be able to just close it

Moondarker commented 3 years ago

yeah preventing closing the page feel like "ad popup" people should be able to just close it

Last time it didn't track the state of Ctrl and W keys

soqb commented 3 years ago

if/when you add keybindings to the site, this wouldn’t be a problem. ctrl just wouldn’t be a valid sprint key

AwesomestCode commented 3 years ago

The issue isn’t really not having a way to sprint. We could change the keybind to something else today if we wanted to. However, it’s much more difficult to correct muscle memory—most, if not all of the people on the dev team have been playing MC JE for years, and have pressing control-w to sprint as a habit.

On Fri, Jun 25, 2021 at 03:13, radiish @.***> wrote:

if/when you add keybindings to the site, this wouldn’t be a problem. ctrl just wouldn’t be a valid sprint key

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/PrismarineJS/prismarine-web-client/issues/117#issuecomment-868279318, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMVK4MVH56OCJPHHUQUM5LDTUQUCRANCNFSM4ZNFOAMA .

Pandapip1 commented 3 years ago

Maybe pressing ctrl could enable sprint until the W key is depressed. This would be similar to vanilla behavior (i.e. you can walk and then tap ctrl to start sprinting) but also enable you to sprint somewhat normally (tap ctrl and then hold w).

host008 commented 3 years ago

im gonna try to do this

host008 commented 3 years ago

*fix

host008 commented 3 years ago

K I think I got it.

host008 commented 3 years ago

https://github.com/PrismarineJS/prismarine-web-client/pull/239

extremeheat commented 3 years ago

Adding alt as a key for sprinting could work (looks like #239 is trying to do this now). Keeping control around can be considered for non-QWERTY keyboards and also Electron where Control-W can be disabled.

worldsgen commented 2 years ago

You can actually disable CTRL+W in your browser (if you use Chrome). You can install this extension (https://chrome.google.com/webstore/detail/disable-keyboard-shortcut/aidbmcboeighgdnilpdljbedbbiocphj) and go to chrome://extensions/shortcuts and click on the pen and safely do CTRL+W and then you can sprint in the game!

Pandapip1 commented 2 years ago

We know that ctrl+W can be re-binded with a chrome extension. However, this will not be accepted, as mentioned here: https://github.com/PrismarineJS/prismarine-web-client/pull/239#pullrequestreview-799596125

Pandapip1 commented 2 years ago

I just found this experimental feature: https://developer.mozilla.org/en-US/docs/Web/API/Keyboard/lock - might be useful when implemented?

zardoy commented 1 year ago

I just found this experimental feature: developer.mozilla.org/en-US/docs/Web/API/Keyboard/lock - might be useful when

Hi! You're absolutely right!! This is the only way to cancel ctrl+w as you handle all keyboard interactions (except for long-esc, btw google remote desktop uses this API). The lock can be acquired when you go fullscreen, so I implemented the following:

Also, acquiring full keyboard access can fix ua errors when re-requesting pointerlock (the pointer is not locked when you double press esc too fast without fullscreen)


Btw another annoying thing that I've found is mouse acceleration but it was to fix with Mouse Raw Input (setting), which btw is enabled by default in java version. And also I managed to fix all known control usability issues, so please let me know if there are any problems...

All this fancy stuff is supported only in Chromium browsers, so I don't recommend using others like Firefox...

Pandapip1 commented 1 year ago

All this fancy stuff is supported only in Chromium browsers, so I don't recommend using others like Firefox...

I mean... there are pretty good reasons to use FF instead of Chromium-based browsers. In fact, not supporting as many APIs is one of the reasons to use it, since Google has been known to use its dominant market share to do some pretty unethical stuff.

Nonetheless, in this case, IDK why Firefox doesn't support it. I can't think of any good reason.

extremeheat commented 1 year ago

Nonetheless, in this case, IDK why Firefox doesn't support it. I can't think of any good reason.

Because as your linked page says, it's not a standardized API. It's Google's proposal that for the time being only their Chrome browser implements.

Pandapip1 commented 1 year ago

It's absolutely a standardized API. It is a draft, so it's subject to change. That might be why. A config option like what's done for the Audio Output Devices API would be nice.

extremeheat commented 1 year ago

It's absolutely a standardized API. It is a draft, so it's subject to change. That might be why. A config option like what's done for the Audio Output Devices API would be nice.

Yes, I don't think you understand what a draft in the W3C standardization process is. It's the lowest level maturity level in the standardization track. Only "Recommendations" are standardards for the web. This means, if you are building a web browser, in order to fully implement the W3C standard you must implement those W3C recommendations.

zardoy commented 1 year ago

I mean... there are pretty good reasons to use FF instead of Chromium-based browsers.

I might agree with you at some point, but for now, I don't really understand why you have to use ff instead of chromium-based solutions. Though I understand people who have to use safari: you get better performance on mac and you have simply no other choice on IOS. I'm personally using these APIs in the game and I enjoy using them.

Only "Recommendations" are standards for the web

This is also the right point, but in fact, we still do get not a feature-complete browser to use. Some websites like vscode.dev are simply not usable in Firefox (there is simply no way to work with fs effectively without FileSystemHandle support.

Pandapip1 commented 1 year ago

This means, if you are building a web browser, in order to fully implement the W3C standard you must implement those W3C recommendations.

This does not mean that you can't implement them. It just means that you don't have to (and IIUC that the API can change at any time).


We're off topic. I will not be replying to any subsequent comments here.