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

feat(input): remove fixed keyboard controls from GameOptions #655

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

BenjaminAmos
Copy link
Contributor

Description

This pull request moves the input control constants from GameOptions into a separate DefaultOptions enum. GameOptions has been changed to instead use a dynamic map of controls to their triggering inputs. This should allow for greater extensibility in the future, since modules can now define input controls. There is no way at present to persist the runtime-added controls yet.

An input control consists of an action that can be triggered by any number of input keys. The control itself contains the constant data describing what the control is and how it can be used. Controls are now associated with input types, which can be any of KEYBOARD, MIXED, MOUSE and CONTROLLER. Controls can be associated with multiple input types.

A control can now support an arbitrary number of keys as triggering inputs. This is implemented internally within GameOptions but currently nothing in the game supports it. Changing the input bindings from the main menu will replace all existing bindings for that control with the single binding chosen currently.

Testing

  • Play the game and make sure that all inputs work as before.
  • For each input type, try changing the input bindings from the main menu. Ensure that the following operations work as before:
    • Display input binding
    • Change input binding
    • Save input bindings
    • Reset input bindings to defaults
  • Restart the game after changing the input bindings and test again. Ensure that the changed inputs have persisted across saves.

Future Improvements

These changes are not happening in this pull request but would be ideal as follow-ups.

  • Support actually using multiple input bindings within the game e.g. all specified bindings should trigger a button, not just the first one.
  • Populate the main menu inputs screen dynamically based on the input types specified by the controls.
  • Allow the user to select both a primary button and a secondary button for each control from the main menu inputs screen.

Notes

  • This pull request moves all the keyboard input bindings which where previously stored in a series of constant variables. Because of this, reviewers should be aware that copy-paste errors are highly likely.
  • It might be possible to port Terasology's input system to Destination Sol but that would require a considerably larger effort (and more ECS). This pull request attempts to adapt the existing code to be more future-proof instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

1 participant