Ventelations

Saturday, November 20, 2010

BitTorrent visualization in processing.js

BitTorrent!

You can use the 's' and 'p' keys to add new seeds and peers to the swarm. Hitting 'r' will remove one of the seeds or peers at random, but it takes a few seconds before it activates, just like the original.

This visualization originally started off at aphid.org but that site doesn't seem to be up anymore. Jeff Atwood updated it to work with more recent versions of Processing (notably the 1.0 release which is theoretically API-stable and compatible with future versions). Once I saw processing.js, I knew that I had to get this working in it.

Works in pretty much any modern browser, including IE9 (but not previous versions of IE, because they don't have support for the <canvas> tag).

Changes, if you're curious:

  • processing.js was missing ArrayList.contains() so I implemented it
  • processing.js didn't implement screenX() or screenY() so I had to calculate things manually with cos() and sin()

Are you curious how BitTorrents work? check this out.

Posted via email from Ventelations

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home