Dominion Design Document

For use with Dominion 3proto.0.0

Last updated 4 March 1998

Mark Galassi
Los Alamos National Laboratory
@email{rosalia@nis.lanl.gov}


@dircategory Games @direntry * Dominion-design: (dom3-design). Dominion Version 3 Design Document

@paragraphindent 2

@parskip 4pt plus 1pt

Copyright (C) 1997 The Dominion Project

Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.

Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.

Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the author.

Overview

Dominion is an empire-style game, originally developed by Mark Galassi and a group of his students at Stony Brook in the late 1980s.

Dominion was inspired at first by the very imaginative but poorly coded game of Conquer, written by Ed Barlow and maintained by Adam Bryant.

Dominion quickly became very popular and is still surprising popular, even in the mid to late 1990s, when client-server games with graphical user interfaces are the norm. In fact, it seems that some popular commercial games like civilization have taken much inspiration from Dominion.

Since there still seems to be a need for a game like Dominion, but with a client/server based core and the possibility of writing GUIs for it, I thought it would be good to begin a re-design effort for Dominion.

This document collects my ideas, along with those of the Dominion team, on how Dominion-3 should look.

Getting and installing the Dominion prototype

Dominion should run nicely on any UNIX platform.

You can obtain Dominion from the anonymous ftp site @url{ftp://max.physics.sunysb.edu/pub/dominion-snap.tar.gz}

You can then follow instructions in the INSTALL file, which will basically tell you that to install the game and data files you run:

./configure
make install

Invoking Dominion

To start a game:

make new-world
[answer questions]
dom_server
dom_add

and to play a turn for your nation:

dominion

NOTE: the current snapshots do not yet work like this. Right now you can follow the configure and make install steps, then start the server with dserver, and then do telnet server-hostname 4430, since 4430 is the dominion port.

How you can help

See the node section Getting and installing the Dominion prototype for instructions on how to get a current snapshot, look through the code and documentation, and make suggestions or write code.

Design goals

Here are some of the requirements we have for Dominion-3.

Dominion server data structures

Here is a description of the global variables in the Dominion server. Keep in mind that the data structures are very closely tied to the file formats described below (see section Dominion world files).

Constant: NAME_LEN
This is used for almost all character strings; it is a generous sizing.
#define NAME_LEN 1000		/* max lengths for name-like strings */

Data type: Suser structure
Describes the run-time information associated with the current user. This is supposed to allow the server to pick information out of the databases for that user, but it should never be necessary to store this structure in the world file.

We could store some of this info in a history file, which would be fun and might be a good diagnostic tool.

struct s_user {
  char nation_name[NAME_LEN];
  int is_auth;
  char client_info[NAME_LEN];
  char login_time[NAME_LEN];
  char logout_time[NAME_LEN];
};

typedef struct s_user Suser;

Variable: Variable Suser this_user
Used by the forked-off server to store current run-time information.
extern Suser this_user;

Data type: Snation
Describes a given nation and all that it owns.
struct s_nation {
  char nation_name[NAME_LEN];
  Srace race;
  Sarmy *alist;
  Spt *ptlist;
};

typedef struct s_nation Snation;

Dominion world files

This chapter contains a description of the file formats for the dominion world.

These files typicallly store the standard Dominion structures structures Scargo, Sarmy, Srace, Soptions, Sconstruction, Snation, Sspell, Sh_spell, Sspirit, Sdiplo, Ssector, Sgeo, Sworld.

Each time a data structure contains a pointer, the pointer is written out as NULL. This can be useful because we know if a pointer has been assigned. It can also help to verify file integrity: when the file is read, if a pointer is not NULL, and an error should be reported.

There are two ways we could store data, and it might be interesting to present the option of both, as determined by a magic number in the first two byes.

In the binary format, integer-type data is stored in network order on the server machine. In the ASCII format there is no such issue.

The server always sends these integers to the client in network order or in ASCII (I have not yet decided which).

Cross-referencing issues

Frequently the nation and sector data structures reference each other. For example, each nation has a list of all the sectors it owns, and each sector has a pointer to the nation that owns it.

The issue comes up: "which of these gets saved to file?" The specification for each data structure and file format has to address that issue: only one copy of the information will be saved, and when the information is read in, the other copy must be generated properly.

Terrain file

This contains physical information about the world. This is a description of its format.

The major organization is that it contains a list of all the sectors in the world, arranged by matrix order @math{(0, 0)}, @math{(0, 1)}, and so forth.

Here is a list of what goes in the file.

magic number
A magic number telling us if the file is stored in ASCII or binary. This magic number should consist of two bytes, both of which have reasonable representations as characters:
#define FORMAT_ASCII_0 'f'
#define FORMAT_ASCII_1 'a'
#define FORMAT_BINARY_0 'f'
#define FORMAT_BINARY_1 'b'
world.topology
The world topology type.
world.xsize
world.ysize
The size of the world.
world.sectors[0][0]
world.sectors[0][1]
...
world.sectors[0][world.ysize-1]
world.sectors[1][0]
...
world.sectors[world.xsize-1][world.ysize-1]
The individual sectors.

Terrain file API

Here is a description of the routines available for extracting the terrain information from the terrain file. These routines are usually called by the server to get the bits of information that the client is requesting.

Constant: TERR_FNAME
The name of the file with the terrain information.
#define TERR_FNAME "terrain"

Constant: TERR_FORMAT_ASCII
Constant: TERR_FORMAT_BINARY
Possible return values for terr_get_file_format().

Constant: TERR_TOPOLOGY_TORUS
For now this is the only topology supported; it is the value returned by terr_get_topology().

Function: int terr_get_file_format (char *fname)
Returns 1 if the file is in ASCII format, 0 otherwise.

Function: Ssector terr_get_topology (char *fname)
Returns the topology of this world (for now the only implemented topology is TERR_TOPOLOGY_TORUS.

Function: int terr_get_xsize (char *fname)
Function: int terr_get_ysize (char *fname)
These functions tell you the size of the world.

Function: Ssector terr_get_sector (char *fname, int x, int y)
Gets the sector data structure for sector @math{(x, y)} from the given file.

The next few routines are for manipulating the world structure as a whole.

Function: Sworld * terr_world_allocate ()
Allocates enough space to fit the world.

Function: void terr_load_world (char *fname, Sworld *wp)
Takes a terrain file name and a pointer to a world data structure and loads all the sectors in. The world structure pointer wp should be already allocated.

Nation file

This contains a list of all nations in the world. It is closely modeled after the Snation data structure. As with the terrain file, the data can be stored in ASCII or binary formats, and the same magic number is used.

magic number
A magic number telling us if the file is stored in ASCII or binary, see section Terrain file for a description of the magic numbers.
nations.n_nations
How many nations are in the world file.
nations.list[0]
nations.list[1]
...
nations.list[nations.n_nations-1]
The individual nation data structures.

Nation file API

Here is a description of the routines available for extracting the nation information from the nation file. These routines are usually called by the server to get the bits of information that the client is requesting.

Constant: NATION_FNAME
The name of the file with the terrain information.
#define NATION_FNAME "nations"

Variable: Variable static int nation_last_read
Initialized to zero, so that the nation_get_next() mechanism can work.

Variable: static int nation_fp
Initialized to NULL, then opened the first time a nation is read from that file. Reset to NULL after the last nation is read and the file is closed. Hmm: must figure out a way to associate these with the nation file name.

Constant: NATION_FORMAT_ASCII
Constant: NATION_FORMAT_BINARY
Possible return values for nation_get_file_format().

Function: int terr_get_file_format (char *fname)
Returns 1 if the file is in ASCII format, 0 otherwise.

Function: int nation_get_n_nations (char *fname)
Returns the number of nations in the world.

Function: Snation nation_get_next (char *fname)
Allocates memory for and reads in the next nation structure from the given file.

Armies file

bla

Diplomacy file

bla

Error handling approach

If an error condition is met by the Dominion server, the server should handle it in an intelligent way

Internet Dominion Playing Protocol -- IDPP

The Internet Dominion Playing Protocol (IDPP) is the elementary language accepted by the Dominion server. I based it somewhat on the SMTP interface, since I am acustomed to typing at an SMTP port.

The server reads a line of input from the client and parses it. The first word (separated by the space character) is the command, the rest of the line contains arguments.

The client does not yet do much with the protocol, but the server understands the following commands, so you can practice telneting to the Dominion server port (by default 4430), and typing these commands at it.

IDPP: HELP {<no args>}
Prints a list of the available commands.

IDPP: QUIT {<no args>}
IDPP: CLOSE {<no args>}
These do the same thing: they cause a shutdown of the connection with this particular client, while the server continues to be available for future connections.

IDPP: SHUTDOWN {<no args>}
Shuts down the server; requires game master privilege.

IDPP: SET_LOGIN nation_name
Logs you in as the given nation, but you cannot do anything until you also supply the password.

IDPP: PASSWD pass
IDPP: PASSWORD pass
Sets your password. If the password is correct, and your nation was a valid nation, you are considered authenticated.

IDPP: AUTH? {<no args>}
Sends back the string "AUTH TRUE" if the nation is authenticated, or "AUTH FALSE" if it is not.

IDPP: GET_CURRENT_NATION {<no args>}
Sends back a string with the nation name.

IDPP: GET_SECTOR_INFO x y
Returns as much information about the sector as that nation is allowed to know. <not yet implemented, format not yet specified>

IDPP: SET_CLIENT_INFO client_info_string
Saves a string with information about the given client.

IDPP: GET_CLIENT_INFO {<no args>}
Returns the client information string.

IDPP: GET_LEGAL_MOVES {<no args>}
<not yet implemented, format not yet specified>

Plan of work

It is very important that we plan a series of prototyping manouvers that can be carried out by a core of prototypers who have not committed time to the project yet.

If the prototypes are successful, then I expect that someone on the team will be willing to start real development of Dominion.

Here is a tentative list of prototyping actions that should be performed to gain some momentum on Dominion.

  1. Explore high level socket libraries. Using low level BSD sockets might be foolish. I am not up to date on this field, but I know that the high level languages (Perl, Scheme, Python, TCL) all have rather nice high-level mechanisms for setting up connections. [Done: not much in terms of high-level client/server libraries, but I have written the socket code to do the dominion client/server.]
  2. Redefine the exec file format using Scheme syntax, and try to implement a proof of concept case using Guile.
  3. Define the protocol between client and server, and clarify its relationship with the new exec file format. [idea: have the server calculate all possible allowed moves to one ply, and pass them back to the client when the client asks "what legal moves do I have?"]
  4. Test the aforementioned protocol with a simple server (for example a server for a very trivial game like tic-tac-toe), and a telnet interface for the client.

Useful references

If you are interested in joining the development of Dominion, please contact Mark Galassi (rosalia@nis-mail.lanl.gov). To get up to speed on the issues and technologies involved, you could peruse these network resources.

Dominion authors

I am collecting here the list of authors who are to have access to the CVS repository.

None of these people have written code yet, but they are participating in or making comments on the strawman design.

Bibliography

[IEEE]
IEEE Standard 1178-1990. IEEE Standard for the Scheme Programming Language. IEEE, New York, 1991.
[Simply]
Brian Harvey and Matthew Wright. Simply Scheme: Introducing Computer Science MIT Press, 1994 ISBN 0-262-08226-8
[SICP]
Harold Abelson and Gerald Jay Sussman with Julie Sussman. Structure and Interpretation of Computer Programs. MIT Press, Cambridge, 1985.
[R4RS]
William Clinger and Jonathan Rees, Editors. Revised(4) Report on the Algorithmic Language Scheme. In ACM Lisp Pointers IV (July-September 1991).
[SLIB]
Todd R. Eigenschink, Dave Love, and Aubrey Jaffer. SLIB, The Portable Scheme Library. Edition 2.01, for SLIB version 2a2, January 1995.
[JACAL]
Aubrey Jaffer. JACAL Symbolic Mathematics System. Version 1a5, April 1994.
`scm.texi'
`scm.info'
Documentation of scm extensions (beyond Scheme standards). Documentation on the internal representation and how to extend or include scm in other programs.

Concept Index

i

  • IDPP
  • Internet Dominion Playing Protocol
  • p

  • Protocol -- for dominion on internet
  • Procedure and Macro Index

    This is an alphabetical list of all the procedures and macros in Dominion.

    a

  • AUTH?
  • c

  • CLOSE
  • g

  • GET_CLIENT_INFO
  • GET_CURRENT_NATION
  • GET_LEGAL_MOVES
  • GET_SECTOR_INFO
  • h

  • HELP
  • n

  • nation_get_n_nations
  • nation_get_next
  • p

  • PASSWD
  • PASSWORD
  • q

  • QUIT
  • s

  • SET_CLIENT_INFO
  • SET_LOGIN
  • SHUTDOWN
  • t

  • terr_get_file_format, terr_get_file_format
  • terr_get_sector
  • terr_get_topology
  • terr_get_xsize
  • terr_get_ysize
  • terr_load_world
  • terr_world_allocate
  • Variable Index

    This is an alphabetical list of the major global variables in Dominion.

    n

  • NAME_LEN
  • NATION_FNAME
  • NATION_FORMAT_ASCII
  • NATION_FORMAT_BINARY
  • s

  • static int, static int
  • Suser
  • t

  • TERR_FNAME
  • TERR_FORMAT_ASCII
  • TERR_FORMAT_BINARY
  • TERR_TOPOLOGY_TORUS
  • Type Index

    This is an alphabetical list of the major data structures in Dominion.

    s

  • Snation
  • Suser

  • This document was generated on 5 March 1998 using the texi2html translator version 1.51.