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

Advanced Inputs #986

Merged
merged 17 commits into from
Jul 8, 2024
Merged

Advanced Inputs #986

merged 17 commits into from
Jul 8, 2024

Conversation

LucaHaverty
Copy link
Collaborator

@LucaHaverty LucaHaverty commented Jun 21, 2024

Description

More advanced input functionality such as controller support, axes instead of just buttons, input saving, and different controls for different robots. Each additional robot that's spawned will be given a unique control scheme, allowing them to all be controlled at once by different people. Inputs can be bound to either controller or keyboard through the change inputs modal.

Limitations

  • The UI panel is very rough at the moment. Although it doesn't look great, it should function correctly and any bugs should be reported
  • At the moment, there is only support for one controller at a time
  • Input saving has been pushed back to sprint 2 when the preference manager is developed. Inputs are not supposed to save in the pr

Objectives

  • Controller support
  • UI for assigning axes (both with joystick and two keyboard buttons)
  • Store controller and keyboard controls separately
  • Different controls for multiple robots spawned at once
  • Five unique preset control schemes

Robot specific input saving

Features

When robots are spawning in, they will be automatically bound to a new control scheme. For example, if three robots are spawned, the first will be controlled by WASD, the second by arrow keys, and the third by a controller. These control schemes can be modified, reset, or bound to different robots via the controls modal.

To reset to a default control scheme, select the scheme then press the 'set' button as shows below

image

Toggling "Use Controller" for a robot will switch the modal to controller mode, allowing users to bind an input axis to either a joystick axis (like "left x") or two gamepad buttons. Joystick axes can be inverted in case a joint or robot moves backwards.

image

Testing Done

  • Spawning more that five robots (after five, they spawn with unbound controls)
  • Removing and respawning robots
  • Rebinding keys then switching another robot to the same scheme
  • Controlling many robots at once

JIRA Issue

@LucaHaverty LucaHaverty self-assigned this Jun 21, 2024
@LucaHaverty LucaHaverty added no-merge gameplay Relating to the playability of Synthesis labels Jun 21, 2024
@LucaHaverty LucaHaverty marked this pull request as ready for review June 27, 2024 20:42
@LucaHaverty LucaHaverty requested a review from a team as a code owner June 27, 2024 20:42
@LucaHaverty LucaHaverty requested review from a-crowell and BrandonPacewic and removed request for a team June 27, 2024 20:42
Copy link
Member

@BrandonPacewic BrandonPacewic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a lot, and very impressive.

Couple of suggestions that could be changed that I would like feedback on:

  • I assume we don't support binding a mouse click event because we use that for other things in the simulator that we can't currently rebind?
    • Perhaps we should revisit this once the preference manager gets implemented?
  • I think the default presets could be set up a bit better from a UX standpoint. I was a little confused at first how it worked.
    • Perhaps the text should be "Default Presets" rather than "Reset to Defaults".
    • We could then also add an additional "Reset to Defaults" button that would just restore default presets across all robots.
  • Currently the Cancel and Accept buttons don't seem to do anything other than close the panel. I expected that I would need to apply my changes and the cancel button would avoid making any changes.
    • Perhaps this is something that we would change later once we have proper control saving?
  • When selecting the Arrow Keys preset it assigns joint(s) (-) to be on Alt & another key.
    • Mac should have this bound to Command or Option & another key if possible as the standard Mac keyboard does not have an Alt key.

Just some things that I was thinking about. Feel free to tell me whether or not these are within the scope of this PR or not.

I did not find any bugs, everything worked flawlessly.

Note

I did not test anything with a controller.

@LucaHaverty
Copy link
Collaborator Author

LucaHaverty commented Jun 28, 2024

This is a lot, and very impressive.

Couple of suggestions that could be changed that I would like feedback on:

  • I assume we don't support binding a mouse click event because we use that for other things in the simulator that we can't currently rebind?

    • Perhaps we should revisit this once the preference manager gets implemented?
  • I think the default presets could be set up a bit better from a UX standpoint. I was a little confused at first how it worked.

    • Perhaps the text should be "Default Presets" rather than "Reset to Defaults".
    • We could then also add an additional "Reset to Defaults" button that would just restore default presets across all robots.
  • Currently the Cancel and Accept buttons don't seem to do anything other than close the panel. I expected that I would need to apply my changes and the cancel button would avoid making any changes.

    • Perhaps this is something that we would change later once we have proper control saving?
  • When selecting the Arrow Keys preset it assigns joint(s) (-) to be on Alt & another key.

    • Mac should have this bound to Command or Option & another key if possible as the standard Mac keyboard does not have an Alt key.

Just some things that I was thinking about. Feel free to tell me whether or not these are within the scope of this PR or not.

I did not find any bugs, everything worked flawlessly.

Note

I did not test anything with a controller.

@BrandonPacewic

I agree that revisiting mouse controls for robots is something to consider after preferences. Also, the save/cancel buttons do the same thing for now. They will be set up to work properly once robot inputs are integrated into the preference manager during sprint 2.

I'm almost done adding your suggestions about UX and presets.

Copy link
Member

@BrandonPacewic BrandonPacewic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it too much to also ask for a confirm reset to default popup? 🙃

Copy link
Member

@BrandonPacewic BrandonPacewic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we are having some problems with the linter in fission right now, should be investigated.

Fantastic work, super impressed.

Note

I did not do any testing with a controller.

Edit:

Copy link
Collaborator

@a-crowell a-crowell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is so cool wow!

The only thing I want to check in about is handling different controller inputs when they are hardcoded. I'm testing with a generic USB controller and finding various differences: Only the left joystick works when selected as an axis, but the right still controls a joint in a particular direction. The sticks and back/start are switched as well, but that is a nonissue since it's just naming.

I don't think it would be reasonable it would be to handle cases from different manufacturers though. I don't use a controller much--do you have any ideas? Is there an input redirector we can suggest to users or is there a way to tell them what kind of controller will work?

@LucaHaverty
Copy link
Collaborator Author

This is so cool wow!

The only thing I want to check in about is handling different controller inputs when they are hardcoded. I'm testing with a generic USB controller and finding various differences: Only the left joystick works when selected as an axis, but the right still controls a joint in a particular direction. The sticks and back/start are switched as well, but that is a nonissue since it's just naming.

I don't think it would be reasonable it would be to handle cases from different manufacturers though. I don't use a controller much--do you have any ideas? Is there an input redirector we can suggest to users or is there a way to tell them what kind of controller will work?

@a-crowell For the MVP it may be worth just having xbox controller support and prioritizing other tasks then adding support for different controls in later weeks. @HunterBarclay what do you think?

Copy link
Collaborator

@a-crowell a-crowell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome. While that's getting planned, current code looks great!

@LucaHaverty LucaHaverty mentioned this pull request Jul 8, 2024
19 tasks
@HunterBarclay
Copy link
Member

@LucaHaverty The XBox layout/scheme is the most common from what I've seen among usb controllers. I believe we're fine for now. Great work!

@HunterBarclay HunterBarclay merged commit c7a0108 into dev Jul 8, 2024
11 of 12 checks passed
@HunterBarclay HunterBarclay deleted the haverty/1658/advanced-inputs branch July 8, 2024 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gameplay Relating to the playability of Synthesis
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants