A way to change input bindings with scripting dynamically (DEF-1766)

Some people use different kinds of keyboards, or different kinds of keyboard mappings.

A nice thing would be able to say “Press the button for Start… Press the button for Jump…” and one by one detect which ever never key they press and map it to a binding profile with scripting.

Is this already possible?

I created a ticket for this: DEF-1766

It can be done in Lua but it’s quite cumbersome. If you set up your input bindings to map each and every key, mouse button and game pad button, then you could have a Lua module to translate received on_input() action_id’s to custom mappings. Doable, but not optimal.

2 Likes

Is there any update on the topic? I have seen that there is an open ticket: is there any place where I can check its status?

Thanks! :slight_smile:

No, unfortunately not. I’ve started picking up simpler engine tasks to help the engine team so I can take a look at this issue. No promises though.

We use an internal issue tracker so there is unfortunately no way for external users to check up on the tickets. Sorry.

Pkeod started a project to handle the Lua workaround, but it doesn’t look like he got too far. He might prioritize it if you’re really interested though (I’ve been meaning to do it myself as well). Or you can grab his file that binds every input and do it yourself, it shouldn’t be too hard.

Of course an official engine solution would be great!

Yes, I agree, but it would probably not be that much different from a Defold library project. It would probably be possible to get rid of a little but of setup and a function call at the beginning of every on_input() function, but that’s about it.