The place to discuss scripting and game modifications for X4: Foundations.
Moderators: Moderators for English X Forum, Scripting / Modding Moderators
-
SirNukes
- Posts: 546
- Joined: Sat, 31. Mar 07, 23:44
Post
by SirNukes » Mon, 25. Nov 19, 09:24
Download:
https://github.com/bvbohnen/x4-projects/releases
Documentation:
https://github.com/bvbohnen/x4-projects ... es_API.md
X4 Named Pipes API
Adds support for Windows named pipes for inter-process communication.
Named pipes are OS level psuedo-files which support inter-process communication.
Pipes avoid the overhead of disk access from normal files (eg. debug logs), and are bidirectional.
X4 will act as a client, with one or more an external applications serving the pipes.
There are three components to this API:
- A low level lua plugin and corresponding dll for pipe access.
- An MD wrapper that interfaces between the lua and MD pipe users.
- A default, optional Python external pipe host server.
Requirements
Installation
- Place the named_pipes_api folder in extensions.
- Place the X4_Python_Pipe_Server (exe or py) anywhere convenient.
- Run this pipe server alongside X4.
Components
- MD Pipe API
This api is found in Named_Pipes.xml, and allows MD code to read or write pipes.
- MD Server API
This api is found in Pipe_Server_Host, and allows MD code to register a python module with the host server.
The host (if running) will dynamically import the custom module.
Such modules may be distributed with extensions.
- Lua Pipe API
The lower level support for X4 to use named pipes is located in Named_Pipes.lua.
Basic pipe usage can ignore this level in favor of the MD api.
Advanced usage may want to use this api directly.
- Winpipe dll API
The pipes themselves are accessed through a dll which wraps key Windows functions.
This dll is limited to only what is needed: opening a pipe client, reading/writing/closing it, and error checking.
If desired, the dll may be compiled freshly from source on github.
Last edited by
SirNukes on Tue, 6. Jul 21, 01:21, edited 2 times in total.
-
spin1/2
- Posts: 288
- Joined: Fri, 25. Nov 05, 11:58
Post
by spin1/2 » Wed, 27. Nov 19, 01:20
Hey,
I tried out the Simple Menu API (includes Lua Loader API), because my target is to create mission sequences like a visual novel.
For a simple test I took your "simple_menu_api_test", which means I had to inlcude the Hotkey API and the Namend Pipes API.
All four APIs are Version 1.0 and in the extensions folder. The server is running and shows the one line with the path.
When X4 is running it shows the Hotkey API and the Namend Pipes API in red (in the extensions menue).
thx for your work and help
-
SirNukes
- Posts: 546
- Joined: Sat, 31. Mar 07, 23:44
Post
by SirNukes » Wed, 27. Nov 19, 03:57
Thanks for trying it out. After checking a few things, my best guess is that the winpipe dll had an unnecessary dependency on visual studio. Version 1.0.1 is up with a fix.
Regarding the menu api, the extra test extension only uses the hotkey/pipes stuff for opening a standalone test menu (using shift+b). Without the pipes, that same test menu can also be opened using the options menu. (Also, the hotkey stuff uses 3.0 md commands, so won't work on 2.6, but the menu api should be fine.)
-
SirNukes
- Posts: 546
- Joined: Sat, 31. Mar 07, 23:44
Post
by SirNukes » Mon, 24. Feb 20, 10:08
Updated to 1.1. This changes the access timeout behavior a little bit. By default timeout is now disabled (used to be 10 seconds). When a timeout is requested by the user of this api, a new option is available to also flush out all pending accesses to the pipe that timed out. The change is motivated by the Key Capture API losing inputs due to their matching read requests having been timed out.
-
Misunderstood Wookie
- Posts: 377
- Joined: Mon, 15. Mar 04, 08:07
Post
by Misunderstood Wookie » Mon, 24. Feb 20, 10:27
You're going to have give some solid reasons why this is better then every other Lua API. I mean you require us to run server side software just to use it so what exactly does this do that is beneficial?
Is this just a method for live debug output?
Unless you're using a HDD I can't see how disk overhead is much concern tho.
-
SirNukes
- Posts: 546
- Joined: Sat, 31. Mar 07, 23:44
Post
by SirNukes » Mon, 24. Feb 20, 18:56
Misunderstood Wookie wrote: ↑Mon, 24. Feb 20, 10:27
You're going to have give some solid reasons why this is better then every other Lua API. I mean you require us to run server side software just to use it so what exactly does this do that is beneficial?
This API enables run-time communication with X4 from external processes. That is, you can send data *to* X4 dynamically. There is nothing comparable to it across any of the X games. (The closest I know of is that one modder that was trying to add multiplayer to X3 by messing around at the exe level.)
I leave to your imagination what can be done with such a capability. Personally, I actively use it for creating new hotkeys.
-
Misunderstood Wookie
- Posts: 377
- Joined: Mon, 15. Mar 04, 08:07
Post
by Misunderstood Wookie » Tue, 25. Feb 20, 03:35
I see so it's used to make things like we have for elite dangerous and push data to some their party tool or display live, or something else like maybe a live galaxy map which runs on a second screen all the time and shows everything you know ingame without slowing the game down having the map open hahaha
-
Inchínn
- Posts: 18
- Joined: Tue, 7. Mar 17, 21:37
Post
by Inchínn » Tue, 15. Feb 22, 19:28
Any mods that utilise this so far?
Would love a html map screen etc,
-
Inchínn
- Posts: 18
- Joined: Tue, 7. Mar 17, 21:37
Post
by Inchínn » Fri, 18. Feb 22, 15:39
i found it straight after my comment - its really slick, so cool to see the job offers on another screen without having to click into the menus.
I really hope they expand on its features.
-
beko
- Posts: 53
- Joined: Thu, 11. Jun 20, 21:14
Post
by beko » Sun, 26. Mar 23, 19:54
It's not yet ready for public usage and has some issues that need to be ironed out but… I present you: Named Pipes on Linux PC
https://beko.famkos.net/wp-content/uplo ... pc_too.jpg
Hooked into this great mod by using Lua-Socket with only a few extra lines of code. Used the "X4 External App" to get some noise on the socket and here we go
Last edited by
Terre on Mon, 27. Mar 23, 08:38, edited 1 time in total.
Reason: Images posted directly to the forums should not be greater than 640x480 or 100kb, oversize image now linked
-
Strohmann
- Posts: 2
- Joined: Tue, 28. Mar 23, 07:19
Post
by Strohmann » Tue, 28. Mar 23, 07:34
beko wrote: ↑Sun, 26. Mar 23, 19:54
It's not yet ready for public usage and has some issues that need to be ironed out but… I present you: Named Pipes on Linux PC
https://beko.famkos.net/wp-content/uplo ... pc_too.jpg
Hooked into this great mod by using Lua-Socket with only a few extra lines of code. Used the "X4 External App" to get some noise on the socket and here we go
Great news! Where can I follow your progress?
P.S.: Great blog! Enthusiastic people are always admired. And I perfectly understand the state when setting up or learning something is one of the most exciting elements of the game.
-
beko
- Posts: 53
- Joined: Thu, 11. Jun 20, 21:14
Post
by beko » Tue, 28. Mar 23, 10:18
Strohmann wrote: ↑Tue, 28. Mar 23, 07:34
Great news! Where can I follow your progress?
P.S.: Great blog! Enthusiastic people are always admired. And I perfectly understand the state when setting up or learning something is one of the most exciting elements of the game.
Thanks mate. My blog is my primary source and you can follow it thanks to bridges from various social media. They are linked in the upper left (not on mobile). I also have a tiny Discord channel where we're mostly bouncing ideas about SimPits around. Let me know if that is your jam
Currently looking for some testers to not run into "Works On My Machine"
-
Strohmann
- Posts: 2
- Joined: Tue, 28. Mar 23, 07:19
Post
by Strohmann » Tue, 28. Mar 23, 14:26
beko wrote: ↑Tue, 28. Mar 23, 10:18
Currently looking for some testers to not run into "Works On My Machine"
I'm ready to take part in testing.
But now there is not too much free time - all the time is occupied by a little baby and work.
I use X4 External App when playing on windows. I am also a Python backend developer, it would be interesting to understand how the Pipe-server works.
Is there a fork of the bvbohnen/mycumycu projects or instructions for the necessary changes?
-
beko
- Posts: 53
- Joined: Thu, 11. Jun 20, 21:14
Post
by beko » Wed, 29. Mar 23, 19:45
I did fork it but I didn't push to it yet. Really hacking away every free second and writing a well versed tutorial is kinda obsolete the moment I start typing
Wouldn't mind to walk you through and brainstorm some ideas.