RenCloud / scs-sdk-plugin

ETS2 (Euro Truck Simulator 2) & ATS (American Truck Simulator) SDK plug-in. Telemetry data is shared via SharedMemory/Memory Mapped Files.
MIT License
191 stars 38 forks source link

Usage of named pipes? #79

Open ndelta0 opened 3 years ago

ndelta0 commented 3 years ago

Is your feature request related to a problem? Please describe. Memory Mapped Files are only a thing in Windows, thus limiting the plugin to Windows only (#75).

Describe the solution you'd like Usage of Named Pipes, they are present in both Windows and Unix/Unix-like, although they have a bit different implementation.

Describe alternatives you've considered Other alternative is a TCP (or UDP maybe?) socket, similarly to how ETCARS and ETS2 Telemetry Server. In case of the latter it would probably require either JSON format or Base64 encoding.

Additional context None

RenCloud commented 3 years ago

Linux support is indeed planed. It will need some time, because currently I have no time for that.

I saw some alternatives with TCP, but it will probably a similar solution to memory mapped files like pipes.

ndelta0 commented 3 years ago

It's possible to use something like ZeroMQ, it has lots of libraries for lots of languages, and supports TCP, UDP, IPC, etc.

RenCloud commented 3 years ago

I would like to use a way without external libraries, but I will take a look.

ndelta0 commented 3 years ago

Understandable, I just spent an entire day trying to get cppzmq working with the plugin, but it's really useful, you can use publisher/subscriber pattern with topics (maybe events in this case) and subscribers can subscribe to any of the events.

ndelta0 commented 3 years ago

I've made a crudely working telemetry using the demo and converted it to use ZeroMQ. It was basically plug and play, drop in replacement. You can see the changes here, it was done quickly so there is high possibility for something not working. It makes use of CMake and vcpkg (it makes using open source libraries very very easy).