How to configure headtracking on Linux

Ask here if you experience technical problems with X4: Foundations.

Moderator: Moderators for English X Forum

Post Reply
User avatar
beko
Posts: 53
Joined: Thu, 11. Jun 20, 21:14
x4

How to configure headtracking on Linux

Post by beko » Wed, 7. Apr 21, 22:00

I spent most of this afternoon reading about headtracking and X4 and I can not seem to find a guide or howto on this.

I've X4 4.0 from GOG.
I've opentrack 2.3.13
I tried various output options of opentrack available to me and only Joystick emulation yielded a reaction by X4 (alas, not the desired one: Tracking).

I tried -forcehmd.
I understand tracking works only in cockpit.
I understand that Tobi Eyetracker is Windows only.
I'm confused about TrackIR tho, since this has no Windows Only suggestion in the patch notes.
I only find Settings to Enable/Disable Tracking but that's all. This seems to be a QoL key binding only and has nothing to do with configuring an input device.

I can not for my life find out how to get X4 and opentrack talking to each other on Linux. There is an TrackIR.exe and I have an output target for Wine so this _may_ run for Wine/Proton games but that is of no use for the native version of X4 et al, no? :gruebel:

The following Output Devices are available:

* FlightGear (sends tracking data via UDP)
* UDP via Network - basically the same, send the input to a remote service - basically what FreePIE does to turn a mobilephone into a tracking device over wifi but, as long as X4 does not by some miracle understand this and looks for an open UDP port, also not what I am looking for
* libevdev joystick reciever - basically emulates a joystick detected by X4 but that's not a tracking device so has no effect
* Wine -- Windows Layer For Unix - see above - in theory the way to run TrackIR.exe _for Windows games_.

Can someone shed some light on this, please?

Edit: Collected my findings on https://beko.famkos.net/2021/05/03/head ... -on-linux/ (including demo video)
Last edited by beko on Mon, 3. May 21, 21:42, edited 1 time in total.

rboerdijk
EGOSOFT
EGOSOFT
Posts: 1678
Joined: Fri, 11. Jan 13, 14:26
x4

Re: How to configure headtracking on Linux

Post by rboerdijk » Thu, 8. Apr 21, 12:03

Took a quick look at the code, both TrackIR and Freetrack are windows-only currently (and as you already stated, Tobii is not supported on Linux either).

User avatar
beko
Posts: 53
Joined: Thu, 11. Jun 20, 21:14
x4

Re: How to configure headtracking on Linux

Post by beko » Thu, 8. Apr 21, 17:34

Well f**** :o

So I'll have to try my luck with Proton once more :shock:

User avatar
beko
Posts: 53
Joined: Thu, 11. Jun 20, 21:14
x4

Re: How to configure headtracking on Linux

Post by beko » Fri, 9. Apr 21, 01:10

It was a painful and horrible experience but here we are:

https://beko.famkos.net/wp-content/uplo ... scaled.jpg

Strapped my really bad mobile phone to my headset and used it as source. Now that I have a proof of concept and fiddled somewhat with options and curves I'm somewhat positive that I can get a decent 3 point LED setup done that my webcam can interpret (my phone is not good enough and sends wild yaw data even when holding perfectly still all the time).

It's kinda sad that I have to run this with Wine (it seems to run perfectly tho) instead of using the native Linux version but I guess that's how it is :| TrackIR works basically by checking the registry for paths to NPClient64.dll (or NPClient.dll) and loading this. Opentrack provides loadable dlls and adds the registry entries but works basically by writing to shared memory of the wineserver translating whatever input is defined if I got the gist of this right.

The code to deal with TrackIR is simply not to be found in the Linux binaries according to my quick hex editor search. This makes sense in the light of my other research and the reply from rboerdijk.

I notice that I'm not the first oddball to ask about headtracking on Linux tho :o
Last edited by Terre on Fri, 9. Apr 21, 08:55, edited 1 time in total.
Reason: Images posted directly to the forums should not be greater than 640x480 or 100kb, oversize image now linked

User avatar
MakerLinux
Posts: 234
Joined: Tue, 14. Nov 17, 13:10
x4

Re: How to configure headtracking on Linux

Post by MakerLinux » Fri, 9. Apr 21, 13:07

That's awesome... Great work!!! Will try and test it during the weekend
Brazilian Linux-only user living in Poland, https://steamcommunity.com/id/patolinux on Steam. PC I use for playing: Ryzen 7 7800X3D with 64 GB 6GHz DDR5 CL30, AMD Radeon RX 7900 XTX, ArchLinux
Controllers: steam controller via Steam Input or HOTAS set: TSaitek X52 Pro + MFD F-16 + G29 pedals.
VR headset: Valve Index & Meta Quest 2. My other PC: Steam Deck OLD with nReal AIR AR headset

Rastuasi
Posts: 461
Joined: Mon, 1. Oct 18, 16:28
x4

Re: How to configure headtracking on Linux

Post by Rastuasi » Fri, 9. Apr 21, 14:19

rboerdijk wrote:
Thu, 8. Apr 21, 12:03
Took a quick look at the code, both TrackIR and Freetrack are windows-only currently (and as you already stated, Tobii is not supported on Linux either).
Trackir works in Linux for other games like Xplane 11, but you cannot use their drivers, you must use Linuxtrack. However, since Egosoft requires enabling via the default trackir software, it won't work in X4. Someone could perhaps get Linuxtrack to work though as an add-on.

The alternative is still Linuxtrack, but use the LTR_PIPE functionality that turns the trackir into a joystick. So you'll start the ltr_pipe and then start x4. It can then work like a hat switch. That's how you do it for Eurotruck Sim 2.

Also there's a GIT project that has the Tobii 4C working, but I don't own that to try

User avatar
beko
Posts: 53
Joined: Thu, 11. Jun 20, 21:14
x4

Re: How to configure headtracking on Linux

Post by beko » Fri, 9. Apr 21, 15:25

I don't have a TrackIR device and Linuxtrack was a pain in the neck to compile - especially with qt5. It also just crashed on me later. No idea how do get this running but I stopped trying this since I don't think I can X4 make to recognize a Joystick as tracking device anyway.

Or is that possible with some custom input config in some way? That'd be awesome because I'd really prefer the native version and not add a Wine penalty on top. Late game is already lagging enough :shock:

Rastuasi
Posts: 461
Joined: Mon, 1. Oct 18, 16:28
x4

Re: How to configure headtracking on Linux

Post by Rastuasi » Fri, 9. Apr 21, 17:04

beko wrote:
Fri, 9. Apr 21, 15:25
I don't have a TrackIR device and Linuxtrack was a pain in the neck to compile - especially with qt5. It also just crashed on me later. No idea how do get this running but I stopped trying this since I don't think I can X4 make to recognize a Joystick as tracking device anyway.

Or is that possible with some custom input config in some way? That'd be awesome because I'd really prefer the native version and not add a Wine penalty on top. Late game is already lagging enough :shock:
Easy solution, don't use the package, use the universal build, it's self contained:

https://github.com/uglyDwarf/linuxtrack ... ck-package

Follow instructions and it just works, no QT-5 mess. Now as to X4, you may have to do similar as you do for ets2:

https://github.com/uglyDwarf/linuxtrack ... imulator-2

I've not tried it though, but it makes the trackir a temporary joystick. One could create a script to run the necessary commands prior to starting X4.

I've used this for the past few years where QT-3 was left behind.

User avatar
beko
Posts: 53
Joined: Thu, 11. Jun 20, 21:14
x4

Re: How to configure headtracking on Linux

Post by beko » Tue, 13. Apr 21, 21:18

Not having any joystick makes this a really abstract task :gruebel:

I'll ask around if someone can borrow me one so I can see if the "lookaround" triggers behave in X4 and how the mapping would have to look tho. May be a better way.

User avatar
beko
Posts: 53
Joined: Thu, 11. Jun 20, 21:14
x4

Re: How to configure headtracking on Linux

Post by beko » Sun, 27. Jun 21, 01:53

Built myself a decent head tracking device and came back to this.

While my "solution" to run it via Wine and use Opentrack + Wine Glue to get TrackIR support works it's painful to set-up and also doesn't feel right. I get lower FPS and what not using Wine so I gave the joystick idea another try. Learned a lot about input devices on the topic recently (built my own arcade joystick) and here is the result:

Use "libevdev joystick reciever" as Output device for Opentrack
Map Yaw/Pitch to X/Y and use as Camera Left/Right/Up/Down (X4 somehow detects the default axes 4-6 for yaw/pitch/roll as fire1 so this was needed o0)
Adjust Mapping Properties to own liking.

If run via Steam it's controller mapping override to XBOX controller emulation may interference - make sure that's off or map it there too.

My input map xml looks like this now:

Code: Select all

  <state id="INPUT_STATE_CAMERA_LEFT" source="INPUT_SOURCE_JOYAXES_2" code="INPUT_JOYAXIS_X" sgn="-1"/>
  <state id="INPUT_STATE_CAMERA_RIGHT" source="INPUT_SOURCE_JOYAXES_2" code="INPUT_JOYAXIS_X" sgn="1"/>
  <state id="INPUT_STATE_CAMERA_UP" source="INPUT_SOURCE_JOYAXES_2" code="INPUT_JOYAXIS_Y" sgn="-1"/>
  <state id="INPUT_STATE_CAMERA_DOWN" source="INPUT_SOURCE_JOYAXES_2" code="INPUT_JOYAXIS_Y" sgn="1"/>
While it's not strictly head tracking - as in looking around freely - it's decent enough. Will eventually make a short demo video.

Post Reply

Return to “X4: Foundations - Technical Support”