[Ohrrpgce] Multiple joysticks, multiplayer, and control remapping

Simon Bradley neworiginal at gmail.com
Fri Apr 16 06:49:31 PDT 2021


I've been thinking about this sort of stuff in another context recently (I
just wrote my first hobby game in more than a decade, for a jam on itch.io
- it's here if you want to take a look:
https://drnefario.itch.io/eye-of-gath - I'm getting my mojo back after
working from home for more than a year.)

Most of the time, for a single-player game, you want a coalesced input that
has maybe been abstracted to an action. You don't care whether it was a
d-pad up or an arrow-key up, you just want an up. And you also don't want
to move twice as fast if you press both.

Even if you want to treat controllers as belonging to separate users, you
quite often want to be able allow a player to have more than one input
device, such as mouse and keyboard, or controller and touchscreen, or some
such. It seems to be an Xbox thing to tie user accounts to a specific
controller, but even there you must be able to add other non-controller
input sources somehow. The xbox supports usb keyboards, I think.

Note that I did work on an AppleTV project a while ago where we did need to
be able to treat two controllers as a single user: the Siri Remote is
treated as a controller, and you have to expect someone to be using the
remote to launch apps while they use their game controller inside the
games. It's a bit of a weird edge case, though.

Cheers,
Simon

On Fri, 16 Apr 2021 at 14:05, Ralph Versteegen <teeemcee at gmail.com> wrote:

> I've been working through (especially in gfx_sdl2) gamepad bugs and
> unfinished features (none of which made it to github) and now I've only got
> handling of multiple gamepads left to improve. For better joystick
> numbering I'm thinking forwards to local multiplayer, remappable controls,
> ohrkeys joystick support, and even simple remote multiplayer via input
> forwarding.
>
> Currently a number of commands (keyval, keyispressed, keypress,
> newkeypress, joystickbutton, joystickaxis, getjoystickname,
> joystickbuttoncount, joystickaxiscount, joystickhatcount) take the joystick
> number as an extra argument. But there are lots of problems with this:
> -if there are multiple joysticks on the system you would have to loop
> through all of them to figure out which one the player is using
> -I added getnumjoysticks recently but it's undocumented
> -in gfx_sdl2 and gfx_directx joysticks can get renumbered if any are
> removed or even added (not possible in gfx_sdl anyway)
> -the joystick number is currently ignored for control keys like usekey
> (It's also ignored for keyboard scancodes), instead all inputs joysticks
> are OR'd
>
> But I used rpgbatch to scan the gamelists and there was only a single game
> that made use of the joystick number arg, Porosis on SS, which erroneously
> contains "key is pressed(key:A,true)". "joystick axis" wasn't used either
> (though Blood Ledger and inputtest.rpg now use it.)
>
> Further, I want to let people define additional keys to usekey, menukey,
> etc. (I think we could break convention and export these to the hsi as
> "shootkey", "runkey",  etc. for a form of consistency, since there will be
> little difference between builtin and additional controls.) So instead of
> hardcoding e.g. a charge-up action to the joy:Y button you'd define a
> "charge key" with some default mappings which can then be changed by either
> a scripted or future builtin control mapping menu.
>
> SDL2 has functions to get/set the player number for each joystick/gamepad.
> At most one joystick can be assigned to a player, which is a reasonable
> limitation. On most platforms these functions don't really do anything, but
> on consoles they report the actual player number and apparently some
> consoles have coloured LED lights to indicate which controller is each
> player.
>
> So it occurred to me that we should repurpose the 2nd arg to all those
> commands as the *player number* rather than the joystick number. Each
> player has at most one joystick and keyboard (and in future mice could also
> gain a player number arg) but note that a player might have no joystick,
> just a keyboard. I suggest that players are numbered from 1 up, which is
> less confusing, and the default player=0 (which is also used by all builtin
> controls) can just be all input from all control devices OR'd together so
> if you have multiple gamepads all existing games will just work. There
> could be a command to instead set a specific player as the default, e.g.
> for local or remote multiplayer where you want just one player to control
> the hero/menus.
>
> If you want to change which player a device is assigned to that might be
> tricky if there are no commands to enumerate joysticks, but we could have a
> command such as "swap player gamepads(player A, player B)"
> _______________________________________________
> Ohrrpgce mailing list
> ohrrpgce at lists.motherhamster.org
> http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.motherhamster.org/pipermail/ohrrpgce-motherhamster.org/attachments/20210416/a352855d/attachment-0001.html>


More information about the Ohrrpgce mailing list