JME Controller Config

In my never-ending quest to get gamepads functioning perfectly in my jMonkey game, I ended up creating a couple of utilities based on TestJoypad to make the task easier, as well as to crowdsource the work of getting all gamepads operation to the users. Considering that I find them fairly useful, I decided to extract them from my game and publish them as a standalone library on GitHub for anyone to use.

The library contains two application states of interest. The JoystickPreviewScreen state will display the controllers currently connected to the computer (and update it as controllers are connected and disconnected on properly configured applications), as well as the values of all their inputs. This is essentially a GUI-based, user-friendly enhancement to the original TestJoypad example that, in my opinion, makes debugging joysticks a lot easier.

Once you have an idea what is going on, you can then make changes. Version 1.1 introduces the CalibrateInputScreen state. This screen will show a series of prompts that will guide users through the process of creating a controller remapping properties file compatible with JoystickCompatibilityMappings. Once finished, it spits a configuration file to the location you specify (appending to any previous data if the file exists). You can then load up that configuration file in conjunction with the one that comes with jme3-core upon the next application run.

One of the main ideas behind this project was to utilize as few dependencies as possible. It does rely on slf4j for logging, but most of you will have that anyway. It also relies on the files in the Interface/Joystick folder of jme3-testdata. These can easily be copied over into your own resources folder in the same location. This doesn’t need any GUI libraries, so you can continue using whichever one you want (if any). All you need to do is attach the app states as needed and you are good to go.

I also included examples of how to implement the classes in the :desktop and :android subprojects in the GitHub project. These are fully-fledged projects that can run. If all you want is a standalone utility for development purposes, you can easily download the source and build them.

GitHub Repository: https://github.com/Markil3/JMEControllerConfig
Download Library Release: https://github.com/Markil3/JMEControllerConfig/releases
Store Page: https://store.jmonkeyengine.org/a1befa4d-9727-44bb-9d06-e343de82b180

7 Likes