Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: haptic (force feedback) #265

Open
gilbertohasnofb opened this issue Oct 8, 2017 · 8 comments
Open

Feature request: haptic (force feedback) #265

gilbertohasnofb opened this issue Oct 8, 2017 · 8 comments

Comments

@gilbertohasnofb
Copy link

It would be very nice to have haptic (force feedback) implemented in game so that joystick users could experience vibrations. As an example, here is a list of events that could trigger vibrations:

  • soft vibration when firing lasers, when using fuel injectors and when skimming fuel on a star
  • medium vibration when receiving damage and when jumping to another system/galaxy
  • strong vibration when colliding with objects and when dying

Would something like this be feasible in Oolite?

@AnotherCommander
Copy link
Member

AnotherCommander commented Oct 9, 2017

It could be, but it is not a small task. SDL 1.2 does not support haptic devices out of the box. In order to support this technology we will require one of the below methods:

  • Transition to SDL 2..0. There is already an attempt to do that going on, but it is a laborious process and, to this moment, we do not have 1:1 functionality parity with the SDL 1.2 build. In addition to that, we have already discovered bugs in the SDL2 OpenGL headers on Windows, which slows us down even more and as a result we still have to get a Windows build of the game on SDL2 working. Once we have achieved all that, then we can think of using SDL2's haptic support to add to the game. Not easy, can't happen very soon.
  • Backport haptic support to SDL 1.2. The good news with that is that there is already a patch somewhere out there that does this, although I don't think it is based on our exact version of SDL. Still, good to have around: http://icculus.org/~taylor/misc/sdl_1.2-haptic.diff.gz. The patch is quite big and, if it can't be applied automatically using the patch utility, then it will have to be ported manually and that will take a while too.
  • Enable haptic support using native OS API calls. This is probably the fastest way to do it, BUT, at the expense of portability, since each OS will have to do it its own way. I cannot say that I would prefer this method really.

So, whichever way we try this is not something that can happen soon. But it probably is not impossible either.

@KonstantinosSykas
Copy link
Contributor

Despite the itch I have to put my hands on this, I wonder what will happen with the installations coming from Linux repositories.
These installations will not have the patched SDL library, delivered with oolite.org installations, thus, breaking execution or just not supporting haptic, right? 😟

@gilbertohasnofb
Copy link
Author

Thank you two for the input, I imagined this would not be something trivial (else it would probably already be implemented). Would it be all right to leave this issue opened then in case someone wants to take a look at it in the future?

@KonstantinosSykas
Copy link
Contributor

@AnotherCommander
Let's leave it open for a couple of weeks. I need to have a look at it, because we have the same library issue with SpiderMonkey JS and this dualism has started getting on my nerves.

@KonstantinosSykas
Copy link
Contributor

OK. Let's forget the "dualism" problem and focus on what features can be delivered in Oolite from oolite.org. We will leave the player decide whether to install from oolite.org or not.

Having this set, I have checked the Oolite for Linux SDL version and luckily it is 1.2.14; the exact same version the patch needs. So I paused on that front and turned my attention to Windows.

On Windows, things become more interesting. The SDL version used here is 1.2.13; one step behind the version needed by the patch. Upgrading to 1.2.14 is a very tedious task, and unless there is another volunteer, it is not an option. The first skim through the patch contents, was very promising, so I decided the manual patching approach.

Stay tuned for updates.

@gilbertohasnofb
Copy link
Author

Stay tuned for updates.

Sounding really promising, thanks for taking a look at this!

@KonstantinosSykas
Copy link
Contributor

Still busy on trying to backport force feedback support on SDL 1.2.13 for Windows. What we have seen so far code-wise, is that we are in a pitch black room trying to find a light switch, without knowing if actually there is a light a switch. Frankly speaking, this has lessen our hopes.
However, we continue the effort and have managed to have a first build of the library. To see if it's worth it, we are looking to get our hands on a force feedback device to start a library stand-alone testing cycle. This cycle will show us if we will "turn on the light" to proceed with Oolite force feedback support.

@KonstantinosSykas
Copy link
Contributor

We haven't found the light switch, yet, however, we now have a flashlight. 🙈 🔦

An experimental SDL1.2 with haptic support is ready for Windows 64bit. A couple of vibration effects have been successfully tested (using a testhaptic utility delivered by libsdl.org) on a BlackWidow XE (aka SL-6640-BK) stick.

SDL1.2 with haptic support is also built for Linux. I can't find a way to make Linux recognize the stick's vibration capabilities, though. I will be calling out for testing help in the Bulletin Board.

In the meantime a new branch (named "haptic") is opened to receive the results of this effort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants