Multi User Dungeon Demo

Written by David Er-el   1999

Abstract A full functioning demo of a multi user game in which each player sees the same board as all the other players. The players can move inside a maze picking up objects and evading monsters. The application demonstrates group communication patters over a layer called JavaGroups which was written by Bela Ban.





 

[1] Installation

Requirement :

  1. Having sun's jdk1.1.7 installed.
  2. Having downloaded javagroups.jar 0.6.6. and swing.jar 1.0.3 and placed in the mud/jar folder.

Note : The program was tested on WinNT4.0 , Linux 2.x , Solaris 5.6.

How to install ?

  1. Download the tar gziped file mud.tar.gz.
  2. gunzip mud.tar.gz ; tar -xvf mud.tar ( winzip should know how to handle this ).
  3. Move the javagroups.jar and the swing.jar to the mud/jar folder
  4. cd mud/src
  5. Add the JavaGroups and the Swing to your classpath and compile. For example ( in Unix ) :
  6. 1. setenv CLASSPATH .:/usr/lib/jdk-1.1.7/lib/classes.zip:/home/mud/jar/swing.jar:/home/mud/jar/JavaGroups.jar
    2. gmake
    
  7. To run the program : java Mud




[2] Running the demo

[a] Features

In the demo there is a hard coded limit of maximum 4 players. Each player is identified by it's color.  He is given that color on random when starting the application. Also on the board are the following elements :

[b] Keys and actions

[c] Configuration parameters

All the configuration parameters are in the class MudUtil.

    public  static final boolean  DEBUG        = false;
    private static final String   d_mazeFile   = "board.txt";
    public  static final String   GROUP_NAME   = "MUD";  
    public  static final int      CHANNEL_PORT = 9000;
    public  static final int      RMI_TIMEOUT  = 3000;
    public  static final String   PROPS        = "UDP:PING:FD:GMS";
    public  static final int      INITIAL_PLAYER_POWER = 12;    
    public  static final int      INITIAL_MONSTER_POWER = 3;    
  

Notes:

  1. DEBUG : when false no debug print outs will be printed to stderr.
  2. d_mazeFile: The maze file is represented by a text file with the first line containing how many lines / rows and the rest is 0/1 separated by new line for each row.
  3. PROPS : the layer stack for JavaGroups




[3] Structure of the application

[a] JavaGroups

My program uses the JavaGroups layer for the communication. JavaGroups was developed by Bela Ban. The javagroups is a pure Java group communication system which enables the developer to create groups , join them , leave them and get view changes on those groups. It doesn't require to run in addition any special daemon. The javagroups layer can operate above Ibus , over ensemble or on an internal layer. I have used the internal layer which works the best.

[b] RMI concept

I have decided to use JavaGroup's RMI's. It is done in the following way :

It is also possible to send a method invocation only to a specific member. I usually used this method to send messages to the master.

[c] View change

View change is the most complicated task in this program. It is handled in the following way :

[d] Virtual synchrony problem

Since there is no layer of virtual synchrony yet I had to implement it myself. All messages in wrong views are discarded. Especially it is important during view change. This is why in the rmiGetUserStat that the viewId is sent. Consecutive view changes in a short time might cause this function to receive old views and it should identify it by the viewId. The viewId is produced by JavaGroups.



Written by David Er-el.
Email : derel@cs.huji.ac.il
Updated to Tue Jun 15 14:50:33 1999