[MOD/API] X4RestServer - External http API

The place to discuss scripting and game modifications for X4: Foundations.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

Rezoken
Posts: 13
Joined: Sat, 6. Feb 16, 09:54
x4

Re: [MOD/API] X4RestServer - External http API

Post by Rezoken » Tue, 12. May 20, 17:34

Do we have any indication from the X4 Devs that the DLL injection is not going to possibly be flagged through Steam or anything like that?

ShoC
Posts: 617
Joined: Sun, 8. Feb 04, 16:06
x4

Re: [MOD/API] X4RestServer - External http API

Post by ShoC » Wed, 13. May 20, 09:58

Wow this is exciting !!

You have given me a project. (If I get a chance)

Make a website for displaying all the data, I'd look at logging account finance and storing that to an SQL lite data-base and use Google API to make charts showing asset changes over time periods chosen.

What would be interesting is getting global averages for all product prices and seeing how they change over time.

Man this is awesome!
they have had almost 1000 years to terraform Aldrin, why are they all still sitting around a giant rock?

Catra wrote:
because you cant terraform a rock.

Exi
Posts: 23
Joined: Tue, 2. Dec 03, 23:20
x3tc

Re: [MOD/API] X4RestServer - External http API

Post by Exi » Wed, 21. Oct 20, 20:17

Reading this literally made me jump back into the X universe, after a very long break. Years ago I've made a mod for X3 TC/AP which displayed ingame information on the Saitek X52 Pro's display, and also used the LEDs on the controller for various feedback. Your work could make it possible to port this to X4 now, and it could be even better than the original due to the possibilities in this API. I've waited out with X4 for quite long, but this was a trigger.
So I'm looking forward to see more of your work, and a big thank your for all the time invested in this.

kuertee
Posts: 332
Joined: Sun, 14. Dec 03, 14:05
x4

Re: [MOD/API] X4RestServer - External http API

Post by kuertee » Thu, 22. Oct 20, 13:55

bookmarked :)
Mods: Gmply:Alternatives to death,Crimes has consequences,Friendly fire tweaks,Hacking outcomes,High-sec rooms are locked,Mod parts traders,More generic missions,NPC reactions,Reputations and professions,Teleport from transporter room,Wear and tear;QOL:Loot mining,Ship scanner,Signal leak hunter - increasing range,Station scanner,Surface element targeting,Reset mouse on menu and controller,Waypoint fields for deployments;UI:Accept mission for later,Active mission,Functional radar texture.

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

Re: [MOD/API] X4RestServer - External http API

Post by beko » Sat, 1. May 21, 21:29

I want to report a bug: This project is way to exciting!

I got it running on Linux
Spoiler
Show
and may be aroused :o

Cadbury
Posts: 6
Joined: Sun, 17. Nov 19, 22:57
x4

Re: [MOD/API] X4RestServer - External http API

Post by Cadbury » Sat, 1. May 21, 23:43

How did you get it running on Linux? I'm using the steam version and have followed the instructions but the game never starts. I can see the process running but it's not doing anything and no window appears :(

If I run the exe without the LD_PRELOAD, it still doesn't start which makes me think it's something about the steam exe that's causing issues (when steam isn't running).

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

Re: [MOD/API] X4RestServer - External http API

Post by beko » Sun, 2. May 21, 00:00

Cadbury wrote:
Sat, 1. May 21, 23:43
How did you get it running on Linux? I'm using the steam version and have followed the instructions but the game never starts. I can see the process running but it's not doing anything and no window appears :(
Not so easy with Steam. I'm running the GOG version and I'm starting it just like that after the lib was compiled:

Code: Select all

LD_PRELOAD="${LD_PRELOAD}:/games/linux/X4_Foundations/game/lib/X4RestServer.so" ./X4 -skipintro
I did move the lib into the game lib folder though. Game starts fine and the server is raised on port 3000 (hint: 0.0.0.0 is free for all, anyone on the net/wlan can talk to this now and break your game)

Code: Select all

beko  ~  lsof -i tcp:3000
COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
Main()  73073 beko    5u  IPv4 517725      0t0  TCP *:hbci (LISTEN)
YOU will probably have to set the Steam start options so something like this (don't hold me to that - not so firm with Steam)

Code: Select all

LD_PRELOAD="/path/to/X4RestServer.so" %command% -skipintro 
The FFIRipper is giving me some trouble but that's not required to talk to the server from my understanding. It just builds the references for available FFI stuff. Postponed - playing with the server is way more fun right now :D

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

Re: [MOD/API] X4RestServer - External http API

Post by beko » Sun, 2. May 21, 18:37

I'm having way too much fun with this. Did some plumbing today and this is the result :D

Image
Short screen recording: https://beko.famkos.net/2021/05/02/auto-draft/
The flight instruments are from https://github.com/uw-ray/Skyhawk-Flight-Instruments and are not for a spaceship - obviously

I patched the http server to send Access-Control-Allow-Origin so the browser wouldn't refuse to load. Could set up a proxy but I wanted results fast :roll:

* Speed is also mapped to ALT as Fast Travel speed
* 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)

kuertee
Posts: 332
Joined: Sun, 14. Dec 03, 14:05
x4

Re: [MOD/API] X4RestServer - External http API

Post by kuertee » Sun, 2. May 21, 19:13

nice!
Mods: Gmply:Alternatives to death,Crimes has consequences,Friendly fire tweaks,Hacking outcomes,High-sec rooms are locked,Mod parts traders,More generic missions,NPC reactions,Reputations and professions,Teleport from transporter room,Wear and tear;QOL:Loot mining,Ship scanner,Signal leak hunter - increasing range,Station scanner,Surface element targeting,Reset mouse on menu and controller,Waypoint fields for deployments;UI:Accept mission for later,Active mission,Functional radar texture.

Mycu
Posts: 269
Joined: Fri, 28. Sep 12, 08:30
x4

Re: [MOD/API] X4RestServer - External http API

Post by Mycu » Sun, 2. May 21, 20:30

beko wrote:
Sun, 2. May 21, 18:37
I'm having way too much fun with this. Did some plumbing today and this is the result :D
Great that you found this project and nice results so far.
I can't wait to see where this gets to. So many possibilities.
X3 AP 3.1 + XRM
X3 AP 3.1 + LU

Post Reply

Return to “X4: Foundations - Scripts and Modding”