Our last project in studio at uni was a sort of collaborative art piece involving networking. The idea was, we were all to create a client that took input from the user and sent it, via packets describing various shapes, to a draw server. The server would also send the client programs the positions of every other clients cursor within their screen, which we also had to do something with. The networking was relatively simple. There was no serialisation – packets were pretty much memcpy’s of C structs, and we were on a local network so we didn’t care about packet loss. I used D for my client as I’d been working with DerelictSDL a fair amount prior, and it had a nice socket module in the standard library. I also used libpng to export heatmaps for a while but quickly switched to use SDLs BMP functions on the last day because I couldn’t get libpng to build for windows.
My client was pretty much just a rainbow worm simulator. Each new cursor from the server spawned an egg that would hatch a worm that would follow it around the screen. The hue of the worm was the direction from the head of the worm to the cursor it was following. Every few frames, the positions of the heads of all the worms in the client plus their colours were sent to the server. Upon exiting the client, a heatmap showing the position of the user’s cursor throughout it’s use was saved. Each position saved was drawn into the buffer using a simple 5×5 kernel to make it look nicer but each point was still very pronounced. Using a larger kernel would have been better.