$Header: /home/jcb/newmj/RCS/README,v 11.4 2003/03/15 12:42:44 jcb Rel $

This is the README file for the Unix mah-jong programs by J. C. Bradfield.


NOTICES:
--------
Please see the file LICENCE for terms and conditions of these
programs.

Source distribution only:
-------------------------
The code in the  tiles-v1/  directory was not written by me; see 
tiles-v1/README  for information and licensing.
The file MANIFEST contains a description of all the files you 
should find in this distribution.

Binary distributions only:
--------------------------
In the distribution directory, you will find the following files:
mj-server   the controller program. ( mj-server.exe in Windows )
mj-player   a computer player.      ( mj-player.exe in Windows )
xmj         a graphical client.     ( xmj.exe in Windows )
README      this file
LICENCE     the licence
rules.txt   the rules as implemented by the programs
use.txt     documentation on how to use the programs
CHANGES     summary of changes between releases
xmj.1       man page (not in Windows)
mj-player.1 man page (not in Windows)
mj-server.1 man page (not in Windows)
tiles-numbered   an alternative tileset with some arabic numbers
tiles-small a set of smaller (3/4 size) tiles

If this is a statically linked distribution, there will also be 
xmj-static  the X client with the GTK+ libraries linked


DESCRIPTION:
------------
These programs allow the user of a Unix (or Windows) computer to play
Mah-Jong, in the Chinese Classical style, against other users (locally
or over the Internet), against programmed players, or both.


OBTAINING:
----------
Latest releases should be available from at least one of:
 http://www.stevens-bradfield.com/MahJong/
 http://www.dcs.ed.ac.uk/home/jcb/MahJong/


CONTACTING:
-----------
If you need to contact me about these programs, please mail me at
mahjong@stevens-bradfield.com (preferred address), or at
jcb+mj@dcs.ed.ac.uk .


INSTALLATION - BUILDING FROM SOURCE:
------------------------------------

Systems:
--------
These programs should, in theory, compile on any reasonably modern
32-bit Unix with an ANSI C compiler and the X Window System.
They are known to compile (and run) under GNU/Linux, recent Solaris (on Sparc),
and recent Irix (on Silicon Graphics workstations).
If you try to compile on any "reasonably modern" system, and have a
problem, do please tell me.
In addition, they should compile and run under Win32 systems with
GNU compilers and utilities; they are known to work under NT 4.0 with
the mingw compiler (you must use the version with the MSVCRT dll).
Adam Kao <mahjong@ideogram.com>  got a pre-release version to compile
with Microsoft Visual C and nmake, but as I don't have these I don't
support them. If you wish to try to do this, the file  makefile.msvc.old
is the makefile Adam used; however, it has not been updated to match the
current release.

Prerequisites:
--------------
On Unix you need version 1.2 (later versions may work, depending on what
changes) of the GTK+ toolkit.  This is included with modern Linux
distributions. To check your installation, do
 gtk-config --version
If you do not have GTK+, obtain it from www.gtk.org or mirrors.
Alternatively, if you are running Linux-x86, a binary distribution
with the GTK+ libraries linked-in is available from the sites above.
On Windows, you need version 1.3 of the gtk+ Windows port, version
of 2000-12-26 (or later, presumably). Earlier versions will not work.

To compile the program, you need Perl, version 5 (version 4 is almost
certainly OK, but I haven't checked). Perl should be installed on any
decent system. You do not need any Perl modules.

You need the GNU make utility. If you do not have this, you will need
to remove the GNU-specific features from the Makefile, as directed therein.
(Windows: see also note above about makefile.msvc.old)

Installing:
-----------
Unpack the distribution, and cd into the distribution directory.

Edit the Makefile, and change as directed by the comments.

Then
 make

You should not see any warnings or errors. If you do get any warning
or error, please complain to me (unless you've switched on lots of
superfluous message via the C debug flags, in which case you know what 
you're doing, so don't complain to me!).

Then (Unix only) su to an appropriate user if you need this for
installation, and 
 make install
will install the binaries in the place you chose. Alternatively,
just copy the three binaries
 mj-server
 mj-player
 xmj
into your chosen directory.

make install.man  (Unix only)
will install the man pages into the appropriate directory.

You may also wish to put the pre-formatted text files  use.txt
and rules.txt (which are basically the two halves of the man page)
somewhere.


INSTALLATION - UNIX BINARY DISTRIBUTIONS:
-----------------------------------------

Unpack the distribution, and cd into the distribution directory.

Just copy the three binaries
 mj-server
 mj-player
 xmj
into your chosen directory. If you don't have GTK+, then see above.

The user documentation is  use.txt  and  rules.txt ; put these in
an appropriate place. 

Alternatively, or as well, copy the man pages  xmj.1, mj-server.1,
mj-player.1  to the appropriate man directory (e.g. /usr/local/man/man1).

Make sure that the binary directory is in your PATH; in particular,
if you run from the source directory, you need to have it in your 
PATH either explicitly or as . .

Problems:
---------
The most likely problem is: you appear to have GTK+ installed, but
when you try to run  xmj  you get a message about missing libgtk .
This means your GTK+ libraries are not in the same place mine are, and are
not in the default search path. If this happens, the following may work:
rename  xmj  to  xmj.exe , and make  xmj  the following two line script:
#!/bin/sh
LD_LIBRARY_PATH="`gtk-config --prefix`/lib:$LD_LIBRARY_PATH" xmj.exe "$@"

If that doesn't work, then you're probably on a system weird enough that
you know what to do anyway, because you've had to do it before.
Alternatively, use the static version of  xmj .


INSTALLATION - WINDOWS BINARY DISTRIBUTION:
-------------------------------------------

Unpack the distribution. 
Put the three *.exe files into an appropriate directory.
Creating menu items and shortcuts is up to you...

You must have the DLLs for the GTK+ libraries, as specified above.
For your convenience, these can be found in the file  gtkdlls.zip
in the xmj download directory. Put the DLLs in the same directory as
the xmj binaries.

Put the documentation  use.txt  and  rules.txt  somewhere sensible.


RUNNING:
--------
Please see the file  use.txt  in the distribution for usage
information. The file  rules.txt  describes the rules applied by
the programs. (Or see the man page.)


PAYMENT & REGISTRATION:
-----------------------
What payment? What registration? These programs are free. However, if
you would like to encourage me to continue development, or thank me
for what I have already done, you can
(a) make a donation to your local branch of Amnesty International
    (please send me a note if you do); or,
(b) send me a donation, either via PayPal, or by credit card by
    the link on the xmj home page.
If you want to be informed when new versions are released, etc.,
then send me a note (to the addresses above), and I'll add you
to a mailing list.


WINDOWS:
--------
The Windows port exists thanks to the efforts of Adam Kao
<mahjong@ideogram.com>, who ported the pre-release version, and thus
showed me what to do.
Only Win32 is catered for.
I do not have a proper development environment for
Windows, so Windows-specific bugs will not have a high priority.


SUGGESTIONS:
------------
Please send me your suggestions/requests for improvements. I've gone
to a lot of trouble to make it fairly painless to add variations in
rules, scoring, etc.; so I need some requests to make the trouble
worthwhile!


BUGS:
-----
Please report any bugs, or anything that might be a bug.
There are probably lots, although I have obviously eliminated all I've 
seen so far.

Known problems:
---------------
GTK+ has some subtle and elusive bugs. In particular, you may
occasionally see labels (such as the "Pung!" announcements, or the
name of the discarded tile) appearing blank instead of with text. I've
tried and failed to track this one down, and am not willing to spend
any more time on it. So don't bother to report this one!
On Windows, if the server is running on the same machine as the
graphical client, and is forcibly killed, the graphical client
generates an application exception.
This is probably some subtle bug deep inside the Windows port of gtk+,
so I'm not going to investigate it.
There are other gtk+ bugs on Windows; mangled text windows have been
reported.

