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

feature: NETPLAY mouse support #776

Open
H4M5TER opened this issue Nov 14, 2024 · 1 comment
Open

feature: NETPLAY mouse support #776

H4M5TER opened this issue Nov 14, 2024 · 1 comment

Comments

@H4M5TER
Copy link

H4M5TER commented Nov 14, 2024

If there is no more memory for multiplayer mouse control
I hope players can use their mouse in turn and give the game ability to change the source.

@fejnartal
Copy link

fejnartal commented Jan 6, 2025

Would people be interested in an opt-in way to support multi-touch/multiplayer without adding more memory?

I thought that "maybe" we could sacrifice a little bit of "responsiveness" and a maybe non-trivial amount of simplicity by treating screen position as a divide-and-conquer quadrant.

Wasm4 already uses 4bytes for positioning a single mouse. We could use 1byte for each player/finger.
With 8bits we can't map a fine-grained 160x160 space. At least NOT IN A SINGLE FRAME. But we could, in 2 or 3 frames (depending on some implementation details).

For example, top-left pixel could be expressed as follows:
FRAME 1
Bit 1. Select left or right halve of the screen (80x160)
Bit 2. Select top or bottom halve of the already selected area (80x80)
Bit 3. Select left or right halve... (40x80)
Bit 4. Select top or bottom halve (40x40)
Bit 5. Select left or right halve... (20x40)
Bit 6. Select top or bottom... (20x20)
Bit 7 and 8. We can use as a counter. That way we can distinguish frames: FIRST, SECOND THIRD...

SUBSEQUENT FRAMES will give a more fine-grained position of the touch (depending on the game, 20x20 might be good enough precision, if not, they can improve the precision waiting for the next frame).

I would love to hear your opinion on this or any other variation which better fits the design of the console, its philosophy, community, etc.

I have just learned about this fantasy console and haven't developed anything for it yet.
However, I already love the ideas behind it.
It's touch support and it's simple input system, specially when combined with the apparent simplicity of its multiplayer, being based in WebRTC and mostly transparent to the delevoper.

That's why I felt so sad when reading that mouse/touch is disabled in multiplayer. I kept reading trying to understand the underlying causes of this.

I found that there isn't enough memory to handle it gracefully. On top of that, one may think:
Will it downscale well to local multiplayer?
I believe there are many local mobile multi-touch games with a great 1-4 player experiences. Not so many for desktop multi-mouse (I only remember Hammerfight, and read somewhere which it was a pain to support multimouse as most operating systems will just list a single device).

I'm a software developer myself without much work experience in low-level but willing to learn and give a hand with the implementation if this proves interesting to you.

Thanks to all of you for this great fantasy console.
All in all, it looks amazing already.

P.S.:
I have just noticed that, in fact, Wasm4 uses 5 bytes for mouse handling (I forgot 1byte from MOUSE_BUTTONS). Some kind of multiframe logic might still be needed, but it was worth mentioning this extra byte.

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

No branches or pull requests

2 participants