NOOGA
Network
Object Oriented Game
Architecture
Duke University - CURIOUS '01
author: D. Bernstein, A. English, B. Koh
Table of Contents
Introduction
Design and Basic Operation(brief)
Usage Suggestions
Supported Games
Supported Protocols
/*******************************/
INTRODUCTION
NOOGA, which stands for Network Object Oriented
Game Architecture, provides users with the basic network infrastructure
for creating simple turn-based board games. Written entirely in Java 1.3,
NOOGA is portable across multiple platforms and uses RMI to support network
activity. It is designed such that users with minimal or no network knowledge
can add new games and create clients for the NOOGA server. Recognizing
that RMI is mainly a Java-supported technology, NOOGA also provides connectivity
via TCP/IP socket connections, thereby enabling the server to communicate
with clients written in other languages. It is our hope that NOOGA will
be a useful teaching tool which can provide examples of good and bad OO
design as well as ideas for future assignments.
/*******************************/
DESIGN AND BASIC OPERATION ........... in
a nutshell
Server
The server side of NOOGA is comprised of
essentially two types of components: the NOOGAServer and the NOOGAGameHandler.
The NOOGAServer waits in a loop until a
sufficient number of clients have added themselves before starting a game.
The server maintains separate waiting lists for each game it is equipped
to launch. Once the threshold number of players has been met for a particular
game list, the server spawns a NOOGAGameHandler in a thread to run the
game and resumes waiting. The server is flexible in that it is relatively
easy to add new game handling capability since all game handlers must implement
the NOOGAGameHandler interface.
Client
The main components of the client side
are: the NOOGAClient, NOOGAFE, NOOGAConnector
The NOOGAFE, or NOOGA Front End, is the
client side component which displays the game to the player and allows
player interaction (game-type specific). This is the component a user would
create if asked to program a "client" for NOOGA. Since all RMI interaction
is contained within the NOOGAClient, NOOGAServer, and NOOGAGameHandler,
no knowledge of RMI is needed to construct a NOOGAFE. This is the design
feature which allows users to write clients for NOOGA without network knowledge.
The NOOGAClient forms the gateway between
server and client. It represents the server side's handle on the client
side; all requests/instructions performed on the client side by the server
or game handler are invoked on the NOOGAClient which forwards the invocation
to the NOOGAFE (NOOGA Front End). Conversely, the NOOGAClient is also the
client side's handle on the server side, as all method invocations from
client to server must be performed on the NOOGAClient, which forwards the
invocation to the server side. All RMI communication is contained within
the NOOGAClient, NOOGAServer, and NOOGAGameHandler.
Clients initiate a connection to a NOOGAServer
via the NOOGAConnector. NOOGAConnector basically sets up the connection
between the NOOGAClient and NOOGAServer.
MiddleWare : the SSNOOGAFE/XMLNOOGAFE and
NOOGASocketListener
As mentioned in the introduction, NOOGA
provides a TCP/IP socket access layer which allows non-Java clients to
interface with the NOOGAServer. This is done by "tricking" the server side
into communicating with a fake NOOGAClient - the SSNOOGAFE and XMLNOOGAFE
- which, using either a simple string or xml protocol, forwards requests
and instructions to the remote client over a TCP/IP socket behind the scenes.
Using the appropriate protocol, socket clients communicate with the XML
or SS NOOGAFE which forwards requests and instructions to the server/game
handler via RMI. The SSNOOGAFE communicates with clients using a simple-string
protocol, while the XMLNOOGAFE accomplishes the same task with an xml protocol.
The NOOGASocketListener is the socket equivalent
of the NOOGAConnector. Clients wishing to connect via socket cannot open
a direct connection to the NOOGAServer. They must initiate a connection
with the NOOGASocketListener on a predefined port, which sets up the middleware
RMI/socket connection between server and client.
/*******************************/
USAGE SUGGESTIONS
It is our hope that NOOGA can be useful as
a teaching tool both in and out of the classroom. Since it was almost entirely
written by students, NOOGA is plagued by many common design mistakes. For
example, bad variable names, redundant code, and hard coding, among other
flaws, can be found in certain parts of code. However, there also exist
features which are examples of good design. NOOGA's extensive class hierarchy
allows new game handler and socket protocol modules to be added with relative
ease. Additionally, the isolation of RMI within the NOOGAServer, NOOGAGameHandler,
and NOOGAClient classes is a good design feature because client code never
has to implement RMI in order to interface with the server. These can be
pointed out in lecture followed by good/bad design reasoning. Outside of
the classroom, NOOGA can be given to students as part of an assignment.
In the same way that Nachos is used to teach OS design and concepts by
having students modify its code and add new features, NOOGA can be used
to teach OOP by allowing students to add new modules which provide additional
functionality. Adding support for new game types, for instance, would give
students practice in familiarizing themselves with the NOOGA API and in
realizing how it's structure makes it flexible in some ways and inflexible
in others. Their OO reasoning can also be put to the test if asked how
they would re-design NOOGA from scratch, learning from mistakes that have
already been committed in the original version.
/*******************************/
SUPPORTED GAMES
Currently, NOOGA supports:
Joggle - like the classic word game "Boggle"
Joggle Racer - similar to Joggle, but more competitive in that players
"race" to submit words before other players. each word can only be submitted
once, after which other players will not receive points for submitting
the same word.
Dots - connect the dots on a grid to form squares. the player with the
most squares wins
BattleShip - like the classic board game
All games have both gui and text interfaces and are included in the nooga-archive.jar
file.
/*******************************/
SUPPORTED PROTOCOLS
NOOGA supports RMI, XML, and Simple String connectivity.