Leafwing-Studios / leafwing-input-manager

A straightforward stateful input manager for the Bevy game engine.
Apache License 2.0
674 stars 104 forks source link

ClashStrategy management across multiple instances of InputMap #617

Open pianonate opened 2 weeks ago

pianonate commented 2 weeks ago

What problem does this solve?

The ability to resolve input clashes when there are multiple InputMap instances defined and the clash occurs across distinct InputMap. My use of LIM involves using separate InputMap instances for my camera, my spaceship, and global commands. It is possible to have a clash across InputMap instances and the current ClashStrategy doesn't handle this scenario.

What do you want to do? Avoid having multiple actions trigger when I only want a single action to trigger - typically for the longest ButtonlikeChord where the overlap of buttons occurs across multiple InputMap instances in my game.

What solution would you like?

I think an ideal solution is I don't do anything and there is a default that handles clashes across all input maps. Of course the default could be overridden if you truly want to have clashes occur across input maps. Second best would be to register each InputMap with a ClashStrategyHandler of some sort.

What alternatives have you considered?

Using a single InputMap for the entire game - pretty much what you have to do right now. This is inadequate for me as I want to be able to manage my controls for each aspect of my game independently. It's more ergonomic (for me) to locate my camera controls with my camera code, and my spaceship controls with my spaceship code (as an example).

Related work

I haven't see anything related although i haven't read every issue :)

alice-i-cecile commented 2 weeks ago

Thanks for writing this up!