Page 1 of 1

How do you create your own controller?

Posted: Tue Apr 07, 2015 5:43 pm
by dspcincozo
Hello everyone,

First post so forgive me if the formatting isn't correct. I am making a game right now in which I am using an arduino and some floor sensors to act as the controller. I've got it working (kind of) using UDP send/receive packets from Processing ---> love2d. My issue here is that it doesn't work all the time and sometimes it isn't as responsive as I would like it to be. There has to be an easier way to do this. I've got 4 "buttons" that are triggered by weight sensors (a reading from 0-1025, 500 or so being "on"). All i need is an on/off state.

I've seen that there is a "joystick" function but I haven't seen anything where I can set up my buttons to act as a button. Hopefully this is something super obvious that I have looked over.

Any suggestions how I can get this to work more efficiently would be greatly appreciated.

Re: How do you create your own controller?

Posted: Fri Apr 10, 2015 8:47 pm
by T-Bone
Löve relies on SDL for things like these, so if you can make your Arduino be identified by SDL as a controller, you're good to go. Finding info about that might be easier, since SDL is more commonly used than Löve.

I also know that, from within Löve's source code, it's possible to "hack" things to be registered as controllers by Löve. The Android and iOS ports use this to make the accelerometer available as a controller. So if you can make the input available without lag in C++, you can probably hack it together if you're ready to modify Löve's source code.

Hope this helps you a little :)

Re: How do you create your own controller?

Posted: Fri Apr 10, 2015 9:11 pm
by dspcincozo
T-Bone wrote:Löve relies on SDL for things like these, so if you can make your Arduino be identified by SDL as a controller, you're good to go. Finding info about that might be easier, since SDL is more commonly used than Löve.

I also know that, from within Löve's source code, it's possible to "hack" things to be registered as controllers by Löve. The Android and iOS ports use this to make the accelerometer available as a controller. So if you can make the input available without lag in C++, you can probably hack it together if you're ready to modify Löve's source code.

Hope this helps you a little :)
Awesome I will check it out.

Thanks!

Re: How do you create your own controller?

Posted: Fri Apr 10, 2015 9:36 pm
by s-ol
It will probably be a lot harder to use the controller interface than hack something together with a DLL/so library. For example you could cut out the Processing middleman and instead open the COM port on it's own: https://github.com/edartuz/lua-serial

The controller interface is meant for Gamepads like PS3 and XBox controllers and they need to be detected by a system driver to work (afaik).