Toyed with my Steam Link (I still have this as hardware) at the 55″ TV in the living room today. Never tried this before with X4, because I bought X4 on GoG so it’s a “foreign game” for Steam.
It just worked though. Think that’s a little bit too much for gaming (neck hurts already xD) but it was a nice experiment. Maybe with an elevated seat 🤔 …oh and I even tried it via the Steam Link App on my mobile phone – briefly xD
Also tried House Of The Dying Sun this way (little gem, IMHO, even if very short).
I hacked a mod for X4: Foundations to get ship telemetry and targeting data to my “Primary Buffer Panel” via a socket. This is a demonstration of my simulated cockpit made from cardboard on a budget usually used to play Elite Dangerous now also used for X4: Foundations. This is work in progress.
A Linux PC
A DIY Headtracker
A DIY Joystick (My Primary Buffer Panel)
A X52 Pro HOTAS
An AMD RX6700XT
…a lot of plumbing in Node-Red xD
This is loosely based on the Python Pipe Server mod for X4 that is sadly Windows only using Named Pipes. I fixed that for Linux PC by side-loading the library LuaSocket and starting a socket server directly in X4. That’s right, the Python Server is simply not needed now and companion tools may directly connect to the socket. It’s a nice bonus that LuaSocket also allows a UDP or TCP server depending on how it is started. That was some piece of work though and I’m still wrapping things up to publish my code changes. I’m also still looking for testers so if you’re interested get in touch!
Here are the humble beginnings of a working example to read the ship status of #x4foundations in a format very similar to the Status File of #EliteDangerous
Both games are quite similar and by using a “well established” format it should be possible to use this with existing companion apps – like my own #SimPit
It uses the “Named Pipe API” of “sn_mod_support_apis” – on #Linux PC 😁 This was not supported by this MOD so far but I made it work.
Well, at least on my machine 🤓
And yes, the pipe server works with some minor adjustments for other _existing_ apps as well. Here is a demo of #X4ExternalApp with a data feed directly from X4: Foundations – it does not use the #X4PythonPipeServer though, since that is not really needed, so I had to make some small adjustments in it’s connection routine but that was like 2 lines of code 🤷
This is heavily distilled early gameplay of X4: Foundations, where I started another play-through slowly expanding my little empire with trade, side missions, station building, border patrol (loosing the the “Misfit”, my good old starter-ship), a surprise Xenon attack on a station where I was just for shopping and eventually good old fashioned piracy with unexpected guest appearance of some Kha’ak trying to crash the party.
01:11 Setting up trade routes aboard The Law Abiding Windrunner 02:20 Switching over to the Misfit 03:05 Witnessing the death of a trading station (while escorting my own ships to safety) 03:50 Patrolling for money (and looting stuff) 05:48 Repairing satellites (in EVA suit) 07:32 Docking at the impressive Teladi ring station for shopping 08:45 Surprise attack on the ring station by a Xenon K (and it’s demise) 14:32 Extending my own station and buying more mining ships 11:26 Switching over to my frigate for border patrol (lots of pew pew) 14:30 Loosing the Misfit to Kha’ak (and avenging it) 16:07 Going for resupplies and preparing for piracy 16:39 Ambushing the prey, a fat water freighter looking for a new owner 17:59 Starting the boarding operation 18:40 Realizing I need more support to deal with surprises 18:58 Stumbling over mentioned surprises, Kha’ak trying to crash the party 19:51 Sending more boarders as the first group fails 20:22 Finally going home with the price, a “slightly banged up” L water freighter
I’m wondering how to present ultra wide screenshots for a while now, because most people will not have an ultra wide display at hand or not run their browser in fullscreen on such a device. A scaled down version with retained ratio also just don’t really cut it:
Now what if we could wrap this in some sort of 360° image? This isn’t really 360°, of course but you get the idea. A quick search usually yields JS libs like Pannellum (https://pannellum.org/), which look great for this use-case as well and yes we could also solve this in CSS by using an animation and go for a little camera ride.
What if we could optionally also make use of a gyroscope though? You know, that sensor every mobile phone, tablet and VR device comes along with. So the user could device where to look just by moving the device around?
This was when I stumbled over A-Frame (https://aframe.io), which is basically a library for building 3D AR or VR experiences and while I may only scratching it’s surface with my quick tests here it does deliver exactly what I was looking for.
I built demos for various games today and I don’t know how long I’ll host the files here but they all follow the very same code pattern that I’ll add in the end:
Please be aware that I’m loading a ~5mb blob of JS code directly from A-Frame in the demos so don’t check them out if that is a problem for you. The image asset adds another whopping MB so please be patient. The best experience is on a mobile phone where you should be able to look around by moving the phone left and right. It works on a desktop browser too where the mouse can be used to look around.
Feel free to copy this snippet and play around with it. Just keep in mind that you have to use _local_ assets too or they won’t show up. Make sure to read the documentation too and play with the built in inspector opened with the key combination ctrl + alt + i.
And yes I’ll happily take a CSS only variant too but I really doubt that’s possible without loosing features like gyroscope data usage.
I sure am playing a lot of space pew pew over the last months. Took a lot of screenshots too and it’s kinda hard not to drown my timeline with screenshots every day. Today I sifted through the pile and found a bunch I’d like to share (some again) so here is a little gallery of (mostly) space simulation games I play on my Linux PC. And I’ll keep making that point until I can browse the web without getting daily reminders by random strangers claiming that gaming on Linux PC is not possible. Cuz it is.
Added on 5th January 2022 and played with whatever Lutris thinks best. I really was going to hold out on Star Citizen a little longer but I got it as a gift to my birthday. My GPU is definitely at it’s limit here. Will probably have to give it some more time. I mean it’s Alpha and all but hey, it _does_ work.
This I play mostly under Proton with the Primary Buffer Panel whenever possible. It’s just the most fun this way (kids love it too).
The more recent X series have native Linux builds but work also perfectly fine with Wine.
Both run via Lutris and with Proton-GE and usually with my DIY Headtracker.
FlightGear runs native on Linux and Fly Dangerous does have a native Linux build but due to an issue with terrain generation being single threaded I use Proton for this one too until this is solved. No Man’s Sky runs perfectly with Proton.
I play all of the above with my X52 Pro H.O.T.A.S. and some with my DIY headtracker stretched over three displays in a so called multihead setup. Let me know if you’ve any questions how this can be set up.
I like space and science fiction. Diving into epic stories set in some distant future amazes me since elementary school.
I’m also a gamer. And a tinkerer. It’s in the family.
I keep wondering: How can I improve the immersion of my games without going full VR?
I used a triple screen set-up before. It consisted of different models in height and size. When one screen finally broke down I purchased 3 refurbished screens of the same brand and model. What a difference!
The kids love it too. Of course. Means less stick time for me. Anyway.
The thing is: “The” reference product for a headtracker is the TrackIR system. Price as of today: 220 EUR. Ouch! That’s like a cheap VR, right? And it’s Windows only. No thanks.
So I checked what’s in this thing. Apparently a cheap camera, some infra-red LED, and a filter allowing only infra-red waves. And software, of course.
Since this is for Linux I get to pick my poison for the software part, and I settled with Opentrack fast. Onwards to the hardware part. I abused my mobile phone for the testing, sending it’s Gyroscope data via wifi to my PC, and while it worked it also _sucked_. Both, phone and wifi I mean.
Head tracking is awesome. And I knew I want it. So I started prototyping. For this I went with a simple design that I eventually implemented on cardboard. It looks hilarious but it gets the job done.
The focus was on a long life cycle so I wouldn’t have to replace the rechargables in the middle of a session. To get this right I checked with the camera that I was going to use. See (video above), this is way to bright and by trying various resistors I could get this down to 33mA per LED and still get a decent detection rate with Opentrack.
Speaking about the camera. That’s nothing special. It’s a dead cheap 480p Logitech QuickCam Communicate STX that I got from a discounter a decade ago. It was so cheap it doesn’t even _have_ an infra-red filter that I’d have to remove first.
I used tape to attach the salvaged camera cover of a dead G20 controller. That’s a Wii Remote knock-off that does basically the same thing like a headtracker. Various other foils can be used for this as well, as long as they permit infra-red. The idea is to reduce or remove all other light waves but infra-red.
The trick is to also turn off auto exposure and fiddle with the contrast and sharpness until a decent frame rate and a clear infra-red wave source by the LED can be seen.
When I was satisfied with my meter readouts, and my highly professional scribbles, I started working on the prototype while streaming the whole process on the Discord channel of the awesome Fly Dangerous project. If you like racing with a space ship give it a shot.
The prototype is made of cardboard that doubles as isolation for the polarity. The rest is tape and hook-and-loop fastener to attach the headtracker to my headphones. No magic here. The whole contraption is powered by two 1.2V rechargeables. I opted for a micro switch and an additional LED as power indicator, that I dimmed down even more. I can after all not see infra-red so this seemed like a good idea to me. Spoiler: It is.
So how does it play? Over the next weeks I tried basically any game supporting head tracking that I could get my hands on. Please keep in mind that I usually play with lights off but started the studio lights for demo purposes. The tracker does still work just fine.
I quickly found out that each game needs it’s own profile for fine tuned settings. Good thing that Opentrack has me covered on this. First, my beloved X4 using Wine and the TrackIR protocol.
Sadly I came to the conclusion that my GPU is no longer up for the task and Wine would cost me too many frames. I switched Opentrack to emulate a joystick instead and mapped it to camera movements in the native X4 version. It’s not exactly the same but it’s okay-ish. I have an idea how to hack this properly into X4 using an extension and a UDP server but that’s a topic for another day.
Anyway, the same principle works with X Rebirth too, making me even happier. While dated it still has it’s charm and the verse still feels a lot more alive compared to X4. It’s also not taxing my GPU that much.
Now for something different. When Opentrack would list a “protocol” named FlightGear I became very curious. I installed this free and open source flight simulator and crashed my first Cessna into the ground minutes later. By now I’m confident that I can crash a Cessna just about anywhere. I’m not fond of flying in real-life but avionics sure are a fascinating topic.
This was the moment a Steam sale happened and I bagged various flight sims, Space Kerbal and House Of The Dying Sun. All with TrackIR support.
Little did I know what gem I bagged with House Of The Dying Sun by the way. Sadly it’s also very short but I enjoyed every minute of it and will probably play it again. The art, sound and music reminds me a lot of Battlestar Galactica. Easy win 😀
So yeah, this is my current gaming set-up. I built myself a head tracker for 5 EUR. On Linux PC.
I also may have fallen into the rabbit hole called “simpit”.
This is the journey of getting head tracking for X4 Foundations on Linux. Browsing the in-game options I found key bindings to enable and reset a head tracker so I got my hopes high for head tracking for X4 on Linux and started reading.
tl;dr: The native build of X4 does not support this at all. It even lacks the symbols in the executable. There is hope with Wine though.
While seeking through the patch notes two things catched my eye (harhar). The notes suggest support for Tobi Eyetracker and somewhat earlier TrackIR. The Tobi one was marked as “Windows only” so I hoped for TrackIR and tried to understand what is involved into getting this particular head tracking to work.
Please do keep in mind that I never touched any head tracking before so I had to grasp the theory behind all this first.
So apparently there are not many possibilities to configure anything in-game. There is the additional start parameter -forcehmd that may have some effect here but that’s about it. So everything related must come from the outside, right?
Funny enough a Kerbal Space Program extension on GitHub provided me with the idea how TrackIR is supposed to function: https://github.com/pizzaoverhead/KerbTrack/blob/master/KerbTrack/TrackIRClient.cs#L45 so let’s clear that one up: The code looks for the registry entry “Software\\NaturalPoint\\NATURALPOINT\\NPClient Location” that points to the NPClient.dll (or NPClient64.dll) which in turn in loaded by the executable if found and accessed. And sure enough I found the same pattern by using the good old hexeditor on X4.exe as well:
You may suspect this already but none of that can be found in the X4 binary for Linux and this is the end of the story.
Appendix: It might be possible that a joystick look-around thingy may be abused for this but since I do not own such a joystick (yet) I wouldn’t know how to fake such signals.
Freetrack seems to be a implementation of what TrackIR does up to version 4. Looks like the company didn’t like that or was afraid that some tinkerers use self built head tracking devices and not buy their ~200$ hardware any more so they added encryption to their devices with version 5 leaving freetrack dead in the water. Or whatever. So if a game would only support protocol 5… it’ll probably no longer work. Anyway, let’s jump into OpenTrack and give it a try. Once all required developer packages are installed, that includes the wine-devel packages for i686 (and libevdev if you want virtual joystick support), this can be compiled:
git clone https://github.com/opentrack/opentrack
The important part is to tick the SDK_WINE option or we don’t get the precious Wine Glue. Here, have a video:
And sure enough we find the following already familiar files in install/libexec/opentrack/
So what OpenTrack does is once it’s started and configured to use “Wine — Windows layer for Unix” as Output: It “injects” the key [Software\NaturalPoint\NATURALPOINT\NPClient Location] to the user.reg of the configured Wine/Proton prefix on start while the also started opentrack-wrapper-wine.exe.so is used for the shared memory mapping – means from my understanding from the OpenTrack binary to some Wine process. TrackIR.exe is just a dummy that may also be run with Wine but does nothing. It’s apparently for games that check for a process with that name before they initialize head tracking features. Neat, huh?
For this to work you have to click on the little hammer symbol next to Output so make sure that your Wine Prefix is properly configured or OpenTrack may insert the registry key to the wrong Wine prefix. Sure enough it seems to come Steam and Proton ready as well but I did not try this because I made the mistake of buying X4 on GOG (I know this is getting old).
So what’s next? Oh yes, a Head Tracking device. Well bite me, I don’t even have any. Why did I go through all this trouble at all?
The head tracking device
Well why should I purchase such a device without knowing if I can even use it? Do you know what kind of device has a gyroscope built in however? Yes, every average smart phone has one and some are even really good (I hear.) So here comes the fun part: I strapped my mobile phone to my headphones while an app sends the tracking information via wifi and the UDP protocol to OpenTrack as input source.
So I will not bore you with the details how I configured and mapped this in Opentrack. It will be of no use for you anyway since this depends totally on your device and system but I can tell you that this is a lot of fiddling with the settings. Also know that a 3-point device can indeed be built for ~10$ with some LED and a webcam – there are various people demonstrating this on the net and you will find plenty on the usual video platforms.
I don’t like to have to install the game twice now, once native and once with Wine, but… it’s for science! Or so.
Yes, it’s a little clunky. This is probably because:
my phone sucks
my phone really sucks (seriously)
it’s UDP – order of packages is not guaranteed
it’s wireless and the access point is two walls away
…and I probably also messed up with the mapping and filter options 🙂
I even read that it’s not any better on Windows xD
So that’s it. Head tracking on Linux for X4 Foundations. Jumped the hoops 🙂
It reads just the camera position and not really the ship position (and since there is no up and down in space it settles fast on the new artificial horizon – may need some more tuning)
Plumbed the speed to the pressure so it starts creeping up from 27.1 inHg to 33 inHg (max on the instrument) when speed goes over 200. Just for fun.
Turn Coordinator is just Camera yaw + left or right based on mouse/pointer X.
Some target data as proof of concept
This worked out better than expected and the best thing is: Doesn’t need to run on the same computer – it just has to be on the net so a tiny Raspberry and some external display would be enough for some fun cockpit building 8)