IMGD 4000 (D 09)
Individual Homework Assignment #4
Due by Web Turn-In: Midnight, Sunday, April 12
(See general homework instructions for turn-in details.)
The goal of this fourth and last assignment is to learn about MMO technology by setting up an online server for playing chess using the Darkstar framework. In this assignment you will adapt the programs you wrote for the Chess World and Shallow Blue assignments to make them into Darkstar clients, so that players can either play against each other remotely or against a remote AI. To avoid cheating, the server will be the ultimate authority on legal moves and who won the game.
The Eclipse chess project you downloaded for the first assignment already contains all of runtime libraries needed to develop and run your assignment. However, in order to learn about Darkstar from the tutorials and example source code, you need to download the full DarkStar 0.9.8 distributions:
- Download and unzip the Server source & binary, and the Client SDK, source & binary in a convenient location.
- Do not unzip these to the turnin directory!
- (Windows) Do not unzip these to any subdirectory of "Documents and Settings" (e.g., desktop) or any other directory path containing " and " (to avoid DOS batch file glitch).
- Open ServerAppTutorial.pdf in the tutorial folder of the server download and skim through the first 11 pages to get a basic idea of the code architecture.
- Carefully study and execute all of Lesson 1 (Hello World!) of the server tutorial according to the instructions, i.e., using the Darkstar distribution, not the Eclipse chess project.
- Similarly, study and execute all of Lesson 5 (Hello User!) of the server tutorial.
- Open ClientTutorial.pdf in the tutorial folder of the client download and carefully study and execute all of Lesson 1 (HelloUserClient) according to the instructions, i.e., using the Darkstar distribution, not the Eclipse chess project.
The Eclipse chess project contains sample code in the default package for a stripped-down Darkstar chess server (ChessServer.java) and a trivial jME-based chess client (ChessClient.java). Study this code and then test it as follows in a command shell:
- Make 'turnin' subdirectory of the chess project your current working directory (cd).
- Note that chess.jar already contains the appropriate code resulting from being built
with chess.jardesc as described in the turnin instructions.
- Set the SGS_HOME environment variable to the root directory of the server distribution (i.e., where myDir is replaced appropriately below):
- Start the chess server by invoking the run_server.bat (or .sh) batch file.
- In a new command shell, cd to the 'turnin' directory and start one copy of the chess client by invoking
run_chess.bat ChessClient test1
(or .sh). In the middle of other console logging output, you should see:
Client: logged in test1
and similarly on the command shell running the server:
Server: logged in test1
- Now in a third new command shell, with 'turnin' as the working directory, start another copy of the chess client with a different login name, e.g.,
run_chess.bat ChessClient test2
In the middle of other console logging output, you should see:
Client: logged in test2
Client: received black
Client: received Pg2g4
Client: sent Pe7e5
and on the the test1 console log you should see:
Client: received white
Client: sent Pg2g4
Client: received Pe7e5
and on the server console log you should see:
Server: logged in test2
Server: sent white to test1
Server: sent black to test2
Server: received Pg2g4 from test1
Server: sent Pg2g4 to test2
Server: received Pe7e5 from test2
Server: sent Pe7e5 to test1
- Kill all three command shells.
- You shall modify your code from the Chess World assignment to be a Darkstar player client, similar to the example in ChessClient.java.
- The main class for this client should be named PlayerClient (in default package).
- You shall modify your code from the Shallow Blue assignment to be a Darkstar AI client, similar to the example in ChessClient.java.
- The main class for this client should be named AIClient (in default package).
- This class shall not refer to any of the jME packages, i.e., it should not have a graphical interface.
- You shall implement a Darkstar server, named ChessServer (in default package), similar to the example in ChessServer.java, which:
- Handles two client connections (i.e., for simplicity, no realistic user management required)
- Assumes the first client to login is white.
- Uses the code provided in edu.wpi.imgd4000 to check legal moves and declare a match winner.
- Hint: You do not need to create any new managed objects or Darkstar tasks for this assignment.
- Hint: Turn on chess match logging only for the server (not the clients).
- You shall test your implementation, using three command shells according to the instructions above, in the following two configurations (which will be confirmed by the TA):
- Two player clients.
- Player client versus AI client.
- Hint: Use different client login names for the run_chess command, such as "player1", "player2", and "AI", instead of "test1" and "test2".
- Hint: During development, the clients can be started from within Eclipse in the usual way. But the server must always be run from the command line using chess.jar (which means recreating the jar as needed using chess.jardesc). However, make sure you do your final test starting everything from the command line!
Please post any questions to the myWPI discussion board for the course.