← All projectsCOSC 10 / Software

Collaborative sketch editor

A Java client/server drawing application.

Collaborative sketch loopback demonstration
Two local clients updated the original SketchServer through its socket protocol. View full size (new tab): Collaborative sketch loopback demonstration

Shape model

The shared Sketch maps sequential integer IDs to Shape instances. Rectangle, Ellipse, Segment, and Polyline each implement drawing, hit testing, movement, color access, and a text form that can be sent over the network.

Server-side coordination

SketchServer accepts clients, creates one communicator thread per connection, and broadcasts each edit to all connected clients. Its update method parses draw, move, recolor, and delete messages before changing the shared sketch. Synchronized Sketch methods make additions and removals atomic. In the local loopback capture, two socket clients both received five broadcasts: two draws, a move, a recolor, and a delete.

Rendering a shared state

The capture then sends move, recolor, and delete commands across the same two local clients. Both clients received each update, and the original server's shared Sketch was rendered off-screen with the project’s own draw methods. The final state contains the moved, recolored ellipse after the rectangle is deleted.

Loopback collaborative sketch state after the rectangle was deleted and ellipse recolored blue
State after real loopback move, recolor, and delete broadcasts through the original server. View full size (new tab): Loopback collaborative sketch state after the rectangle was deleted and ellipse recolored blue
Mithun RameshkumarDartmouth College