Many games support both keyboard/mouse and controller input. Many users (myself included) may wish to switch their input method mid-game, but what is the best way of handling this?

There are two potential solutions:

  1. Have the two input methods combine and reach a consensus (e.g. pressing W on the keyboard while moving the left thumb stick to the left will cause the player to move forward and left)
  2. Have only one input method work at any given time, but switch automatically depending on what the player most recently used.

Technically there is a third option, which is to have the user manually switch between the two input methods in a menu somewhere. I don’t consider this a real option because the user experience would be terrible.

So, which solution do you think is better and why?

  • catloaf@lemm.ee
    link
    fedilink
    English
    arrow-up
    17
    ·
    8 months ago

    Accept all inputs. Update on-screen prompts depending on which one was used last.

    But be careful with processing those inputs. Team Fortress 2 used to have an exploit where you could move the mouse and tilt a stick and turn twice as fast as you were supposed to be able to.

    • Pyro@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      5
      ·
      8 months ago

      The way I do it would work well. Treat such vectors as two separate components. Not as X and Y, but Direction and Magnitude. No matter how many ways you can find to break the input, as long as you clamp the magnitude you’ll never go faster than intended! This also conveniently solves the √2 problem when moving diagonally.

    • bufalo1973
      link
      fedilink
      English
      arrow-up
      2
      ·
      8 months ago

      It’s easy. Just check if mouse moves left OR left key is pressed OR joystick is pushed left THEN move left.