This directory contains the binary for an incomplete, but quite playable,
version of the game Empire, along with two versions of the 'empcre' program
for creating worlds.


What is Empire?

For those of you who know all about Empire, this is a totally new re-
implementation (in Draco of course) of the Peter Langston version of Empire
(also known as Old Empire). This is not the single-player game available on
some PC's which is played in a few hours. For the old pros, the features
not implemented in this version are: plague, weather, treaties, loans, buy/
sell/trade/exchanges. Pretty much everything else is present. One other
major change is that sector co-ordinates are row,column instead of x,y.
This version has been implemented by me (Chris Gray) in about 7 weeks of
spare time with some help from Chris Thierman and play testing by Al
Covington, Don Reble and Tim Breitkreutz. We've worked from a copy of Peter
Langston's documentation, which is often incomplete, contradictory and just
plain wrong, so there will be differences between this and the original.


Short History of Empire

The first widely available version of Empire was written by Peter Langston
(who also wrote the 'wander' adventure game system). It was available (as
far as I know) only in PDP-11 object code format for running under UNIX
Version 6. I played two games with that version on a PDP-11/45 at the
University of Alberta. The game appears to have been popular within the
North American UNIX community, and its absence on other machines was a sore
point. Tom Fisher took exception to this and proceeded to de-compile the
object module into C. His version is now available and will run on most
UNIX systems. It is difficult to modify, however, because much of its
structure reflects the decompilation process - it is a maze of labels and
goto's. It also reflects the memory limitations of the PDP-11 and is
structured as a set of 7 different programs which are accessed as overlays.
Another version of Empire, presumeably a re-implementation, has been done
by people at Berkeley (I think). I've never seen this version, so can't say
much about it, except to say that it has been augmented with farms,
bombers, tanks, nuclear weapons, etc. I have recently heard of another
project to re-implement Empire, in which the sources will explictly NOT be
made available. The sources to this Draco version will be made available as
soon as we are done, we've play tested the whole thing, and it has been
cleaned up some. Chris Thierman took it upon himself to implement Empire
for the University of Alberta's Amdahl mainframe about 18 months ago. The
project proceeded, but was never completed. We both bought Amigas about
that time and eventually I had Draco ported and Chris was using it a bit.
He decided to port Empire to the Amiga and requested my aid in doing a
translation from QC (a compiler of mine for the 360/370 series) to Draco. I
agreed and soon found myself headlong in the implementation of Empire.


What Empire is All About

Empire is a fairly rich simulation of international politics, economics and
war. It is played over a period of a couple of months by 2 or more people.
The Empire world consists of a toroidal grid of sectors consisting of
regular land, mountains and water. Players govern countries, which start
out as a pair of adjacent sectors and soon spread into large areas
requiring much management and protection. Various sector types can be
created which build ships, bridges, guns, shells, airplanes, and which make
medical and technological breakthroughs. Others are things like radar
stations, weather stations, fortresses, highways, warehouses, etc. A
typical Empire game is only over when just one country remains. A special
country, the Diety, is available, which has godlike powers to modify
sectors, ships, etc. The Diety is normally run by someone not playing
another country and has the responsibility of fixing up any problems which
occur.


Running This Version of Empire

Empire will run on an Amiga with 512K of memory and one floppy disk. A
stack size of at least 8000 bytes is required. The first step is to create
the world. Set up an empty directory for the Empire data files (starting
with this directory will work fine). Two versions of the empcre program are
supplied. 'empcre32x32' will create a 32 sector by 32 sector world, which
is suitable for 2 - 4 players. 'empcre64x64' will create a 64 sector by 64
sector world which is suitable for 5 - 8 players. Beginners should start
with the smaller world. The program will ask for two parameters. The first
is the maximum number of users to be allowed in the game. Space is always
left for the Diety. The second parameter is the amount of playing time per
day that each user (other than the Diety) will be allowed. This can be
between 30 and 180 minutes in half-hour increments. One hour is a
reasonable starting point. The program will then attempt to randomly create
the world. This will usually work eventually, but if it doesn't, just keep
trying. Note that you are unlikely to be able to put more than four
sanctuaries (countries) on the smaller world. You will also be asked for
the god password (the password for the Diety country), and the creation
password. The latter must be given when users are creating their new
countries.

****** Daily time is vital to Empire. The system time MUST be set *******
****** consistently or the game will not be playable.		  *******

The empire program itself is quite large, so the best way to run it is to
make a CLI window for it and leave it running all the time. User's can run
their countries from the normal Amiga keyboard, or can connect via the
serial port (over a modem) at 1200 baud. Either 8 bits no parity or 7 bits
even parity are accepted. Hit a RETURN to get your parity recognized and to
start things up. A couple of special commands allow the remote user and the
owner of the system to communicate. The 'message' command will ask for a
single line of text and will write this to the Amiga's screen. The system
owner can enter one of three things when Empire is running. 'play' will
allow the local user to enter the game proper. 'QUIT' will cause empire to
terminate, and 'message', entered when a remote user is connected, will
send a message to the remote user after they next complete a command. If
'play' is entered when a remote user is active, then when that remote user
logs out, empire will start the login sequence for the local user. If
'QUIT' is entered when a remote user is active, the remote user will be
told that the system owner wants the system, and empire will exit when the
remote user logs out.

The previous settings of the serial driver are saved when empire starts up
and are restored when empire exits. Empire uses the DTR signal to tell the
modem to accept calls and expects it to signal CD when a connection is
made and to remove it when the connection is broken. Empire will drop DTR
when the remote user exits. If the parameter 'private' is given when empire
is started up, the serial port will not be activated, and the local user
will go immediately to the normal empire login.


Getting Started

When a country first starts out, it will have 2 adjacent sectors, both
designated as sanctuaries. Sanctuaries cannot be attacked or fired upon by
other countries, so the late starter is protected from aggressive
neighbours. Each sanctuary will have 127 civilians, 127 military, 127 tons
of ore, 100 mobility units, and will be 100 percent efficient. The first
command will usually be

    map -1:1,-1:2

to produce a small map of the sectors around the sanctuaries. Next will
come 'move' commands to move civilians and/or military into the
neighbouring sectors to claim them. Census commands will then show the
mineral and gold deposits in the land sectors; further map and move
commands will explore and claim more territory; sectors will be designated
as banks, harbours, mines, gold mines, etc. This first phase of the game is
one of exploration, development, and setting up management (delivery
routes). Soon, however, two countries will meet, and the possibility of
conflict will arise. Since much of the fun of your first Empire game is
figuring out what you should be doing before everyone else does, I won't
say any more than that. Instead I'll just summarize the concepts and
commands.


Concepts

An efficient government (I haven't seen one of those for a long time!)
doesn't waste time or effort. To encourage this, Empire has the concept of
Bureaucracy Time Units (BTU's) which are required to execute many commands.
The game prompt consists of '[', followed by the number of remaining BTUs,
a ':', the number of remaining minutes of time for the day, ']' and the
prompt " Command: ". As you play, keep an eye on the two numbers, and make
sure you get the important things done. BTUs are created by your active
capital in accordance with the number of civilians there and the efficiency
of the capital. Connect time is reset at midnight.

Money is needed to build ships and bridge spans, for upkeep of various
types of sectors, for military supplies, etc. It can be earned as interest
on gold bars at banks or by contracting production of appropriate sectors.

Technology level controls your technology factor, which affects the range
of guns, airplanes, ships, etc. Technology level is increased by the
efforts of technology center sectors.

Research level, in combination with technology level, affects your
likelihood of catching the plague. Plague is not currently implemented.
Research level is increased by the efforts of research institute sectors.


Sector Types

. - sea
    Ships can sail here, other land-based operations can't happen.
    You can't own sea sectors.
^ - mountain
    These are land sectors, but you can't designate them. They cost a LOT
    of mobility to move onto.
- - wilderness
    Most of the usable world starts out this way. They are the default type
    of land sector. They cost more to move onto.
s - sanctuary
    You start with 2 of these. They cannot be attacked. You can't designate
    more.
c - capital
    Your active capital is the center of your coordinate system, and
    supplies you with BTUs. Defend harder. Can do anti-aircraft fire.
u - urban area
    Ore => increased civilians, which are are bundled in units of 10.
d - defense plant
    Ore => production => guns.
i - shell industry
    Ore => production => shells.
m - mine
    Time => production => ore.
g - gold mine
    Gold deposits => production => gold bars.
h - harbour
    Ore => production => ships (via build command).
w - warehouse
    Ore, shells and guns stored in bundles of 10.
* - airfield
    Ore => production => airplanes. Can do anti-aircraft fire.
t - technology center
    Ore => production => technological breakthroughs.
f - fortress
    Can fire guns, defend other sectors. Fight harder. Anti-aircraft fire.
r - research lab
    Ore => production => medical breakthroughs.
+ - highway
    100% highway costs nothing to move onto. Other countries can use
    highways unless they are checkpointed.
) - radar station
    Can see ships at sea and other sectors.
! - weather station
    Used to map and predict weather. Weather not implemented yet.
# - bridge head
    Ore => production => bridge spans in orthogonal directions (via build
    command).
= - bridge spans
    Like highways, but over water.
b - bank
    Collect interest on gold bars. Defend harder.
x - exchange
    Used in international trade, which isn't implemented yet.


Ship Types

type  name	cost sp vis rng civ mil  sh gun plns ore bars vrng
------------------------------------------------------------------
p   PT boat	  30 50   6  1	 -   10  10   1   -   -    -	4
s   submarine	  70 25   1  2	 -   25  25   2   -   -    -	3
b   battleship	 127 25  25  8	 -  127 127   4   -   -    -	6
d   destroyer	  60 35  15  3	 -   80  40   2   -   -    -	4
f   freighter	  80 20  20  -	127  -	127 127   -  127  127	3
m   minesweeper   50 20  20  1	 -   25  10   1   -   -    -	3
t   tender	 100 30  20  1	 -  100 127  30   -   -    -	3
c   carrier	 127 25  25  2	 -   60  40   2 127   -    -	4

cost - number of production units needed, also need cost * 9 dollars
sp - speed factor
vis - how visible the ship is to radar and lookout
rng - twice the maximum gun firing distance
civ - number of civilians it can carry
mil - number of military it can carry
sh - number of shells it can carry
gun - number of guns it can carry/fire (tender can fire one, freighter 0)
plns - number of planes it can carry
ore - number of tons of ore it can carry
bars - number of gold bars it can carry
vrng - how far it can see (radar and lookout) - subs are special

Submarines can launch torpedoes (the torpedo command).
Destroyers can drop mines (mine command) and depth charges (automatic) and
    have sonar so they can see submarines.
Minesweepers remove mines when they move into a sector.
Tenders can resupply other ships at sea (the tend command).
Carriers are like mobile airfields.

Ships must be at least 60% efficient before they can do anything. If they
drop below 20% efficient (as a result of shelling, torpedoes, etc.) they
will sink.


Updating

The sector update algorithm is central to Empire. It is based on steady
change over half-hour time units. It can be summarized as follows (values
are either for the sector being updated or for the owner country of the
sector; all calculations are integral):

    proc makeProduction():
	q := min(work * efficiency / 100, ore);
	if <sector not contracted> then
	    if money > 0 then
		q := min(q, 127 - production);
		production := production + q;
	    fi;
	else
	    q2 := q * priceInNickels / 20;
	    money := money + q2;
	fi;
	ore := ore - q;
    corp;

    /* in an urban center, people are lazy, so every 10 counts as 1 here */
    workForce := civilians + military / 5;
    if lastUpdate = 0 or lastUpdate > CurrentTime then
	lastUpdate := CurrentTime;
    fi;
    deltaTime := CurrentTime - lastUpdate;
    if deltaTime > 256 then
	deltaTime := 256;
    fi;
    work := deltaTime * workForce;
    if work >= 100 and (<I own this sector> or work > 48 * 2 * 100) then
	if money > 0 then
	    /* sector improvements */
	    q := min(work / 100, 100 - efficiency);
	    efficiency := efficiency + q;
	    money := money - q;
	fi;
	/* civilian growth */
	q := deltaTime * civilians;
	if designation = <urban area> then
	    q := min(127, civilians + min(q / 100, ore)) - civilians;
	    civilians := civilians + q;
	    ore := ore - q;
	elif designation = <bridge span> then
	    civilians := civilians - q / 400;
	elif civilians > 31 and civilians < 97 then
	    civilians := min(127, civilians + q / 200);
	else
	    civilians := min(127, civilians + q / 400);
	fi;
	/* mobility increase */
	mobility := min(127, mobility + deltaTime);
	lastUpdate := lastUpdate + deltaTime;	/* NOTE THIS!!! */
	/* military supplies */
	q := military / 32 * deltaTime / 8;
	money := money - q;
	if <this is owner's active capital> then
	    BTUs := min(96, BTUs + deltaTime * civilians * efficiency / 5000);
	    researchLevel := researchLevel - researchLevel * deltaTime / 4800;
	    techLevel := techLevel - techLevel * deltaTime / 4800;
	fi;
	<do any deliveries out of this sector - special handling is done
	 when delivering civilians or military into a sector that hasn't
	 been updated for a long time>
	if efficiency >= 60 then		/* NOTE THIS!!! */
	    case designation
	    incase <bank>:
		/* interest */
		q := deltaTime * goldBars / 2;
		money := money + q;
	    incase <capital>:
	    incase <radar station>:
	    incase <weather station>:
		/* utilities */
		money := money - deltaTime;
	    incase <technology center>:
	    incase <research institute>:
		/* utilities */
		money := money - deltaTime;
		if money > 0 then
		    q := production / 25;
		    production := production - q * 25;
		    if designation = <technology center> then
			techLevel := techLevel + 1;
		    else
			researchLevel := researchLevel + 1;
		    fi;
		fi;
		makeProduction();
	    incase <defense plant>:
		if money > 0 then
		    q := min(production / 10, 127 - guns);
		    production := production - q * 10;
		    guns := guns + q;
		fi;
		makeProduction();
	    incase <shell industry>:
		if money > 0 then
		    q := min(production / 2, 127 - shells);
		    production := production - q * 2;
		    shells := shells + q;
		fi;
		makeProduction();
	    incase <airfield>:
		if money > 0 then
		    q := min(production / 25, 127 - planes);
		    production := production - q * 25;
		    planes := planes + q;
		fi;
		makeProduction();
	    incase <harbour>:
	    incase <bridge head>:
		makeProduction();
	    incase <gold mine>:
		q := min(production / 5, 127 - goldBars);
		production := production - q * 5;
		goldBars := goldBars + q;
		q := min(goldSample * work * efficiency / 1000000, goldSample);
		if <sector not contracted> then
		    if money > 0 then
			q := min(q, (127 - production) / 2);
			production := production + q * 2;
		    fi;
		else
		    q2 := q * 2 * priceInNickels / 20;
		    money := money + q2;
		fi;
		goldSample := goldSample - q;
	    incase <mine>:
		q := mineralSample * efficiency * work / 10000;
		if <sector not contracted> then
		    if money > 0 then
			ore := min(127, ore + q);
		    fi;
		else
		    q2 := q * priceInNickels / 20;
		    money := money + q2;
		fi;
	    esac;
	fi;
    fi;

Ship updates are much simpler:

    if lastUpdate = 0 or lastUpdate > CurrentTime then
	lastUpdate := CurrentTime;
    fi;
    deltaTime := CurrentTime - lastUpdate;
    if deltaTime >= 3 then
	mobility := min(127, mobility + deltaTime);
	efficiency := min(100, efficiency + deltaTime);
	lastUpdate := lastUpdate + deltaTime;
    fi;


Command Syntax

Users directly on the Amiga (i.e. not logged in over the serial port) can
send output to a file by following the command name with '>' and a file
name (to create the file and write to it) or with '>>' and a file name (to
append to the file).

All commands will prompt for their needed arguments, so if you are unsure
of how to use one, just give it with no arguments to get prompts.

Some syntactic elements:

    <country> - a country name (in full, case significant) or country #

    <sector> - a sector specified as row,column

    <sectors> - a region given as toprow:bottomrow,leftcolumn:rightcolumn
	optionally followed by '?' and a set of conditions anded together
	with '&'. Conditions test things in the sector against each other
	or against constants. Operators are '=', '#', '<' and '>'. A realm
	number (# followed by 0 - 3, or just # for #0) can be used instead
	of the row/column range. Either range can be a single number. E.g.

	    des -10:10,12?designation=-&minerals>50&civ>99 m

	will designate all wildernesses in the region which have a mineral
	sample larger than 50 and more than 99 civilians as a mine.

    <ship> - the number of a ship

    <fleet> - a fleet letter (a-z, A-Z, or * for the default fleet)

    <ships> - a designation of a group of ships. Can be a fleet letter, a
	<sectors> range or a list of ship numbers separated by '/'s.
	Optionally followed by a condition as above, but which is applied
	to the ships instead.


Commands

    assault <sector> <ship>
	attempt to take over a sector with military from the ship. Costs
	BTUs. The sector may be defended.

    attack <sector>
	attempt to take over a sector with military from orthogonal
	sectors. Costs mobility and BTUs. The sector may be defended.

    board <ship> <ship>
	attempt to board the first ship with military from the second.

    build <sectors> <what>
	build ships (give the letter) at harbours or bridge spans (give one
	of udlr for direction) at bridge heads. Costs production units and
	money.

    bye
	exit Empire

    census <sectors>
	prints detailed census for sectors. Some entries:
	    * - checkpointed - allows others access if they know the code
	    cmsgpob - delivery directory for item - 0 is up, go clockwise
	    $ - sector's production is contracted
	    % - sector is defended by a fort

    change country <country>
    change name
    change password
	switch to another country, or change this country's name or
	password.

    checkpoint <sectors>
	set checkpoint codes at sectors. 0 means no checkpoint.

    contract <sector>
	set up contracting of the sector's production.

    country
	list the countries in the world

    declare war|alliance|neutral <country>
	currently only affects the spy command.

    defend <sectors> {%|sector}
	examine or set sector defense

    deliver <what> <sectors> {<threshold>} {<sector>}
	set/change/examine delivery routes. Use <threshold> = - to examine
	them, use <threshold> = +number to just set new thresholds. A value
	in parentheses is the threshold to use, which can be overriden on
	the prompt for the individual sectors. <what> is one of cmsgpob.

    designate <sectors> <what>
	designate sectors to be a new type. Efficiency goes to 0%.

    dump <sectors>
	dumps sector information in a very compact, hexadecimal format.
	Useful for those who want to set up tools to display more useful
	maps, etc.

    edit country <country>
    edit sector <sector>
    edit ship <ship>
	the edit command is only available to the Diety. It allows the
	Diety to alter characteristics of the items. For each value, a
	prompt and the current value are given, followed by the prompt
	again. Hitting RETURN leaves the value unchanged, otherwise a valid
	value is required.

    enlist <sectors> <total-required>
	turn civilians into military. Not more than 50%, none in urban
	areas.

    examine country <country>
    examine sector <sector>
    examine ship <ship>
	displays all information about the given item. Not terribly
	readable.

    fire <sector>|<ship> <sector>|<ship>
	fire gun(s) at fortress or ship from fortress or ship. Nearby ships
	in same fleet will return fire.

    fleetadd <fleet> <ships>
	add the ships to the given fleet. All start out in fleet '*'.

    fly <ship>|<sector> <plane-count> <bomb-count> <directions>
	fly planes (possibly with bombs) from ship or airfield. Directions
	are:
	    u  - up
	    /r - up right
	    r  - right
	    \r - down right
	    d  - down
	    /l - down left
	    l  - left
	    \l - up left
	    e  - end of flying (land or crash)
	    v  - view sector below
	    b  - drop some bombs
	Movement prompt is <fuel left:planes:bombs each:position>. Fuel
	comes from the starting airfield or carrier. Landing chances vary
	greatly. Watch out for anti-aircraft fire.

    grant <sector> <country>
	grant a sector to a country it is beside.

    help
    ?
	list commands and their BTU costs.

    load <ship> <percent>
	load stuff onto a ship in a harbour. If no <percent>, prompts for
	each type of stuff.

    lookout <ship>|<sector>
	visual lookout - reports on nearby ships and, if looking from a
	ship, sectors.

    map <sectors>
	shows the designation of the sectors you or god owns within the
	region and one outside of it. Other people show up as '?'.

    message
	send a one-line message from the remote user to the local window.

    mine <ship> <count>
	drop mines from a destroyer.

    move <what> <sector> <count> <directions>
	<what> is cmsgpob. <sector> is where to move from. <count> is how
	many to move (watch out for bundling). <directions> are as above,
	but with no 'b'. Movement prompt is <mobility:position>.

    nation
	shows some info about your country

    navigate <ship>|<fleet> <directions>
	sail ships. <directions> are as above, but no 'b' or 'v'. Costs
	vary with ship type and technology level. Watch out for mines.
	Movement prompt is <flagship mobility:minimum mobility:position>.
	Flagship is lowest numbered ship in group.

    power {force}
	display summary of statuses of countries. Rebuilt if more than 12
	hours old, or if 'force' specified.

    radar <ship>|<sector>
	do a radar scan from a ship or a radar station. Shows the ships you
	find and a small map of what the radar sees. Range varies with
	ships and with sector efficiency.

    read
	read your telegrams. Most are from the Diety regarding nasty things
	other countries are doing to you.

    realm <number> {<sectors>}
	(No '?' pattern allowed.) Set the realm (0 - 3) to the indicated
	rectangle of sectors. Realm 0 (written as #0 or #) is also set by
	the update command.

    route <what> <sectors>
	like map, but shows delivery routes for <what>, and doesn't show
	things you don't own.

    ships <ships>
	like census, but for ships.

    spy <sectors>
	attempt to spy on the sectors from any neighbouring ones of yours
	with military in them. The owner's relationship to your country
	determines what happens to spies who are caught.

    telegram <country> {file}
	Send a telegram to the given country. Reading a telegram from a
	file is not allowed for users connecting over the serial port.

    tend <ship> <ship>
	tend a ship from a tender in the same sector. This allows stuff to
	be transferred at sea.

    torpedo <ship> <ship>
	Launch a torpedo against a ship from a submarine. Maximum range is
	less than 2 sectors. Destroyers in your sector will drop depth
	charges on you.

    translate <country> <sector>
	only available to the Diety. Translates a sector given in the
	coordinate scheme of <country> to the universal coordinate scheme
	(which the Diety uses).

    unload <ship> <percent>
	like load, but the other way around.

    update {<sectors>} {verbose|quiet}
	perform the update operation on the given sectors. Other commands
	that need to change a sector will do an update too, as will census.
	Order of access is from top-to-bottom, left-to-right. This can
	affect how you want to set up deliveries, since this is when they
	are done. If no <sectors> is given, then the whole world is done
	(sort-of - other people's sectors are only ever updated if they
	haven't been for two days), and your realm 0 is set to a rectangle
	containing all of your sectors.
