More flexible inputs?
Brain dump
Additional buttons
I don't know the current reason why WASM-4 doesn't have it, but additional BUTTON_3/Select and Start/BUTTON_4 buttons just like Game Boy would be useful.
Disabled buttons
SYSTEM_HIDE_GAMEPAD_OVERLAY can be replaced by 4 bitfields containing usable buttons for each gamepad. This can be used to hide any buttons desired in the overlay (like the new 3 and 4 buttons), and multiple gamepads can explicitly be ignored by setting to 0.
Pointless bytes?
Why are 2 signed 16-bit integers used to represent 25600 possible pointer/mouse positions? I haven't seen it being used for sub-pixel precision, like libretro does. How about a 16-bit signed integer, with -1 representing "not visible"? You can easily get X or Y from that.
Inconsistent button maps + possible solution
BUTTON_1 and BUTTON_2 being treated in games as X and Z on the QWERTY layout is a bit problematic for the player who may be using a different keyboard layout or a gamepad. The mobile overlay currently doesn't label the buttons, either.
Here's a possible solution for this: The runtime stores multiple 8x8 1-bit button prompt sprites. The runtime can dynamically change the sprites as desired, and the player has a good time without additional setup. Doing that for multiple gamepads though (imagine a room with a QWERTY keyboard, AZERTY keyboard, and a gamepad with A & B) , is 64 bytes, which is excessive to say the least. Account for 3 & 4, and you get 128 bytes. --Are 2 gamepads not enough, anyways?-- Actually, this can be retrieved from a function instead of staying in the system memory. A more simple solution is to just label the buttons in the overlay and call it A, B(, Select, Start)... whatever.
Assuming breaking compatibility with current programs is not horrible, I hope you like some of these ideas!
Hi, thanks for the feedback :smiley:
I don't know the current reason why WASM-4 doesn't have it, but additional BUTTON_3/Select and Start/BUTTON_4 buttons just like Game Boy would be useful.
It's possible we add one of these in the future, but I think 2 buttons is plenty for most games. I'm planning add a "menu" button, but it will bring up the built-in pause menu and console options, and not be input to the game. A "start" button for showing an in-game menu (like switching to an inventory in an RPG) might be cool later down the road.
SYSTEM_HIDE_GAMEPAD_OVERLAY can be replaced by 4 bitfields containing usable buttons for each gamepad.
Good idea!
Why are 2 signed 16-bit integers used to represent 25600 possible pointer/mouse positions?
Mouse positions can be off screen, which is useful for click-and-drag gestures that extend outside of the game. Future Avoid is one example of this.
BUTTON_1 and BUTTON_2 being treated in games as X and Z on the QWERTY layout is a bit problematic for the player who may be using a different keyboard layout or a gamepad. The mobile overlay currently doesn't label the buttons, either.
We should definitely change the mobile overlay to label the buttons as X and Z.
Changing button sprites sounds like #366. As of the last release we have button sprites built into the font, which you can draw for example by: text("Press \x80 to shoot").
I personally think SYSTEM_HIDE_GAMEPAD_OVERLAY should some kind of meta-flag (possibly in bundling) and not part of the binary API. Mostly because it's device-specific and showing unused buttons in the overlay doesn't actually hurt.
For keyboard/gamepad input I left a comment on https://github.com/aduros/wasm4/issues/366#issuecomment-1043007287
As an aside I would really love if we had a better way to attach metadata to carts. WebAssembly has a way to include custom metadata sections. Maybe something to build into w4 opt as a post-build step?
Yeah, custom metadata would be nice as long as games aren't required to have it, and that games will run the same even if the runtime doesn't know about it. Stuff like gamepad-buttons (SYSTEM_HIDE_GAMEPAD_OVERLAY from this issue), window-color (#253), and maybe texty stuff like title, version and url.
I think it should be a separate command as to not confuse the purpose of w4 opt, perhaps w4 meta/w4 metadata.