Setting up the Applet


The Mi Ni Pai program offers a variety of options to allow each host to customize the game. In addition, a number of parameters are required to allow the game to run. Each of these options and parameters are controlled through the HTML for the web page containing the applet.

Applet HTML Basics

An applet is embedded in a web page using an <APPLET> tag. Several parameters are required on the APPLET tag itself. In addition, a number of optional "game" parameters can be included before the terminating </APPLET> tag.

The "formal" parameters in the APPLET tag and their recommended settings are as follows:

Parameter Recommended Setting Description
code TileMatch.class This is the name of the main applet class. It must be set to TileMatch.class for a Mi Ni Pai game.
codebase classes This is the name of the directory in which all MiNiPai Java classes reside, relative to the directory containing the applet HTML.
height   This is the height, in pixels, of the area used by the applet on the web page.
width   This is the width, in pixels, of the area used by the applet on the web page.
alt   This text is displayed if the executing browser does not support Java.
archive   This is a comma separated list of zip or jar files. Refer to the section on Java Archives for more information on how to use this parameter.

Please note that there are other, optional applet parameters which are not discussed here. For further information on those parameters refer to a book on Java or HTML.

Game parameters are placed between the <APPLET> and </APPLET> tags. Each parameter has the form

<PARAM name="parmname" value="parmvalue">

where "parmname" is the name of the Mi Ni Pai parameter and "parmvalue" is the value to which the parameter is being set.

The following text is a simple example of an applet tag:

<APPLET code="TileMatch.class" codebase="classes" height=420 width=620>
<PARAM name="MNPSerialNo" value="testing">
<PARAM name="Registry" value="Golumphabeast">
<PARAM name="imageSets" value=42>

Game Parameter Summaries


There are almost 100 parameters available for customizing a Mi Ni Pai edition. To simplify their use, they have been grouped according to function. In addition, the most basic parameters are listed first (to help you get a vanilla version of your edition up and running as quickly as possible).

The parameter groups are:

Registration Quick Start Image Names
File Organization Colors Messages
Event Web Pages Tile Presentation Game Levels
Removal Effects Animation Options Settings
Sounds Edition Constants Backgrounds
Tile Collections Bonus Images Zoom Images


Several parameters are required to allow Mi Ni Pai to run. Without them, the program will not work.

MNPSerialNo Registry Copyright

Quick Start

Once you've included the Registration parameters, you should be able to play the game by including only the following parameters. Of course, you will want to browse through the other options and customize your game further, but these options are all you need to get started:

imageSets tileFolder tileName
backChooser backgroundFolder backgroundName

Image Names and File Organization

The assignment of file name and directory structures is almost entirely under the control of the site host. This has been done to insure that Mi Ni Pai works well on all servers, even those with unusual constraints (such as limits on the length of file names).

The following parameters can all be used to control the location or naming system used for different files. If you do not include these parameters, then you must organize your files according to their default values.

Note that the Java convention for directory structures must be followed. In that convention, a slash ("/") is used to delimit directories, so you may never use a slash within actual file names (although you can put a slash into the file name parameter, which will define a further directory structure),

Also note that all file locations are relative to the HTML document in which the applet is embedded. It is not possible to place Mi Ni Pai files in directories above or outside of the applet HTML's directory.

fileFolder tileFolder backgroundFolder bonusFolder
zoomFolder controlFolder tileName backgroundName
zoomName bonusName captions delimiter


A number of parameters are used to vary colors used in the game for different purposes. All colors are declared using english descriptions, like "very dark red" or "bluish green".

winColor loseColor backgroundColor
frameColor hiliteColor sideColor
optColor captionColor captionBackColor

Every color consists of a base color name, preceded by a list of modifiers. The valid base color names are: red, blue, green, yellow, orange, cyan, gray, darkGray, lightGray, black, white, pink, magenta and any ("any" will randomly pick one of the 13 static base colors).

Colors can be modified by any number, order and combination of the following modifiers: dark (or darker), light (or lighter or bright or brighter), pale (or paler), true (or truer), reddish (or redder), bluish (or bluer), greenish (or greener).

Dark and light will make the color darker or lighter. Pale and true will make the color whiter ("paler") or more true. Reddish, bluish and greenish will tint the color towards that particular base color.

Modifiers can also be preceded by the adverbs "very" (apply the modifier 3 times) or "extremely" (apply the modifier 5 times). For example, "very dark blue" is the same as "dark dark dark blue".

Note that the order in which modifiers is given will affect the final color (very dark greenish blue" is not the same color as "greenish very dark blue").


A number of messages can be customized for the game. The "new game" message is shown in the browser's status bar (only) when a new game begins (or a game is restarted). The "win" and "lose" messages are shown on the screen and in the status bar when a player wins/loses a game. Captions can be displayed in the browser's status bar, and optionally on the screen, when bonus images are displayed (a different caption is displayed for each bonus image).

A number of parameters are used to control the text, color and placement of each message.

winMessage winColor winLeft
winFont winSize winTop
loseMessage loseColor loseLeft
loseFont loseSize loseTop
captions captionColor captionLeft
captionFont captionSize captionTop

Event Web Pages

The applet can automatically display other web pages, controlled by parameters. These web pages can be used to provide additional bonuses (like secret parts of the web site), or gather information through forms (like a "Hall of Fame" for winners).

WARNING: A clever user can read your HTML source, determine the appropriate URL, and go directly there without using the applet.

winURL winTarget loseURL loseTarget

Tile Presentation

Many aspects of the presentation of tiles (i.e. exactly how the complete tiles are drawn on the screen) can be controlled through parameters.

trim pretrim sideHeight
frameColor frameWidth frameInset
frameFade hiliteColor sideColor

NOTE: Tile width and height are controlled entirely by the tile images. They are not set in parameters.

Game Levels

When complex tile sets are used (i.e. tile sets with more than one rank, meaning more than one image per set) the game can be played at different levels. Several parameters provide each edition with control over these levels as well as the expanded tile image organization.

The game can also be offered with different (more or less challenging) layouts and a special "winnable" deal (which guarantees that every game can be won).

minLevel maxLevel initLevel clue
backChooser layouts winnable magikMode

Removal Effects (Animation)

There are a variety of special effects used when removing matched tiles from the board. Managing special effects is just complex enough to get a page of its own; for a more complete dicussion of how to use effects, click here. These parameters control those effects and their variations.

effect steps effectLapse
effectParm1 effectParm2 effectParm3
effectSimul effectsOption allowEffects

Option Settings

Each applet can control the availability of certain options, and whether or not those options are turned on when the game first loads (sometimes it will be desirable to make an option like "continous music" available, but to start with it turned off in deference to users with slower connections).

Note that in all cases there are two parameters available. One parameter controls whether the option is turned on when the game first loads, the other parameter (the "allow" parameter) controls whether the option may be turned on at all. If the "allow" parameter is set to "no", then the player will be unable to change the setting using the Options Screen, and the option will be set to "no" regardless of the other parameter (it is not possible to start with an option on and prevent the player from turning it off).

soundOption allowSound periodicOption allowPeriodic
musicOption allowMusic effectsOption allowEffects
shadowOption allowShadows bonusOption allowBonus
zoomOption allowZoom swapTilesOption allowSwapTiles
swapBackOption allowSwapBack shadowsOption allowShadows


Sounds may be played for a variety of events. In addition, the game allows for continous sounds (i.e. music) and periodic sounds (intermittent, entertaining sounds unrelated to events in the game). These parameters affect the use of sounds:

soundOption allowSound
musicOption allowMusic
periodicOption allowPeriodic
periodicTime periodicCount

Edition Constants

Certain parameters may not be varied within a registered edition. That is, for one registered edition, the same game can be included on different web pages on one server, and many parameters can be varied. This is desirable to create, for example, variations which load faster for players with slower connection speeds by turning off sounds and music.

If any of the "edition constant" parameters are varied, however, or if the applet is based on a separate server, then that constitutes a separate edition and requires a separate registration. These parameters have been chosen to prevent "cheaters" from using one registration number to host a variety of games using different images.

For more information on editions see
Registration and Licensing.

imageSets imagesPerSet initSet
rankBase fileFolder  
tileBase tileFolder tileName
backgroundBase backgroundFolder backgroundName


Backgrounds are the primary reward for the player who wins the game. To help keep the players coming back for more, a variety of options are available to keep the backgrounds interesting. The parameters are:

backChooser backgroundName backgroundFolder
backgroundBase backgroundColor swapBackOption

Tile Collections

A series of parameters are used to define tile collections (such as how files are named, the number of images per set and the number of sets).

tileBase tileName tileFolder
imageSets imagesPerSet rankBase
fileFolder delimiter swap
swapTilesOption allowSwapTiles  

Bonus Images

Bonus images are displayed whenever a player matches either a pair or a complete set. Earned bonus images can also be redisplayed in a slide show (by pressing Ctrl-Z).

These parameters are used to control bonus image names and how they are earned:

bonusName bonusFolder bonusType
bonusOption allowBonus bonus

Zoom Images

Zoom images are used to give players a slightly closer (i.e. larger) view of tile images. These parameters are used to control zoom images:

zoomName zoomFolder zoomType
zoomOption allowZoom zoomFactor

Java Archives

Normally, an applet will individually request and load each resource it needs through the web. This can be inefficient, since many separate requests are needed for the multitude of files required by some applets (such as Mi Ni Pai).

Fortunately, Java allows a special "archive" tag in the applet parameter. This tag lets you specify one or more jar (Java Archive) files which contain some or all of the files needed by the applet. Java will first load these jar files and look inside each for the files it needs, and only if a file is missing will it actually request that file over the web.

Jar files must be created using a special tool available from
Sun Microsystems.

The directory structure within a jar file must match that of files being requested.

More than one archive file can be specified (comma separated).

Java will load all archive files first, then begin executing the applet and using files from the archive. The following is an example using 3 jar files:

<APPLET code="TileMatch.class" codebase="classes" archive="first.jar,second.jar,third.jar" height=420 width=620 >
<PARAM name="MNPSerialNo" value="testing">
<PARAM name="Registry" value="Golumphabeast">
<PARAM name="imageSets" value=42>

For Mi Ni Pai, it is not desirable to put every file needed into the archives, since this would create a huge file from which not all files would be needed every time the game is played. For example, zoom images, bonus images, and multiple background images should not be included in the archive. If more than 36 tiles sets or multiple ranks per set are provided (so that different tile images will be requested each game), then tile images should also not be included in the archive.

The java class files and basic sounds (select, match, etc.) should be included in the archive. If only one background image is available then that image file should be included. If on 36 (or a few more) tile images are used, then those may be included. In addition, other one-time files such as captions, layouts, and help text should be included in the archive.

Back to the Host Kit Main Page