Posting updates on the Engine feature that I’m adding, as discussed here
Updates on features:
- Able to check when a button is pressed.
Completed. The user can check which buttons are pressed including the triggers.
- Get the amount of deflection of triggers and sticks.
Completed. The used can get the actual and normalized (between 0 and 1) values of deflection for both the triggers and sticks.
- Built in support for dead zones.
Completed. Dead zones are supported for both triggers and sticks.
- Support for haptic vibration. Every xbox 360 controller contains 2 vibration motors. Support to set vibration levels for each individual motors.
Completed. User can set individual vibration speeds for the motors or set the same speed for both.
You can see the interfaces for the above features in the below screenshot:
Updates on stretch goals:
- Support for multiple controllers. XInput API supports upto four controllers.
Completed. The functions that are used to get the above data also accept an optional controller number which can be between 0 and 3 and defaults to 0. The library also polls the XInput API for new controllers every 5 seconds.
- Support for button remapping using Lua/Binary files.
Working on this feature now. Also planning on adding support to define custom dead zones in the Lua files. Expecting to have a working version of this feature by next week.
- Support for pub-sub for events, where instead of the game polling for button presses, the engine will raise an event and call a specific function when the button is pressed.
Yet to start working on this feature. Expecting to finish a basic version of this feature by next week.
Things I’m planning on doing this week:
- Have a working version of Lua/Binary file remapping.
- Have a working version of event system.
- Make the library more performant, by identifying bottlenecks.
This is my first time working with low level APIs and it has been pretty straightforward until now. The XInput API has well written documentation that made writing the code easier. I haven’t faced any roadblocks for this version. But as I develop this module, I expect a few to present themselves on the way.
My main goal in creating this library is to create something that I want to use myself in a game, hence most of the features that I am implementing are those that I have used in the games. For example, having multiple controller support which can be used for local multiplayer. To support this all functions accept a controller input value that defaults to the first controller if the developer does not want to support multiple ones.