Vanilagy / MarbleBlast

A web port of Marble Blast Gold and Marble Blast Platinum.
https://marbleblast.vaniverse.io
MIT License
126 stars 17 forks source link

raw mouse input #22

Open SArpnt opened 1 week ago

SArpnt commented 1 week ago

i use linux with a high dpi mouse and low os sensitivity setting. in mbw when i move my mouse, even at the highest sensitivity setting available, it's way slower than i use in any other game and the movement is incredibly inaccurate (slow movements don't move at all, faster movements have speed in steps)

pretty sure it can be fixed with a one line change, just use unadjustedMovement when you request the pointer lock https://developer.mozilla.org/en-US/docs/Web/API/Pointer_Lock_API#requestpointerlock https://github.com/Vanilagy/MarbleBlast/blob/5727a411a477d8872bbc1d05bffa3f128315ee21/src/ts/util.ts#L693

you probably don't want to change it directly since it would mess up mouse sensitivity for a lot of the people already playing. maybe add a "raw mouse input" option to the settings to enable this? nearly all 3d games use raw mouse input by default but if it's an option you could leave it off for all the people that have already played and set their options

Vanilagy commented 1 week ago

Hey! I do know about this option, but I'm not sure why I didn't use it when I first implemented this game 4 years ago (Jesus, it's been 4 years...).

Before I do any changes, have you cloned and installed the repo locally and tried out the change? Would be good to verify that this is the fix before I do anything else.

SArpnt commented 1 week ago

dependencies are very out of date and seem to be broken so it took me quite a bit to get it to build.

anyways, made changes, didn't work. i put some logging around and it seems like firefox sends the mouse events, but with the mouse movements rounded, so all the precision gets lost. i can't find any other 3d web game or demo that works either.

firefox just doesn't support the option at all. https://bugzilla.mozilla.org/show_bug.cgi?id=1829401 not sure how i missed that on the mdn page.

even despite that i think rounding the movements like it's doing is definitely a separate bug and shouldn't happen anyways.

i tried the two other browsers i have sitting around for testing my websites. qutebrowser (unusual, chromium based) can't lock the mouse on wayland, and badwolf (webkit) just doesn't lock the mouse at all.

i installed ungoogled chromium. it does mouse movement on the website fine. it rounds mouse movements to pixels but it doesn't reset after so mouse inputs aren't dropped. this gives noticeable little jumps when turning that matches whenever my mouse would move a pixel. for some reason chrome still sends mouse events for movements that round down to zero. with unadjustedMovement, the promise throws NotSupportedError: The options asked for in this request are not supported on this platform. so i can't use that on any browser.

i don't know of any other webkit based browsers (like safari) i could install, and i certainly don't have a mac for safari (nor would i ever touch one)

the option would still probably be good to add, might work for some people, but it seems like it won't do anything about the actual issue i wanted fixed.