Members | Sign In
All Forums > Hardware and LBE construction

OSC outputs for mad special effects

posted Nov 17, 2012 18:54:41 by TomWyatt
Hi All!
I've been working on a tool to get data from Artemis out to an OSC server to allow a broader range of special effects to be added to home built bridges
The tool is here

I've posted in the Development forum about this but figure its more useful to discuss it here :)

The program runs on your machine, you connect to it instead of the server and it reads out the data it needs. Its best to connect an engineering station to it as you get more damage data that way. It'll work without but you wont see any damage info.

Feel free to use and alter this program as you need, so far it sends basic ship stats (energy, shield levels, shield state, speed, ship rotation etc.) as well as subsystem damage levels to a server.

I've written it for our build that were planning as we want a number of effects that we cant get with DMX. For example we have some small pyros to pop when the ship is hit as well as dropping ceiling panels and extra displays to dot around the cabin (to show things like "reactor levels" - linked to the ships energy level). We also have some smoke machines to fire off when things are really bad :)
I'll be writing the build up on my blog and i'll link it here when its started

page   1
15 replies
wwjdtd said Nov 17, 2012 21:41:07
This is what we needed from the start, I need to see if I can get it to send data over Ethernet to a raspberry pi to control lights.
JoshuaHarris said Nov 18, 2012 00:41:01
Yes..This will be a VERY nice thing!
TomWyatt said Nov 19, 2012 10:05:24
wwjdtd: it will definitely do that, OSC is designed to be networked :) There are also libraries for most languages for receiving and sending OSC data, it'll definitely work on an rpi
TreChipman said Nov 20, 2012 20:17:01
Thanks! Now I just need to figure out a way to have it talk to an Arduino!
I'm not a mad scientist. I'm an angry one. You'd be wise to fear the latter.

Visit Artemis Command!
TomWyatt said Nov 23, 2012 12:11:05
its fairly easy, there are a tonne of tutorials out there for getting processing to talk to arduinos
RoyAnderson said Dec 14, 2012 20:17:45
Hi Tom. This sounds like a fantastic expansion of a fantastic game. Is there any way you can type up (or YouTube) a tutorial as to how to get this to work with a very basic set up (for instance, just activating red lights for red alert or when the shields take damage or some such)?

AlexVanPatten said Dec 16, 2012 10:04:01
This is very exciting as I have an Arduino and would like to use it to get some effects going.

Question though, can I do this all on the same machine? Run the server, have the listen server be the same IP as the server?
[Last edited Dec 16, 2012 10:04:57]
npnickster said Dec 22, 2012 00:03:13
Sorry if I bumped this, but I got this working after changing line 208 in to fix the crash on unmapped subsystem damage bug, running on my Raspberry Pi. I'm running (a pyOSC demo) modified to print the data for the front shields, but I can't make sense of the returned data. It usually returns a list containing [-1]. Once I got it to print some relevant data, a float ranging from 80.0 (max shields) to 0.0 (no shields), but now its back to just [-1]
Edit: Energy and warp/impulse rates work okay, but shields still return -1
[Last edited Dec 22, 2012 01:16:10]
AlexVanPatten said Dec 22, 2012 06:16:02
Could you post the fix you did so others can make it too?
npnickster said Dec 22, 2012 06:56:59
Sorry I forgot
In, change line 208 to remove self.systemCount[subName] from inside the [] brackets

In the original code, whenever you took damage to an unmapped subsystem (hallway), It would try to look up the count for how many of that system there were, without giving the code to do so the name of the system to look up, causing the crash.
[Last edited Dec 22, 2012 07:03:55]
TreChipman said Dec 22, 2012 18:27:49
So line 208 should now read:

self.sendOSCMessage("/subdamage", ["unmapped",])

I'm not a mad scientist. I'm an angry one. You'd be wise to fear the latter.

Visit Artemis Command!
npnickster said Dec 22, 2012 20:49:38
I tried posting what it SHOULD read, but the forum butchers it. If you have coord and damage in the [] after "unmapped" then yes, I just cant see it due to a forum bug. I pasted the correct line 208 to
LawsonThompson said Jan 01, 2013 19:32:35
I have an old (as in "too old to run Artemis") laptop kicking around, and access to a projector. Since I'm far more versed in software than hardware, I've been experimenting with a software lighting solution. I've managed to wrangle up shield up/down and "flash when hit" events via the following bits:

- Windows XP laptop, which otherwise won't run Artemis due to age. Onboard Intel GPU for the fail!
- Installed Python 2.7
- Installed the 2 OSC libraries
- Installed Processing from
- Installed the scripts and edited them a bit per the above to prevent subdamage from stumbling. THANK YOU, npnickster!
- Wrote a simple Processing script to take messages for shield up/down and ship hit to flash the screen white.

The result: I have an Artemis "proxy" laptop which will accept a connection from a real client and display a full-screen color wash: it's black when shields are down, blue when shields are up, and flashes white for 200ms when a "shiphit" occurs. I haven't actually tried this under a real game scenario, but it passes basic testing so far.

Eagerly awaiting a "red alert" status indicator in the Python code... I think I found it at mess[28] == 0x02, but I'm not sure how to determine what the red alert status is "right now". Maybe that's sent in the initial connection?

Finally, this all leads me to wonder if this couldn't all just run in Processing instead of Python. I suspect Python's probably better suited for the networky stuff.
[Last edited Jan 01, 2013 19:48:54]
Thedr said May 13, 2013 04:30:05
Hi Lawson Thompson,

Could you share your processing script that you made? I'm not much of a programmer more of a hardware kind of guy but if I had an example I'm sure I could figure out the rest.

LawsonThompson said May 17, 2013 01:58:39
Well, here goes... just pasting it in!

Haven't touched it in months, so I hope you can get some use from it.

*Flash the screen white for 100ms when shiphit message arrives

import oscP5.*;
import netP5.*;

OscP5 oscP5;
int last_hit_time;
int msg_count;
int are_shields_up;
color shields_up_color;
color shields_down_color;

void setup() {
/* start oscP5, listening for incoming messages at port 12000 */
oscP5 = new OscP5(this,12000);
shields_up_color = color(0,0,180);
shields_down_color = color(0,0,0);

/* osc plug service
* osc messages with a specific address pattern can be automatically
* forwarded to a specific method of an object. in this example
* a message with address pattern /test will be forwarded to a method
* test(). below the method test takes 2 arguments - 2 ints. therefore each
* message with address pattern /test and typetag ii will be forwarded to
* the method test(int theA, int theB)

public void shiphit(int someValue)
last_hit_time = millis() + 120;

public void shipstate_unknown(int anInt)
// println("shipstate_unknown int: "+anInt);

public void shipstate_gen(int anInt)
// println("shipstate_gen int: "+anInt);

public void shipstate_shield(int anInt)
are_shields_up = anInt;
// println("shipstate_shield int: "+anInt);

public void shipalert(int anInt)
println("shipalert toggled int: "+anInt);
if (anInt == 1)
shields_down_color = color(240,0,0);
shields_down_color = color(0,0,0);

void draw() {
if (last_hit_time < millis())
if (are_shields_up == 1)
// text("Shields Up",0,32,480,240);
// text("Shields Down",0,32,320,240);
// Write the frame count
String s = "Frame count: "+frameCount;

/* incoming osc message are forwarded to the oscEvent method. */
void oscEvent(OscMessage theOscMessage) {
if(theOscMessage.isPlugged()==false) {
/* print the address pattern and the typetag of the received OscMessage */
// println(msg_count++ +" msg addrpattern\t"+theOscMessage.addrPattern() + "\ttypetag\t"+theOscMessage.typetag());
Login below to reply: