prophile
Registered:1418239676 Posts: 2
Posted 1419283747
Reply with quote
#1
In case it is of interest to anyone, I have been working for the past week or so on libdiana , a Python library for communicating with Artemis servers. The major features are complete, and it's usable in practical projects now, although features will still be trickling in. This is mostly a low-level packet encoding/decoding library, with some simple ship tracking features. I wrote it for use with hooking up various bits of hardware I have lying around to Artemis (a CH Products flight yoke, and a Big Red Safety Button for red alert). It can be installed from PyPI with pip install libdiana . I hope it's of some use to somebody!
stugo
Registered:1398974852 Posts: 26
Posted 1420502867
Reply with quote
#2
Sweet work man! I've only scanned your library briefly and I'm not very good at this sort of code. Is there a way to extract the ships energy level? I have one of these http://www.adafruit.com/products/252 and it might be kind of cool to output the ships energy level to it. Probably hooked up to a RasPi.
prophile
Registered:1418239676 Posts: 2
Posted 1420507537
Reply with quote
#3
Hi stugo! Something along the lines of this (untested!) should do what you want: import diana import diana.tracking tx, rx = diana.connect('127.0.0.1') # or whatever IP tx(diana.packets.SetShipPacket(0)) # Select Ship 0 (Artemis) tx(diana.packets.SetConsolePacket(diana.packets.Console.data, True)) # claim the Data console tx(diana.packets.ReadyPacket()) # Set "ready to play", like pressing the button on the console select screen tracker = diana.tracking.Tracker() for packet in rx: # stream packets from the server tracker.rx(packet) # Update the tracker with new information print(tracker.player_ship.get('energy')) # Print out the energy level, or None if we don't have it: change from "print" to however you want to do your output Hope the library is of some use to you! Sorry about the lack of documentation, something for me to improve in a later release.
Randal
Registered:1388966776 Posts: 220
Posted 1421599509
Reply with quote
#4
This looks like a nice little library. I'll have to try it out today. Thanks for all the work done on it!
__________________ Captain of the TSN Gallifrey Xenolinguist - TSN Alien Language Specialist678
Thomas Rasmussen
Registered:1378202438 Posts: 11
Posted 1441202040
Reply with quote
#5
Looks good. Do you have any way of sending energy and coolant levels directly to the game? i'm at the moment getting them form a midi fader and pasting them as mouse movement. but it is a bit slow.
lucas99801
Registered:1376766756 Posts: 33
Posted 1526353804
Reply with quote
#6
dead thread bump.
What are the chances of this lib working with 2.7?
I'd like to use this library to grab tube status for creating a custom weapons console. Plan to use a Raspberry Pi as client, and interface with an arduino for system controls. I just need to be able to poll data from the server to ensure matching states between controller lights or functions and the actual game state.
Dave Thaler
Registered:1424550389 Posts: 563
Posted 1526399342
Reply with quote
#7
Quote:
Originally Posted by
lucas99801 What are the chances of this lib working with 2.7?
I'd like to use this library to grab tube status for creating a custom weapons console. Plan to use a Raspberry Pi as client, and interface with an arduino for system controls. I just need to be able to poll data from the server to ensure matching states between controller lights or functions and the actual game state.
If you want to do this now, you can use the socket tracing feature of Artemis Bridge Tools with a python script. See the HowTo for details.