Sign up Calendar Latest Topics
 
 
 


Reply
  Author   Comment  
prophile

Avatar / Picture

Registered:
Posts: 2
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:
Posts: 26
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

Avatar / Picture

Registered:
Posts: 2
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

Avatar / Picture

Registered:
Posts: 220
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 Specialist
Thomas Rasmussen

Registered:
Posts: 11
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:
Posts: 33
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:
Posts: 563
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.

Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.