Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

Is there a more effective way to send coordinates than through split() or splittokens()?

$
0
0

So I'm trying to send coordinates between four players through a server using the networking library, and currently it seems like the easiest way to do that is to send a string such as:

positions= 0 + "," + ballX + "," + ballY + "," + p1 + "," + p2 + "\n"; myserver.write(positions);

And then receive it through:

void clientEvent(Client client) { receivemessage=client.readUntil("\n"); datain = splittokens(receivemessage,",\n"); }

However, this seems to lag behind a bit as the buffer fills up and it slowly drifts further and further from real time. Should I stop sending strings and parsing them with splittokens() in favour of some other method, or should I just make sure that the client clears the buffer every once in a while?


Viewing all articles
Browse latest Browse all 2896

Trending Articles