Server part of HulloWheel, a virtual gaming wheel for Android + Linux
I'm a lover of Euro Truck Simulator 2. I love overspeeding in it. Problems are:
- I play on Linux (Ubuntu + Steam OS)
- I don't have a physical joystick / game wheel
- There were no virtual "wheel + gas pedal + brake" controller for Linux, although there is a great gamepad for both Linux and Windows written by rmst. But we drive trucks man, we want no yokes. Gas pedal and brake man!
- Making my own game controller is cool.
I had the following inputs:
- An Android phone
- Inspiration from this repository by zvxryb
- ETS2 (that was how I tested my wheel)
and the following output:
- HulloWheel, a Android client + Linux server combination. See Hacking for details
There is a pre-built program available in the release page. It is only for 64-bit Linux though. If your system is not, you'll have to build the program yourself.
Once downloaded, there are no installation step. Just run it.
./HulloWheel-x86_64 # Or only ./HulloWheel if you built it yourself
Also see the available options by:
./HulloWheel-x86_64 --help
A list of libraries required:
# tools
cmake
make
gengetopt
# libraries + headers
zlib
pthread
On Ubuntu / Debian:
# With root privilege
apt-get install cmake make zlib1g zlib1g-dev libpthread-stubs0-dev gengetopt
I don't know other systems. Please make a PR to this README if you know. Thanks.
# Install dependencies first
https://github.com/hulloanson/hullowheel-server.git
cd hullowheel-server
./build.sh
A binary named HulloWheel
will appear at the root directory. Run it. Try it out with https://github.com/hulloanson/hullowheel-android
./VWheel
# Press Ctrl-C / send SIGINT to stop it.
-
Now server normalizes client values. It shouldn't happen. Should leave it up to the client.
-
Performance. Now it lags behind a bit.
Possible reasons:
- Now each frame averages 29 bytes gzipped, which contains the state of all 24 buttons and 3 axes (wheel, gas, brake). Perhaps send only the modified inputs?
-
The only way to configure which port to listen to is to modify the code. Add argument support.
-
Have to restart server and android app after disconnects. Probably due to UDP intricacies I'm not familiar with.
- Solved. Now the server auto-restarts on timeout
- Runs on Windows
- GUI
Now works with:
- Euro Truck Simulator 2
jstest
Please add to this list if you find HulloWheel works with a game / software. Thanks.
I tried to keep it clean and clever, but I so rarely touch C
. Roast me all you want.
3 parts:
Entrypoint. It:
- sets up a wheel called "HulloWheel" (uinput blablabla.); then
- starts a UDP server on port 20000 on a separate thread; and then
- listens for interrupts and tear down the wheel and server
Everything about the wheel. Creating the wheel, registering on uinput
, writing event input, etc. Exposes function emit
that Server
uses
The listening socket part. The data decompressing part. The data parsing part. Also "emits" input events.
Also layout of a "frame":
0 4 8 12 36
|------------------|------------------|------------------|------------------------------------------------------|
| wheel (float) | gas (float) | brake (float) | buttons (byte) * 24 |
|------------------|------------------|------------------|------------------------------------------------------|
Note: all floats are 32-bit precision float, little endian
The HulloWheel server uses macrologger (courtesy to https://github.com/dmcrodrigues/macro-logger) for logging. Kinda simple I know, but I don't want a full-blown library with additional configurations files / (de-)initalizing lines. Educate me if there was more well-tested and simple ones.
First a big thank you for your efforts. Please always make PRs on the dev
branch.