Introduction
============

On Genesis we used to have a problem keeping the world reasonably
tidy. All players started the game in the village church. Wizards
wanted to have their castles near the church in order to get more
players to visit their castle. In the end all was a big mess.

We have solved that problem in two ways. First we made several
starting locations, meaning that there is no longer a single
central place where all mortals have to go. Secondly we decided
that domains are not supposed to connect directly to each other.
To provide the space between the domains we introduced a map
of the world.

The map is a file with one character for each location in the
world. If a map location is occupied by a domain, the player
will be in the rooms created by the domain. Otherwise there
are 81 (9x9) standard rooms cloned from standard terrain files.

If you try to create a map for your mud, you will find that
the format of the map file is painful, not very logical and
not very flexible. The reason for this is that Genesis had 
a map and it was easier to customize the code accessing it
than changing the map. We apologize for any incovenience this
may cause.


Map locations
=============

Each map location consists of one byte. The six least significant
bits holds information about the terrain type. The seventh bit
indicates if there should be a random encounter in that location.
The eighth bit shows if a domain is using that location.

How to interface the rest of the game to the map will be discussed
in 'maplinks'.


Getting information from the map
================================

Wizards can look at the map with the following commands:

rmap x y radius           Shows a map radius steps from x,y.

map x y x_width [y_width] Shows a rectangular map with upper left
                          corner in x,y and width x_width and
                          height y_width. y_witdth is optional.

fetch x y                 Displays the map character in x,y.

It is also possible to make map objects in the game by inheriting
/std/map.c.

Both the wizard commands and /std/map.c use routines located in
/std/map/map.c. Those routines can be used for making other methods
of accessing the map.


Format of the map file
======================

           MINY                       MINY = -5
          |                           MAXY = 5
          |                           MINX = -4
          |                           MAXX = 5
          |
MINX      |         x
----------+--------->
          |         MAXX
          |
          |
          |
          |
        y |MAXY


Each character in the map file represents one location on the map.
There are no delimiters in the file, no spaces and no newlines.

The file is seperated into blocks. There may be 2 or more blocks.
In the map in the distribution (/d/Standard/map) there are 3 blocks.
The first block contains the part of the map with values of x
greater than zero. The second block holds the negative values of
x including the column for x=0.

All blocks with x > 0 should be before the first block with x < 0.

Map locations are stored column wise within each block.
Each column in the file is MAXY + abs(MINY) + 1 charcters long.
In the example we get that each column is 11 characters long.
Within each column values of y are in decreasing order.
The first character in the first block is (1,5), the 11th
charcter is (1,-5) and the 12th character is (2,5), etc.

All blocks holding map locations for x <= 0 are in reverse
order to enable searching from the end of the file. That means 
that (0, MAXY) is the last character in the map file.

This is hard to explain and probarbly even harder to understand. Here is
the order coordinates should be in for a 6 by 7 map (-2 through 3 and
-3 through 3):

(1,3)   (1,2)   (1,1)   (1,0)   (1,-1)  (1,-2)  (1,-3)  (2,3)   (2,2)
(2,1)   (2,0)   (2,-1)  (2,-2)  (2,-3)  (3,3)   (3,2)   (3,1)   (3,0)
(3,-1)  (3,-2)  (3,-3)  (-2,-3) (-2,-2) (-2,-1) (-2,0)  (-2,1)  (-2,2)
(-2,3)  (-1,-3) (-1,-2) (-1,-1) (-1,0)  (-1,1)  (-1,2)  (-1,3)  (0,-3)
(0,-2)  (0,-1)  (0,0)   (0,1)   (0,2)   (0,3)


Creating a map
==============

In order to use the map system on your mud you have to create a map
in the above mentioned format. Then edit /config/sys/map_defines.h
to make the values appropriate for your map.