Saturday, February 23, 2013

Cannonball 0.181 - Force Feedback

Cannonball now supports Force Feedback on Windows. Here's what's new:

  • Force Feedback Support (Windows Only). More details below. 
  • Controllers: Added support for steering dead zone.
  • Controllers: Added rudimentary support for split axis controllers.
  • Controllers: Able to navigate menus by turning wheel.
  • Controllers: Ability to select analog steering with digital pedals.
  • Controllers: No longer display H/L on screen when gear mode is set to cabinet. 
  • Bug: Fixed Prototype level not clearing.
  • Bug: Fixed score on completing game. The final score was incorrect.
  • Bug: Fixed bonus counter on completing game. (v0.181)
  • Bug: Reversed gear for cabinet play.
  • Build System: Added some changes supplied by user sairuk. 
Firstly, some background; the original OutRun arcade machines provide feedback in three ways:
  • The mini-upright offers the most basic feedback. During a crash, or when driving off-road, the end of the steering column is struck repeatedly. This causes the wheel to vibrate outwards in a crude manner.
  • The deluxe upright is somewhat more sophisticated. The steering assembly is mounted on a moveable layer. This layer, and therefore the steering column, is shifted left and right at varying speeds by a motor.
  • The deluxe sitdown is different yet again. The steering wheel is not connected to a motor mechanism at all. Instead, the entire unit rolls left and right based on your cornering speed, driving off-road and crashing.
On all machines, the wheel is centred by a pair of strong springs.
Cannonball ports the deluxe sitdown motor code. Instead of connecting it to a giant moving seat, the forces are channelled directly to the wheel. This results in both appropriate cornering forces and vibrations on impact. The codebase was not intended to be used in this way, so the results may not be perfect. And the benefits of force feedback will vary depending on your hardware and configuration options. Still, it works quite nicely for me, so please report how you get on. 
Setting up force feedback will require you to follow the instructions in the Cannonball manual here. You should also delete old config.xml files you may have, as the configuration has changed somewhat. 
For the technically minded, you can see the ported motor code here. And the DirectX interface code is here.  The reason for using DirectX is SDL does not yet support force feedback out of the box. I did try a patched version of SDL, but it proved to be more hassle than it was worth. So I simply ensured the DirectX code is omitted on non-Windows compiles. 
Next up, I'll probably resume work on level editing tools. I expect this part of the project to take a while, so there may not be as many regular updates. Many of the easy and quick wins are now complete.

Update: Fixed a bug reported in the bonus counter.

39 comments:

Anonymous said...

This project is incredible, and very well may be part of my currently PCB-less Outrun cabinet restoration, so am excited about the updates!

A question- have you considered adding mouse axis control? (Forgive me if this is already in there and I missed it.)

Sparky Kestrel said...

Thank you for this update, now my number one all time favourite game (of anything ever) has reached perfection.

The deadzone (I needed 10) works a treat with my pad!

You, Sir, are a genius and a legend.

Guess I'll have to buy a new steering wheel with force feedback at some point, as the force feedback doesn't work witb the Xbox 360's simple rumble. Oh well, it'll probably be even better again with a steering wheel.

One thing that would be nice whenever you release another update at some point in the future - a pause mode. I know the arcade game never had one (pointless really) but MAME has a pause mode and it does come in handy sometimes. But as I said, no hurry on this.

yt said...

Press F1 to pause :)

Glad it all works well. Not sure how the rumble on the pads work. I guess they aren't reported as force feedback devices.

yt said...

Wellfed: Mouse isn't something I was planning. Do you mean for control itself? Sounds painful! :-)

Anonymous said...

yt: more for the idea of using a spinner (http://groovygamegear.com/webstore/index.php?main_page=product_info&products_id=268... some people use these in a pinch on their MAME cabs for driving games when there isn't room for a dedicated wheel, often using the optics from a typical PC ball mouse.

yt said...

Probably difficult for me to do a good implementation on a spinner, without one to test on unfortunately...

Anonymous said...

no worries, just throwing it out there.

Thanks for keeping arcade cabs in mind... the shifter support and ability to skip the menu are a thing of beauty.



yt said...

I think with some of the more specialised hardware it's really going to be a case of the interested party doing the implementation work and sending me the code for inclusion.

Either that, or I end up filling my house with a myriad of different controllers :-)

Unknown said...

I can tell you what the FF issue is and the easiest work-around for universal support.

DI is quite sensitive in regards to the number of axis/motors/ect a particular device is using. Let's say you are setting up a ff effect for a wheel, a one axis device.

Now logic would make you think that this effect would also work on a two or three axis device, but it won't. For that you have to setup for the proper number of axis and just not use the extra ones.

Essentially if you want to code it the right way you have to make allowances for every single axis/motor combination.

Or you could do what I did with mamehooker. Add support for FFE files and include a copy of fedit.exe with your app. A user can use fedit to make a "blank" effect based upon their gamepad/wheel ect. When you use the dinput "CreateEffectFromFile" function, this effect will be loaded for the joystick and will have the added benefit of automatically seting up all of the axis and motors for the device.

You can then manipulate the ff variables as you normally would.

yt said...

Ultimately, I'm never going to offer the same level of controller support and flexibility as Mamehooker.

As you pointed out in a previous post, supporting the myriad of controller configurations is a project in itself and probably not where my time is best spent.

Having said that, are you suggesting I should setup the Force Feedback effects for a device with 4 axis? If there's a simple fix I should make to ffeedback.cpp then let me know :)

vc said...

Thanks for this awesome update. Playing with Momo racing wheel for several hours now. :)
Firstly played 0.17 version and hiscore was incorrect. Now (0.18) hiscore is ok, but there is another problem.
Completed game several times with more then 20 sec. and counter was incorrect. For example: last played completed with 19 sec. bonus time and counter shows only 12.6. Only played on "D" 5 stage and every time bonus was incorrect. Also on "D" 5 stage on last 2 curves sometimes the is a hill and sometimes there isn't??? BTW..played on world tracks.

yt said...

vc: Glad you liked the new version. How was the force feedback for you?

I've had a couple of reports regarding the final score. It's something I'll look into.

Can you be a bit clearer about what the problem is? Will make things easier for me.

- Is the final score incorrect, or is it just the bonus counter that's shown wrongly?

- I'm presuming you didn't use the infinite time freeze cheat (that could well mess things up in this area).

Not sure about the hill issue, so can't comment on that for now.

vc said...

Force feedback is just great. Played on default Cannoball settings FF is too strong. Tried to change the settings in the Cannonball, but in the end i left everything by default and only FF decreased to 50% in Logitech profiler.

Playing the game without cheat, normal difficulty. Bonus counter is shown wrongly. Let's put it this way: 19 sec. left, counter showing 12.6 sec. and counting 12.6 millions.

Just one more thing: Is there any way to play game in fullscreen with scanlines without borders?

yt said...

I'll look into the bonus issue. Should be straightforward.

Scanlines can't easily work in full-screen where the final image is stretched by a fractional amount rather than an integer, or you would end up with uneven scanlines. And then I would get loads of bug reports that the scanlines were uneven. ;)

Other emulators and programs suffer from similar issues.

yt said...

vc: The bonus counter bug should be fixed now. Try the new build and let me know how you get on.

vc said...

The bonus counter is ok now. Thanks

RalphUp said...

seems the XBOX 360 Wireless Analog feature using the LT and RT on the same axis doesn't work at all in .18 yt...

if I set Accel to Axis 2 all okay
if I set Accel and Brake both to Axis 2 then acceleration max's out at 68 KPM and the BRAKE works.

yt said...

Neil:Split axis support is basic. It works on my wheel, but that's all I have to test it with.

Are you saying separate axis works ok? If so use it, and ignore mapping controls to the same axis.

If not, have you tried using the XBCD drivers instead?

RalphUp said...

Hi yt, im running Win 8 Pro and dont fancy installing XBCD drivers, it would have been nice to have LT and RT as Brake and Accel as this is the standard config for most racing games, ho hum...

yt said...

Why don't you fancy installing the drivers? Are they problematic? Just trying to understand what the issue is with them.

Have you thought about setting analog steering with digital accel/brake in cannonball instead?

yt said...

Also, what would be the reason Adams 360 pad works whereas you have problems? (See post above).

Unknown said...

yt:

I'm suggesting you add support for the loading of .ffe files (force feedback effects)

If you do that then setting up the axis falls upon the user and not you, so you don't have to do any more coding.

There IS a very convoluted enumeration function you can use, but eventually even I said "screw it, they can deal with this stuff"

I'm busy with other projects atm, but once I get some time I'll see if I can hook up you with some code.

yt said...

Got it. You were right about the controller support. What a complete pain in the exhaust pipe.

RalphUp said...

so is it me mate or is it broke yt?
tested on a different Win7 machine with same issues....
Dont want the extra driver stuffon my win 8 machine as I just want to keep it clean an mean!

yt said...

Don't know. I don't have the same controller as you.

I've outlined two solutions:

1/ Install the drivers (which you don't want to do)

2/ Configure the accel/brake to be digital as opposed to analog in the analog settings.

Julian said...

Hello. How do you run this program? I am double clicking and nothing's happening. Ruinning windows 7 64bit

Well Fed Games said...

Just wanted to say, finally tried Cannonball with my own MOMO wheel and the FFB implementation is fantastic!

yt said...

Great! It's always nice to make someone happy. Really enjoying making the level editor. Progress is looking good on that front!

Julian said...

Hello. How do you run this program? I am double clicking and nothing's happening. Ruinning windows 7 64bit

yt said...

Read the manual as a starting point? Do you have the roms setup correctly?

Julian said...

Yes I read the manual. I put all the correct zipped roms in the roms folder. When clicking on the exe nothing happens.

yt said...

So did you run it from the command line to see if there were any errors, as per the manual?

Julian said...

yes but nothing happens. Does the program support zipped or rar roms?

yt said...

So there's no console output at all? You talk of double clicking the file but you don't double click at a command prompt so I'm confused. Roms should be unzipped.

Julian said...

Roms should be unzipped.
>>>>>>>>>>>>>>

*facepalm*

Thats what it was. Its working now, but this is something you should really put in the manual.

yt said...

Good point, I've updated the manual.

If you did run it from the command line, it would have given you a relevant error.

Julian said...

Hello yt. I didn't run it from the cmd line just the double click method.

Anyway I got it working now and the game looks real nice, good job :)

There's a small problem however, which leads me to make a humble request from you. Several PC users including myself use multiple USB driving controller devices when we play our racing games. I have an ECCI 7000 FFB Steering wheel, a set of CST pedals, and an 8 way H-gated shifter, all of which are *separate* USB devices.

Consequently, cannonball appears to only acknowledge the first joystick device, which is my wheel, not not my other devices ie pedals and shifter. This makes assigning gas, brake and up/down gear shift functions impossible to use on my setup.

Can you please add support for multiple USB joystick devices both analog and digital? That way upon remapping my controller config in the game, it will allow me to assign gas, brake and gear controls to my corresponding hardware.

It would greatly appreciated if you could make this change yt. Otherwise great work on this program my friend :)

yt said...

I may revisit controller support in the future; it's a complex task to support the myriad of setups everyone has. But for now, I'm focused on the track editor stuff.

RalphUp said...

Hi yt,

its been a while since I had time to play and I am using 181 on Win 8 64bit.

I dont want to use the XBCD drivers as I would like to keep the machine as stock as possible,

but what I have noticed is

Setting


0
2
3

works OK, Left Thumb - Steering
Right Trigger - Acc
Right Thumb UP - Brake

If I set:

0
2
2

then Acc doesnt work as reported but also now the Left Thumb UP/DOWN Axis 1 also controls the Acc/Brake so something weird is going on!