haha, sorry, had to try...
since you need both the server and the client program i thought nobody would be crazy enough to download them both and test it out, i mean i don't expect anyone to spend real time on this. i wish i could just throw them both up on openprocessing.org and have it work that easily, but it wont.
ill copy the server and client's main file contents here and if anyone is adventurous enough to copy the code into my sketch at http://openprocessing.org/visuals/?visualID=843 it will work but maybe someone will be able to see the problem just by looking at it?
here is the server:
Code://import processing.video.*;
//MovieMaker mm;
import processing.net.*;
Server s;
Client c;
String input;
int data[];
PImage redDudeImage, blueDudeImage;
int numDudes = 50;
dude[] dudes = new dude[numDudes];
int x1, y1, x2, y2;
boolean selected = false;
boolean selectTeamOne = true;
boolean attack = false;
boolean blur = true;
boolean recording = false;
int counter = 0;
void setup()
{
x1 = 0;
y1 = 0;
x2 = 0;
y2 = 0;
selected = false;
frameRate(60);
size(500,500);
noFill();
redDudeImage = loadImage("dude.png");
blueDudeImage = loadImage("bluedude.png");
for(int i = 0; i < numDudes; i++)
{
dudes[i] = new dude();
}
s = new Server(this, 12345); // Start a simple server on a port
//mm = new MovieMaker(this, width,height, "drawing.mov", 25, MovieMaker.ANIMATION, MovieMaker.HIGH);
}
void draw()
{
counter++;
if(blur)
{
noStroke();
fill(255,150);
rect(0,0,width, height);
}
else
{
background(color(255,255,255));
}
String locations = new String("");
int numlocations = 0;
for(int i = 0; i < numDudes; i++)
{
if(dudes[i].active)
{
dudes[i].update();
dudes[i].render();
}
else
{
dudes[i] = new dude();
}
numlocations+=2;
locations = locations + (int)dudes[i].position.x + " " + (int)dudes[i].position.y + " ";
}
locations = locations + "\n";
String stringlist[] = split(locations, ' ');
saveStrings("out.txt",stringlist);
s.write(locations);
//println(stringlist.length);
strokeWeight(2);
if(selectTeamOne)
{
stroke(255,0,0);
}
else
{
stroke(0,0,255);
}
if(mousePressed)
{
if(mouseButton==LEFT)
{
rect(x1,y1,mouseX-x1,mouseY-y1);
}
}
else
{
if(selected)
{
//rect(x1,y1,x2-x1,y2-y1);
}
}
if(recording)
{
//mm.addFrame();
}
s.write(pmouseX + " " + pmouseY + " " + mouseX + " " + mouseY + "\n");
}
void mousePressed()
{
selected = false;
if(mouseButton == LEFT)
{
x1 = mouseX;
y1 = mouseY;
}
}
void mouseReleased()
{
if(mouseButton == LEFT)
{
if(abs(mouseX-x1)>20 || abs(mouseY-y1)>20)
{
x2 = mouseX;
y2 = mouseY;
if(x2<x1)
{
int temp = x1;
x1 = x2;
x2 = temp;
}
if(y2<y1)
{
int temp = y1;
y1 = y2;
y2 = temp;
}
selected = true;
}
else
{
selected = false;
deselectDudes();
}
if(selected)
{
for(int i = 0; i < numDudes; i++)
{
if(dudes[i].position.x > x1 && dudes[i].position.x < x2 && dudes[i].position.y > y1 && dudes[i].position.y < y2)
{
if(selectTeamOne && dudes[i].team == 0)
{
dudes[i].selected = true;
}
else if(!selectTeamOne && dudes[i].team == 1)
{
dudes[i].selected = true;
}
}
else
{
dudes[i].selected = false;
}
}
}
}
if(mouseButton == RIGHT)
{
for(int i = 0; i < numDudes; i++)
{
PVector target = new PVector();
target.x = mouseX;
target.y = mouseY;
dudes[i].attack = true;
dudes[i].move(target);
if(attack)
{
dudes[i].attack = true;
}
else
{
dudes[i].attack = false;
}
}
attack = false;
}
}
void deselectDudes()
{
for(int i = 0; i < numDudes; i++)
{
dudes[i].selected = false;
}
}
void keyPressed()
{
if(key=='a'||key=='A')
{
attack = true;
}
if(key=='1')
{
if(!selectTeamOne)
{
selectTeamOne = true;
deselectDudes();
}
}
if(key=='2')
{
if(selectTeamOne)
{
selectTeamOne = false;
deselectDudes();
}
}
if (key == ' ')
{
if(!recording)
{
recording=true;
}
else
{
// Finish the movie if space bar is pressed
//mm.finish();
// Quit running the sketch once the file is written
exit();
}
}
}
oops, past the max length.. i'll post the client in another message...