Multimedia Systems Project 1
CSE 5348, Fall 2002
Dr. Ramesh Yerraballi
Due Date: 10/6 Midnight
Project Statement
To enhance the performance of the Wumpus world game used under the NSF
WISE project, by modifying the current visual percept exchange of uncompressed
images to, an exchange of compressed images based on the Adaptive Huffman
compression mechanism.
Description
Background:
The WISE project at CSE@UTA is a NSF funded Educational Infrastructure
project. The official website for the project is http://cygnus.uta.edu/wise/index.html.
The project involves the Wumpus world game which is a grid game that is
used in AI classes to study various AI search and path planning techniques.
In a nutshell, the game involves a grid with obstacles, pits, gold and
the wumpus (the enemy), the objective of the player is to avoid the obstacles,
the pits and getting zapped by the wumpus and, collect as much gold before
exiting the grid. The game has been implemented as a client server program
with the client side implementing the player and the server side maintaining
the state of the grid and sending percepts (hints) to the client. The server
is actually more complex, however for the purpose of this project, this
description will suffice.
There are several percepts that the server currently sends to a client,
one of which is a visual percept. The visual percept is a ppm
image file. The ppm (Portable PixMap) image file format is the simplest
form of storing a color image with raw pixel values. The details of the
file format can be found by following the link. In the current implementation
of WISE the following images are used as a visual percepts:
Pit:
Obstacle:
Wumpus:
Gold:
Each of these images is 32x32 pixels in dimensions with a maximum pixel
value of 255. The implementors of WISE foresee several more visual percepts
being transmitted in future, some may be real images. These images are
currently sent by the server to the client as ppm files, further the actual
image that is sent is 64x64 pixels wide with three of the four 32x32 blocks
blank (zeroed) and the fourth containing the actual image. Wumpus appears
in the top left block, Gold in the top right block, Pit in the bottom left
and Obstacle in the bottom right.
Your Project:
Is to change this to apply compression to this file and send the compressed
stream to the client. The compression algorithm you are expected to use
is the Adaptive Huffman (Lecture 7). You can find some good information
to implement the Adaptive Huffman algorithm on the Squeeze page (http://www.cs.sfu.ca/cs/CC/365/li/squeeze/).
The page contains src code as well, which you are allowed to use. Note,
however that the code has to be understood and modified for it to work
for you. The main problem with using this code as is, is with the communication
of bits (0s and 1s) which in the applet are not an issue because the applet
only simulates bit transfer and does not actually do the physical communication.
In your code you will have to address this shortcoming. In order to aid
you in this process here is another bit of help. Laurence Vanhelsuwé
published and article on "Extending
Java Streams to support Bit Streams", in Dr. Dobbs Journal, this is
precisely what you need to get the bit transfer support working. In fact,
the article describes the use of Bit Streams in the context of another
interesting (but not relevant to this project) compression mechanism called
LZW.
Now for the nitty-gritty. The code for the Wumpus world is typical of
most student written code in that it is very minimally documented, therefore
I have made every attempt to minimize the need for you to actually go through
the code in great detail. Accordingly I will summarize the code for you.
The code is organized as three separate pieces. The Server code (called
wumpus code) , the Client code and the Avatar code (which you will ignore
for the current project). The Server code by far the most complex, however
the crux of the logic relevant to you is essentially contained in the two
files - WWServer.java, ImageTransmitter.java. Similarly,
the crux of the client code is contained in three files namely, G_Client.java
and Frame2.java and ImageReceiver.java. You are expected
to ONLY modify ImageReceiver and ImageTransmitter classes.
You are welcome to change other files for your debugging needs, but I only
expect you to submit your ImageReceiver.java and ImageTransmitter.java
in your project submission.
-
Server:(ImageTransmitter.java)
You are being provided with a ImageTransmitter class that
transmits the image in plain uncompressed form. First we send the height
and width of the image followed by the pixels themselves. Note that, since
all these values are limited to a value of 255, we are sending them as
bytes and not integers (though they have been defined so). You have to
make suitable modifications to incorporate compression into this transmission.
-
Client:(ImageReceiver.java)
Again you are being provided with a ImageReceiver class that
receives the image in plain uncompressed form as sent by the server. You
have to make suitable modifications to incorporate the uncompress functionality
on this stream before storing the result in pixdata.
Code Howto:
The code is available to you as two zip files wise_server2.0.zip
and wise_agent2.0.zip. Download and unzip them
into some working directory for your project. The two zip files must automatically
extract to two separate directories (wumpus and client
respectively).
Open your favorite command interface (DOS command prompt, Cygwin etc.)
in two windows. To compile the server code use javac *.java in
one; To compile the client code javac G_Client.java in the other.
The client will have to be run first as java G_Client followed
by the server as java WWServer.
Configure and run the Server by following these steps:
-
Choose "File" option from the menu and pick "Load wumpus
world", this will prompt you for a input file. Here is a minimal sample
file (layout.def). This should show the world
populated with gold, wumpi, pits and obstacles.
-
This is optional - Choose the "Simulator" option from the menu and
pick "Set Configuration" and enter a larger number (say 4) in the
"Time to accept connections (in min):" field. The default value of 1 min
may be too short for you to start the client.
-
Now run the server by clicking on the "Start" button that is next to the
"Statistics" button. The Server takes a while to startup but you will notice
when its ready, from the message in the command window that reads
"To recalculate the wumpus position".
Configure and run the Client by following these steps:
-
Choose "Plan" from the menu and pick "Display Layout". This will bring
up a layout window. Select a starting position by clicking on one of the
cells (white). This will prompt you for a direction within the cell to
orient the client, choose one and click Close. Now, you can close the layout
window to reduce the clutter of windows.
-
You are ready to run the client, now click on the "Connect" button (Make
sure the Server has finished its startup). You will see a dialog message
that reads "Request Accepted Successfully". click OK.
-
You are now connected. Choose "Percept" from the menu and pick "Display
Percepts", this will bring up your console for playing the game. The relevant
options on this console are under "Action To Be Taken". Pick a move and
click action to execute it. You can view on the Server's layout window
the result of your move. Also, you will see a little window pop up that
gives you the visual percept. You may want to enlarge this for better visibility.
-
The small popup window will be updated with every move you make. When there
is no other entity in your vicinity you will see a black square. When something
like a pit, obstacle, wumpus or gold are in front of you, you should see
it in the popup window.
That's the game. You should be able to run the code as given to you. However,
note that the image is not being compressed. Its your job to compress it.
Submission
Instructions will be posted on the class website