Wrecked Games

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're just that awesome.

Author Topic: How to get rumble on an Xbox controller  (Read 952 times)

Oogst

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 3
    • View Profile
How to get rumble on an Xbox controller
« on: June 09, 2011, 12:27:06 AM »

I use OIS in Windows to get input from Xbox controllers (and other similar controllers). One feature I have not been able to find there, is rumble. I found the ForceFeedback classes, but I don't understand how they work (where do I apply an Effect or something to an OIS Joystick?). Also, I don't even know whether rumble is controlled through OIS' ForceFeedback system, or whether it is somewhere else altogether.
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Re: How to get rumble on an Xbox controller
« Reply #1 on: June 11, 2011, 07:48:05 PM »

Take a gander at the FFConsoleDemo.coo source/app.
Logged

Oogst

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 3
    • View Profile
Re: How to get rumble on an Xbox controller
« Reply #2 on: June 23, 2011, 03:42:28 AM »

I don't see any mention of rumble in that file. I do see stuff about force feedback, so I tried that, but my Xbox 360 controller does not return a force feedback interface. This call returns NULL:

joystick->queryInterface(OIS::Interface::ForceFeedback)

Is force feedback the correct way for getting rumble? That whole bit of sample code with ForceFeedback and Effect and PeriodForce seems a bit convoluted for what I want to do. In other libraries I can simply tell the joystick one or two rumble strengths and that's it. How does rumble work in OIS?
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Re: How to get rumble on an Xbox controller
« Reply #3 on: June 23, 2011, 06:14:08 PM »

Well, if you are using the xinput driver for the Xbox360 controller, Force Feedback (which is the same as rumble, only rumble is one kind of effect) is not implemented - only for DirectInput devices. Most devices on Windows are not xinput devices. In anycase, it would be trivial to implement an XInput derived Feedback device that supported the Xbox360 controller's rumble effect.
Logged

Oogst

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 3
    • View Profile
Re: How to get rumble on an Xbox controller
« Reply #4 on: June 24, 2011, 06:19:12 AM »

Okay, thanks for the clarification!

Surprising that OIS doesn't implement this out of the box: so far OIS has been very complete in my experience. Except for this rather basic feature now. Ah well, for the moment this is just for our game designers working on PCs to create our console game, so I will just let them use sixaxis controllers then, since we have specific PC engine support for those anyway. :)
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Re: How to get rumble on an Xbox controller
« Reply #5 on: June 24, 2011, 10:03:03 PM »

OIS does support Force feedback, the issue just affects xbox360 controllers, which is not a device I have. And it is because MS decided to create yet another API that supports only new devices and not most all other joysticks. Ah well, whenever someone submits a patch OIS will support it :D
Logged

Antodologo

  • Newbie
  • *
  • Karma: +0/-0
  • Posts: 1
    • View Profile
Re: How to get rumble on an Xbox controller
« Reply #6 on: January 15, 2012, 03:03:58 AM »

Hi!

Any plans to get this done anytime? Xbox controller is getting pretty standard on PC (don't ask me why), there are more and more games everyday using FF with Xbox controllers as default: Limbo, Shank, arcade simulators, a lot of games from digiPen (try Nitronic Rush or Nous)...

We would love to add FF to our game, but we have no idea what to do. Any way to get some information about what and how to do it? Would it be enough to get you an Xbox controller to see this feature implemented? ;)

Greetings
Logged

pjcast

  • Administrator
  • Veteran
  • *****
  • Karma: +1/-0
  • Posts: 2661
    • View Profile
    • http://www.wreckedgames.com
Re: How to get rumble on an Xbox controller
« Reply #7 on: January 16, 2012, 10:03:54 PM »

It is pretty simple to do with xinput. but I simply don't have the time. First, the controller must have been first instantiated as an xinput device (with OIS built with xinput support). There needs to be a simple (only needs/can support one rumble effect) Force feedback interface class for xinput devices.

Can use the Win32ForceFeedback.cpp as a template, but it will be much simpler since it doesn't have all the options directinput force feedback has. Than, for xinput controllers, the Win32Joystick class would return that interface to use.
Logged