The bluegammon.io
package defines common behaviour for setting up a remote game, and
contains one implementation of this using bluetooth.
There are three central classes in this package:
BackgammonConnection
- a high level interface that defines methods for connecting
to another backgammon player's server or setting up a backgammon server on the local deviceHandshake
- a class that defines the protocol for handshaking, either from server
side or from client sidePlayerListenerProxy
- an implementation of the PlayerListener
interface
that listens to the LocalPlayer
on this device and serializes all events. It sends the
events further via the streams setup by the BackgammonConnection
to a RemotePlayer
that resides on the remote device. Hence, the RemotePlayer
will receive same events as the
LocalPlayerProxy
A class diagram over a fully setup distributed game is depicted below:
Here, the RemotePlayer
receives events via its InputStream
. The
PlayerListenerProxy
sends all events from PlayerListener
via its
OutputStream
.