Replaced README procmail rule with one I've actually tested :p
[pyrisk.git] / README
1 PyRisk
2 ======
3
4 This is a Python engine and interface for building games similar to
5 Albert Lamorisse's 1957 La ConquĂȘte du Monde.  The game is perhaps
6 better known as Risk, and is produced by Parker Brothers (now a
7 division of Hasbro).
8
9 Benefits over other open source implementations:
10
11   * simple, extensible implementation
12   * play-by-email
13
14
15 Getting PyRisk
16 ==============
17
18 PyRisk is available as a Git repository::
19
20     $ git clone http://www.physics.drexel.edu/~wking/code/git/pyrisk.git
21
22 The most recent commit is also available as a gzipped tarball at::
23
24     http://www.physics.drexel.edu/~wking/code/tar/pyrisk.tgz
25
26 Once you get the source, installation is via Docutils::
27
28     pyrisk$ python setup.py build
29     pyrisk$ python setup.py install
30
31
32 Getting started
33 ===============
34
35 To setup play-by-email, you'll have to have some method to redirect
36 appropriate messages into a named pipe.  With procmail, that will
37 look something like::
38
39     :0
40     * ^Subject:.*\[PyRisk.*
41     {
42       :0 wc
43       /path/to/named/pipe
44     
45       :0
46       | /bin/echo -e '\000' >> /path/to/named/pipe
47     }
48
49 The echo command appends a NULL byte to the FIFO, which (I think), helps
50 the read() in _get_msg break at the appropriate point.
51
52 Once you have the procmail rule setup, just add your EmailPlayers to
53 your game and go::
54
55     from pyrisk.base import generate_earth, Player, Engine
56     from pyrisk.player.email import IncomingEmailDispatcher, \
57         OutgoingEmailDispatcher, EmailPlayer
58     world = generate_earth()
59     ied = IncomingEmailDispatcher(fifo_path='/tmp/pyrisk.in')
60     oed = OutgoingEmailDispatcher(return_address='server@example.com')
61     players = [EmailPlayer('Alice', 'alice@big.edu', ied, oed),
62                EmailPlayer('Bob', 'bob@fish.net', ied, oed),
63                Player('Charlie')]
64     e = Engine(world, players)
65     e.run()
66     ied.close()