Linuxtrack 6dof headtracking for wine games

linuxtrack-wine logoSince I was a little kid, I always loved airplanes. When I became a little older, mainly during the 90s I used to play a lot of flight simulators on my computer, I even had a set of decent flight controls (stick/throttle), but for some reason I dropped that hobby for many years. Until I very recently picked it up again.

One really important thing that changed during my abstinence from flight simulators, a huge change that transformed the whole experience, was the almost universal adoption of 6dof headtracking for looking around as you fly!

Now people are able, with simple intuitive movements of their head to be able to look outside as they fly above that beautiful lake, “check six” to effectively maneuver to avoid an enemy plane in a dogfight, or follow the runway with their own eyes as the airplane turns slowly into final approach to line up perfectly for landing! Even better, since 6dof headtracking includes translation as well as rotation, the user can look around an obstacle blocking the view, to see for instance a pesky instrumment in the panel that’s partly hidden behind the stick, or a plane in formation which happens to fly just where the canopy frame happens to have a metal support bar. Just moving the head a bit to the left or the right does the trick… Unbelivable!

Instrumental for the universal adoption of 6dof headtracking among flight simulator users and developers, is a company called NaturalPoint who sells a complete head-tracking system called TrackIR, that includes an infrared high framerate camera, markers that the user attaches to their heads, and supplies an API to game developers to access their headtracking data easily. Now that set doesn’t come cheap, so there’s the necessary free alternative out there, that works with a simple (or even better modified) webcam, called freetrack. The main problem with both of those as you might have guessed, is that they only work on windows.

After the first dissapointment, I obviously had to have that functionality, so I decided to start hacking my old 3dof headtracking experiment to make it 6dof and connect it somehow with games running through wine. However, while I was researching how to do that, I stumbled upon the linux-track project, which does exactly what I needed, but it only worked with a native GNU/Linux flight simulator called x-plane.

So, with only a small piece of the puzzle missing, I went on and wrote a program that emulates the TrackIR API which is supported by many windows games, but feeds them data from linuxtrack instead. Currently I’m happily playing IL-2 Sturmovik and Falcon4 AF through wine, with full head-tracking support, enjoying the virtual view from my cockpit.

This new project of mine is called linuxtrack-wine and is available under GNU GPLv3.

I also had to do a hardware hack, to convert my old flight controllers from gameport to USB, but that’s much less interesting, and I’m too lazy to write about it right now :)

Advertisements

11 Responses to “Linuxtrack 6dof headtracking for wine games”

  1. Eleftherios Kosmas Says:

    Ahhh the awesome ness of this hack is overwhelming!!! I am looking forward to test it on my shiny new laptop running Debian Unstable. I just have to find my old copy of Falcon 4 ;)

    • Nuclear Says:

      Certainly do that, it’s really fun :) Two clarifications though:

      1) the old original version of falcon4 from the 90s doesn’t support trackir. You’ll need a recent version of “Falcon4 Allied Force”, or I think OpenFalcon.

      2) when I say “with a simple webcam” I mean “a pretty good webcam”. The experience would suffer with a low framerate, and you need to be able to control exposure, to reliably track the markers (LEDs) in a semi-dark room without picking up background noise. Check the freetrack website for a lot of details on cameras, markers, etc. Here’s a pic of the marker I’ve made out of cardboard and LEDs :)

      P.S. it’s totally worth the effort :)

  2. Nathan Gray Says:

    WANT!

    Thank you for this! I don’t know if I’ll ever make it work (I only FINALLY just got IL2 working with joystick support under Wine in OS X) but this is just too cool.

  3. Dor Says:

    Nice work, where can I find TrackIR API protocol that you used?

    • Nuclear Says:

      Sorry I can’t remember where I got the protocol info. I think I found a naturalpoint header file somewhere, plus code from games that used the SDK or something. But you can always use my code as a reference.

  4. DaViodoS Says:

    Hi.
    How to get IL2-sturmovik support of linuxtrack-wine? Please help

    • Nuclear Says:

      It’s been a long time since I last worked on this, so it probably doesn’t even compile with current linuxtrack any more. Feel free to fix it and submit patches if so.

  5. DaViodoS Says:

    Thanks ..but i cant do this. I know bash only. :-(
    Yes you have right, its doesn’t even compile with linuxtrack. The wrong path or non existing file error appears :

    $ make
    winegcc -pedantic -Wall -g -c -o src/ltrnp.o src/ltrnp.c
    src/ltrnp.c:6:19: fatal error: ltlib.h: No such file or directory…
    compilation terminated.
    winegcc: gcc failed
    make: *** [src/ltrnp.o] Błąd 2

    The linuxtrack-wine-bin doesn’t work with linuxtrack instaled from Ubuntu maverik repository or compiled from source.
    I was really surprised that here is a freetrack app for linux. Considering that wine doesn’t support USB hardware , the linuxtrack-wine is perfect and only way to get head control of wiev under linux.
    It is sad that linuxtrack-wine is not developed anymore. :-(

    • Nuclear Says:

      I will try to find some time to make linuxtrack-wine work with the new version of linuxtrack at some point. I just don’t have time at the moment. I’ll let you know if I manage to find some time for this.

  6. Fernando Says:

    Hi!
    Excellent work! I’ve had my TrackIR in a cupboard since I changed to Ubuntu, like 4 years ago. It’s a pleasure to have it back on my desk :)
    The thing is, though, I can’t make it fully work. I mean, I have succesfully installed linux-track, the TrackIR hardware is working OK, and I downloaded linuxtrack-wine. After that, I’m not sure how (sadly, I know nothing about code and compiling) I got a folder in the C: unit called linuxtrack with a file called NPClient.dll. When I run IL-2 Sturmovik 1946 under wine I get no response from TrackIR.
    I know I must be doing something wrong, I’d really appreciate some help here.
    Thanks in advance!

    • Nuclear Says:

      Just follow the instructions in the readme file. However as others pointed, recent changes in linuxtrack introduced incompatibilities, and linuxtrack-wine does not compile properly any more. Unfortunately I don’t have the time to fix it. Still, you could give it a try just in case.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: