Documentation

1. Introduction

This document presents Micro Dart Scorer, a project to create a J2ME compliant dart scorer. The development is divided in 3 main parts. At first, there is a core library (mdartscorer-lib) which provides a structure for controlling dart games. On top of the library 2 GUIs were created. A very simple Swing GUI was created to test the library (mdartscorer-swing). The J2ME GUI (mdartscorer-j2me) is a Midp 2.0 compatible GUI that can be installed on any device running Java.

The rest of the document is organized as follows: Section 2, “Installation” presents all installation instructions. Although only mdartscorer-j2me installation is really needed, we present instructions to install all the required software and the plugins for extension as well. In Section 3, “Using Micro Dart Scorer J2ME” is an user manual for mdartscorer-j2me GUI. At last, in Section 4, “The Micro Dart Scorer Library” we present the library, explaining the concepts and design decisions and providing hints for using and extending the library.

2. Installation

This section presents instructions for installing mdartscorer-j2me. If you already have a Java Virtual Machine (JVM) installed on your device, you can skip to Section 2.2, “Micro Dart Scorer J2ME Installation”. Section 2.1, “IBM Weme Installation” shows how to install IBM's Weme with its JVM on a PDA with Windows Mobile 2003. Unfortunately, installation instructions for other JVMs is outside the scope of this document. The Section 2.3, “Eclipse ME Installation” is useful if you want to use or extend the library.

2.1. IBM Weme Installation

Although Micro Dart Scorer is compatible to any JVM implementation with Midp2.0, it was only tested with IBM Weme (Websphere Everyplace Micro Environment). It is a complete environment for developing J2ME applications. You can download it for testing and (I think) for non-commercial development. None of the development IDEs or applications included in Weme were used while developing mdartscorer (everything was developed in EclipseME). The only part used was the JVM, which seems to be a Test JVM, since only one midlet can run at a time. To install IBM Weme in your PDA with Windows Mobile 2003, follow these steps:

  1. Go to Weme website http://www-306.ibm.com/software/wireless/weme/;

  2. Click in "Trials and betas";

  3. Click in "Try Workplace Client Technology, Micro Edition 5.7" (2 times!);

  4. Choose a Language and click "Continue";

  5. You are then asked to Sign in or Register;

  6. Select your reasons to download and click "I Agree" (if you agree!!);

  7. Download one file from "WebSphere Everyplace Micro Environment 5.7.2 - MIDP 2.0 for Windows Mobile 2003 2nd Edition". The actual file depends on your host. I downloaded first the Linux version but I couldn't install using it (I tried with SynCE but didn't work). Then I downloaded the Windows version to a friend's computer and it worked. I recommend you to install from Windows :-(;

  8. Now just execute the file and follow the instructions. Remember to have your PDA connected and with ActiveSync turned on.

After completing these steps you have a JVM installed in your PDA and you can install Micro Dart Scorer J2ME.

2.2. Micro Dart Scorer J2ME Installation

After having installed a JVM in your PDA, you can install Micro Dart Scorer J2ME. These instructions will again assume you have installed IBM Weme according to the instructions in Section 2.1, “IBM Weme Installation”. I do not have experience using other JVMs so, if you find out something different in another JVM, please contact me that I write it here.

To install Micro Dart Scorer J2ME you have to accomplish only 2 steps. First, you need to copy the files to your PDA. Then, you have either to install the midlet on your JVM or to create a link to run it without installing.

2.2.1. Copying files to the PDA

The following steps must be followed to copy the needed files to your PDA:

  1. download mdartscorer-j2me's last binary version from Micro Dart Scorer Downloads website;

  2. decompress mdartscorer-j2me-x.x-tar.gz and store the contents in any directory you want;

  3. create a folder in your PDA where you want to install mdartscorer-j2me;

  4. to copy the files:

    • if you have Windows and ActiveSync, just open the explorer and drag&drop the files from the computer to the PDA;

    • if you have Linux, you may want to install SynCE . If you have KDE or Gnome integration, you can just open the File Manager and drag&drop the files to the PDA;

    • if you have Linux and SynCE , you can also copy the files from the command line, using the pcp command. There is a small shell script here, that you can edit for your needs.

After these steps you must have a folder in your PDA with 2 files: mdartscorer-j2me.jar and mdartscorer-j2me.jad.

2.2.2. Installing and/or running the application

There are two ways of running mdartscorer-j2me. You can just double click on mdartscorer-j2me.jad and it will call IBM's JVM installer. You just have to let it install the application (accept that I am a trusted person) and then run it.

Alternatively, you can create a symbolic link to start the JVM with the midlet. You have to create a text file, edit it (probably on your computer) and copy to the same directory as the other files. A sample link file can be found here. You just have to edit it to reflect both your JVM installation and the path to the folder. Then, you can just double click this link and the application runs.

2.3. Eclipse ME Installation

All software included in Micro Dart Scorer was developed using Eclipse Platform. If you want to use or extend the library, we recommend Eclipse together with EclipseME plugin. This section presents briefly how to install and start working with the plugin. For a more detailed explanation, refer to EclipseME plugin website (which is the main source for this section).

2.3.1. Requirements

In order to install Eclipse ME you must have:

  • Sun Java2 at least 1.4.x;

  • Eclipse IDE at least 3.x;

  • A Wireless Toolkit.

You can check EclipseME homepage for a list of supported toolkits. The next section shows how to install Sun's WTK.

2.3.2. Wireless Toolkit Installation

Sun's Wireless Toolkit can be download direct on Sun's J2ME Wireless Toolkit Download page. Click in "Download" and select the specific file for your platform. The installation is straightforward, just execute the binary file and follow the instructions.

2.3.3. Plugin Installation

There are many ways to install the EclipseME plugin. The following steps must be performed to install it using Eclipse's automated install procedures (in Eclipse 3.1.x):

  1. In Eclipse, go to menu "Help -> Software Updates -> Find and Install..."

  2. Select "Search for new features to install" and click in "Next"

  3. Click in "New Remote Site..."

  4. Fill the form with any name you want and the URL http://www.eclipseme.org/updates/

  5. Select the newly created website on the list and click "Finish"

  6. After some moments, Eclipse displays the list with available versions. Choose the last version and click "Next"

  7. Accept the license and click "Next"

  8. Click "Finish"

Eclipse will then download the needed files and install them. You will then be asked to restart the workbench. After restarting, you need to configure EclipseME to use your Wireless Toolkit:

  1. In Eclipse, go to menu "Window -> Preferences..."

  2. Select "J2ME -> Platform Components"

  3. Click with the right mouse button on "Wireless Toolkits." and select "Add Wireless Toolkit."

  4. Browse to the directory where you installed the toolkit. It will detect the toolkit automatically. Click in "Finish"

After this procedures you are ready to import source and start developing J2ME applications.

2.3.4. Importing Source Code

If you want to import Micro Dart Score's source code, you have 2 options. First, you can download the source code distributions from the sourceforge website and create Eclipse projects for each module. The second possibility is to checkout the CVS modules. They already contain configured eclipse projects which can be easily imported.

In order to get the sources from the CVS server, you can use any CVS Gui or command line tool. The following steps perform the checkout using the CVS command line tool:

# cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/mdartscorer login
Logging in to :pserver:anonymous@cvs.sourceforge.net:2401/cvsroot/mdartscorer
CVS password:

# cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/mdartscorer co mdartscorer-lib
# cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/mdartscorer co mdartscorer-j2me

You don't need to give a password, just press Enter. This will create 2 directories, mdartscorer-lib and mdartscorer-j2me. You can import this 2 modules in Eclipse:

  1. In Eclipse, go to menu "File -> Import..."

  2. Select "Existing Projects into Workspace" and click "Next"

  3. In the Root Directory, browse to one of the modules' directory and select it

  4. Select the project and click in "Finish"

You can repeat this operation with the 2 modules. It will create 2 new projects in your workspace, with the sources for both the J2ME Gui and Library.

3. Using Micro Dart Scorer J2ME

This section details the usage of Micro Dart Scorer J2ME and it is assumed that you already went through the process of installation as described in Section 2, “Installation”.

The midlet is composed of 3 Forms, which I will call Views. The views can be seen in the Screenshots page as well as during this section. The views can be navigated using the small buttons in the bottom. Although there will always be some way to navigate between views, it may differ from one JVM implementation to another.

The next subsections will detail the functionalities included in each view.

3.1. Setting up options

The first thing you see when you start Micro Dart Scorer J2ME midlet is the Options View, as shown in Figure 1, “The Options View”. This View lets you configure the game, in the following aspects:

  • Number of Legs each Set has;

  • Number of Sets a Leg has;

  • Type of Game to be played. Currently only 301 and 501 are implemented;

  • The number of players, and their names;

Figure 1. The Options View

The Options View

It is important to understand the concept of this form. You first select all choices you want. At any moment you can press "Revert Changes" and all the changes are discarded. When you are satisfied with your choices, you can press "Apply Changes". This button will start the game (restart it, if you are playing one) with the new options. If press "Revert Changes" after that, nothing will happen (unless you change something after applying).

Some more hints in this View:

  • If you know Dart games you should know that one Match is composed of some Sets, which are composed of some Legs. They are normally odd numbers and the winner of the majority wins. For example, if a Set has 3 Legs, the player who wins 2 Legs gets the Set. In a 301 game, the winner of the Leg is the player who first gets from 301 to exactly 0 points (check Dart rules for details. Some - most - of them can be found on http://www.rules-of-darts.com/ or http://www.mostdartgames.com/dartmain.html);

  • To add a new player you must write the name in the text box and then press "Add". There are some rules for names: they must have between 3 and 20 characters and they must not be repeated;

  • To remove a player from the game, select the player's radio box and press "Remove Player";

3.2. Playing the game

After configuring the game you click on "Apply Changes" and a new game starts. While playing the game you are going to use the 2 other views, the Board View and the Scores View.

The Board View, displayed in Figure 2, “The Board View” is used to mark the throws you made while playing. In the top left corner you can see the player which is currently playing. In the middle is its score, in the format Points/Legs/Sets. In the right corner is displayed the last marked throw, in this case, the Bull's Eye ( a Double 25 ). To mark a new throw, just click on the correct place with your pointer. If you want to mark the zero throw (when you miss the board), you can click in the area around the board). Currently only pointer devices are supported, but there are plans to create another type of interface for the case of devices where pointers are not available.

Figure 2. The Board View

The Board View

In the bottom of the view there are more commands. The "Tip" command displays a Tip for the next throw, what is useful only when you have the possibility to win the leg in this turn. If you make a mistake and click in the wrong place, you can use "Undo" to correct it. The "Reset" button will start the game again, with the same configurations.

In order to have detailed information on the scores, you can go to the Scores View. As you can see in Figure 3, “The Scores View”, this view is very simple, just presenting the current scores in a table.

Figure 3. The Scores View

The Scores View

In the moment a new throw is marked the following things can happen:

  • Burst - if the throw is bigger than the number of points the player has, than the throw is said to Burst. In this case a message is displayed and the points return to the old value, as if the player hadn't played;

  • Leg Won - if the throw completes the leg, the player wins the Leg. It depends on the type of game been played. For example, for 301, the user must complete exactly the number of points it has, using a double in the turn. If the user wins the Leg, a message is displayed and a new Leg is started (unless the user also wins the set or the match with this leg);

  • Regular Throw - if the user didn't burst nor won the leg, the points are just subtracted from its total. If it has another throw, the current player displayed in the Board View is still this player, otherwise will be the next;

  • Set Won - in the case of a leg won, it can happen that the player also won the set. In this case, the "Leg Won" message is changed by a "Set Won" message and a new set is started (unless the player wins the match);

  • Match Won - in the case of a set won, it can happen that the player also won the match. In this case, the "Set Won" message is suppressed by a "Match Won" message. After that, the game stops and will just start with a "Reset" or "Apply Changes" (from the Options View). The scores can still be seen while the game is not reset.

4. The Micro Dart Scorer Library

TODO

4.1. Library Concepts

TODO

4.2. Using the library

TODO

4.3. Extending the library

TODO