iDevGames Forums
Force feedback example? - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: Force feedback example? (/thread-7223.html)



Force feedback example? - rvangaal - Mar 17, 2003 02:56 AM

Hi all,

I would like to add force feedback to my racing sim, but the FF SDK seems in its infancy. Does anyone have a small example program, or is there any by now on some website?
An extract would do nice as well, most probably...

I did go through the entire HID thing, to get axis values out of a game controller, so that code is all there. It might be just a matter of writing values to the HID device, but since the HID input code was already so obscure and abstract (compared to what it does), just guessing for HID output code seems a dead end.

Thanks.


Force feedback example? - wadesworld - Mar 17, 2003 08:40 AM

Apple has a FF SDK which has not been released due to legal wrangling over who has rights to what.

So, you're pretty much stuck until it's released, unless you have a contact inside of Apple.

Wade


Force feedback example? - GoodDoug - Mar 17, 2003 11:38 AM

Quote:Originally posted by rvangaal
Hi all,


I did go through the entire HID thing, to get axis values out of a game controller, so that code is all there. It might be just a matter of writing values to the HID device, but since the HID input code was already so obscure and abstract (compared to what it does), just guessing for HID output code seems a dead end.

Thanks.


Be careful trying that, I ruined two controllers trying to do that very thing. Wait for the SDK if you can.


Force feedback example? - rvangaal - Mar 18, 2003 04:54 AM

Thanks for the writing warning!

I do have a latest beta SDK which has documentation, I've found. Now it's a matter of getting a USB force device to test with.

I think the original FF implementation was in 10.2.3; I did get a later SDK from a contact though indeed. Has a nice testing app inside to test all the calls and see if the wheel responds. Unfortunately my ActLabs ForceRS (PC originally) isn't recognized by even the HID Explorer. PRobably doesn't do the HID protocol.


Force feedback example? - rvangaal - Mar 21, 2003 05:38 AM

Just for the interest; I've bought a Logitech Wingman Formula Force GP yesterday; it's recognized, although the controls funnily are nested a bit strangely; it has all its controls under an 'X-axis' node. So the buttons are X-axis/Button 1 etc, and the axes are X-axis/X-axis and X-axis/Y-axis (in HID Explorer).

Had to adjust some code to find the cookies for that correctly. My only other wheel (a Modena 360 Pro, which has no FF) has the controls just neatly in an array, without going into a deeper dictionary.

I then just did a FFCreateDevice() and FFDeviceCreateEffect() (and FFEffectStart()) and that worked quite quickly. It's weird how they kind of took over MS' DirectInput coding style (with effect.dwAxes[] and such) so directly.
Anyway, it should be a breeze to integrate a bit neater into my joystick class in the same way as I encapsulated DirectInput, as the code is just about the same.

Good to see the wheel moving. After HID, the FF api is quite a bit better (although I must confess I had experience with DirectInput, so in the end it's not really all that clean, but very recognizable).


Force feedback example? - rvangaal - Mar 22, 2003 10:01 AM

It all works now, including a couple of effect types.

You can feel the result in the Mac edition of Racer v0.5.0 beta 11, see:

http://forum.racesimcentral.com/showthread.php?s=&threadid=68910


Force feedback example? - wadesworld - Mar 23, 2003 08:24 AM

Quote: It's weird how they kind of took over MS' DirectInput coding style (with effect.dwAxes[] and such) so directly.

That's actually brilliant. For any game coming over from Windows (and most of the big ones are), it takes very little work to adapt your FF code to the Mac.

Wade


Force feedback example? - rvangaal - Mar 24, 2003 03:01 AM

It was indeed mostly just a copy & paste, search & replace DI -> FF.

On the other hand, that did mean they also took over some of the things I like less about MS programming style; the 'DWORD dwFlags' type of thing.
Not that I found HID to have a particularly readable interface though. Wink