Here’s a variation on the networked pong server from Making Things Talk.. This version is cooperative rather than competitive. Multiple clients have to keep the ball from hitting the ground. There are five balls dropped each game.
There are two files to this sketch, the main code, and a separate class for each player. The main code looks like this:
[include file="../../code/Processing/ballDrop_server/ballDrop_server.pde" clean="true"]
Here’s the Player class. I separated this out to a second tab in my Processing sketch.
[include file="../../code/Processing/ballDrop_server/Player.pde" clean="true"]