How can I make cusomizable controls without knowing what the input mightbe? Like what if someone plugs in a joystick with 30 buttons, But the next day uses a different joystick, this one with 20 buttons. How do I make it so he can pick which button does what? I am trying to make gamepad/joystick supported an available option. I am up to the challenge of python, since that will most likely be the only solution. Thank you in advance,
I’m currently coding exactly what you need.
Hopeful within few days I have a first public demo available.
Thank you! Do you need any help? My scripting skills are somewhat limited, but if you need help let me know.
I can’t help with Joystick right now, but with Keyboard and Mouse:
I’m not sure if I can add Joystick as, I do not have one :S. But I think it shouldn’t be such a problem for me, to add Joystick support. I need someone to test when it is done.
Here is my demo for the joystick axis, button, hat and key inputs to game functions binding. This support up to 8 joysticks.
My plan is to use this in the BGE_AirRace project.
The mouse inputs is not supported yet.
The system is based to the gf (game function) parent object with fname (function name) and gi (game input) children objects.
The gf-object has a fi-property, which define the accepted input type: a=axis, b=buton, h=hat, k=key. There can be just one type ‘a’ or all ‘abhk’.
The game designer can add new game functions by duplicating the above mentioned objects.
After duplication the designer must rename the gf-object ‘gid_msg’ named message actuator’s ‘To:’ property.
gf = gi, gf.001 = gi.001, gf.002 = gi.002etc. See the logic picture.
The fname-object has Text-property, which holds the function description: STRAFE LEFT etc.
At this point the bindings are just printed to the console, but later on those are saved to the text file.
You have there very interesting system.
Maybe these two systems need to combine somehow
Feel free to use my .blend file content at will. It’s for the common good.
selection8.blend (227 KB)
Hmmm, can’t get the JS axis input to recognize my controller stick movement, mabe I am not doing it right? Every thing else works great! Keep it up Xjazz. I can’t view your code however, when I open your .blend it goes right to the GE? I am very excited about your progress.Hops up and down excitedly
I think the files could be merged together with the event manager.
Using your menu with my eventManager should provide a quite powerfull combination.
What we should think about is how to input multi key press like <shift><Space>. This is always like first one key, later a two keys.
Just an idea:
when activating the button, read the event until a pressed key is released.
Take the combination of pressed buttons + the released button.
the button is activated
<left shift> is pressed
<RMK> is pressed
<left shift> is released
=> result <left shift> + <RMK>
I think that could work. It would allow to setup key combination of keyboard, mouse and joystick.
The code is not perfect yet. Try to center all your joystick axes, including the throttle before you try assign the axis.
I made a new version, which has a modifier support (multi key/button press). I just duplicated the gf’s for the modifiers and hide the ‘fname’ Text objects.
Now need to find a way to read the data properly for the file saving. Any ideas?
selection801.blend (510 KB)
I made yet another version, which is listing the function name with input names.
The axis threshold is now 5000 to dump possible axis spiking.
Anybody would like to contribute a better axis detection with calibration routine?
Something like when axis is assigned to the game function, the script will perform the calibration, if not calibrated yet.
selection9.blend (355 KB)
Any feedback concerning my latest .blend?
- Is it working for you?
- Any problems?
- Any suggestions?
it is working fine, but I can’t test the joystick.
Good to hear!
The .blend is detecting nicely my four different joysticks: a three real plus one virtual joystick.