Empire for Openstep

Introduction

	This is Empire for Openstep.  It is a network multi-player war game for up to three players.  Each player begins with one city, and must produce units and explore the world.  The world is rectangular, and consists of land, water, cities and units.  The object of the game is to destroy your opponents by capturing all of their cities.  The game is modelled after "Empire: Wargame of the Century", by Walter Bright and Mark Baldwin.

	¬
	The initial player window.

	The map shows the last known state of the world.  Initially only the locations adjacent to your first city are known, and you must produce units to explore the terrain of the rest of the world.  You can only see enemy units that are adjacent to your units or cities.  This means that if you move to a location adjacent to an enemy unit, and then move away, the map still shows the enemy where you last saw it.  When your turn ends the enemy may move that unit, but it remains on your map until one of your units explores that area again.

	Actually, it's a little more complicated than that, since not all units are visible by all other units.  For example, only submarines, destroyers and cruisers can see submarines, so a fighter won't be able to see an adjacent enemy submarine.  If a fighter tries to move onto a location occupied by an enemy submarine, the two units will become visible to each other and will battle for that location.  Also, since a fighter cannot see an adjacent enemy submarine, it cannot tell if a submarine is still at its last known location.  Since there may be only one unit at any location (except for cities, transports, and carriers), if the fighter sees, for example, a destroyer there, it knows the submarine is no longer there.

Cities

	Each city produces one type of unit at a time.  After changing the type of unit a city produces, the first unit takes a bit longer to produce than the subsequent units.  Units with more than one hit point may be moved into a city, where they will have 1 hit point repaired at the end of each turn.  Ships may only be produced by cities that are adjacent to water.  Fighters may be refueled in cities.

	Cities may only be captured by armies.  When an army captures a city, it is disbanded and acts as the city garrison, so during combat a city has the same defense profile as an army.

	Cities can see all types of adjacent enemy units.

	Cities may have a flight path assigned to them.  Fighters entering a city with a flight path are given orders to move along the flight path (unless they are patrolling from that city).  Flight paths are useful for bringing fighters up to the front lines.

	¬	¬
	The City Attributes Inspector.					The City Units Inspector.

The Units

	Units that have more than one hit point can sustain damage before being destroyed.  When a unit is 50% damaged, it travels at a speed of one move per turn.  Damaged transports and carriers are capable of carrying fewer armies and fighters.  The damaged units may be repaired by moving into a friendly city at the end of the turn, and are repaired by 1 hit point per turn.  Units may be given orders to make their management less tedious.

	In the following list, all production times are given for 50% production efficiency.

	Army
		- moves on land
		- 1 move/turn
		- 1 hit point
		- 1 damage/hit
		- 1/2 defense factor against bombardment
		- only unit capable of capturing cities
		- can be moved across water with transports
		- 6 turns to produce initial unit, 5 turns after that

	Fighter
		- moves in the air, over land and water
		- 5 moves/turn
		- 20 moves before refueling
		- 1 hit point
		- 1 damage/hit
		- limited range before refueling (in city or carrier)
		- 12 turns to produce initial unit, 10 turns after that

	Transport
		- moves on water
		- 2 moves/turn
		- 2 hit points
		- 1 damage/hit
		- 1/2 attack factor
		- 1/2 defense factor
		- can carry up to six armies
		- 30 turns to produce initial unit, 25 turns after that

	Submarine
		- moves on water
		- 2 moves/turn
		- 2 hit points
		- 3 damage/hit
		- 1/2 defense factor
		- only visible to submarines, destroyers and cruisers
		- cannot see fighters or armies
		- 24 turns to produce initial unit, 20 turns after that

	Destroyer
		- moves on water
		- 3 moves/turn
		- 3 hit points
		- 1 damage/hit
		- can see submarines
		- 24 turns to produce initial unit, 20 turns after that

	Cruiser
		- moves on water
		- 2 moves/turn
		- 8 hit points
		- 1 damage/hit
		- can bombard armies on land
		- can see submarines
		- 42 turns to produce initial unit, 35 turns after that

	Carrier
		- moves on water
		- 2 moves/turn
		- 8 hit points
		- 1 damage/hit
		- 1/2 attack factor
		- can carry up to eight fighters
		- fighters can refuel on carrier
		- 48 turns to produce initial unit, 40 turns after that

	Battleship
		- moves on water
		- 2 moves/turn
		- 12 hit points
		- 3 damage/hit
		- can bombard armies on land
		- 60 turns to produce initial unit, 50 turns after that

Combat

	When one unit tries to move onto the location occupied by an enemy unit, the units battle until one has been destroyed.  The attacker and defender alternately exchange hits.  Each has its combat efficiency modified by the attack and defense factor of that unit type (taking into account whether it is bombardment or regular combat).  This gives them attack and defense values.  A hit is made if the attack is successful and the defense is unsuccessful.  The successful hit inflicts the amount of damage corresponding to the attacking unit. The battle ends as soon as one of the units is destroyed.

	Example:
		A submarine with 40% combat efficiency attacks a cruiser with
		60% combat efficiency.  The submarine has a defense factor of 1/2,
		so it's defense value is 20 and its attack value is 40.  The
		cruiser has a defense value of 60 and an attack value of 60.

		The sub attacks first. It rolls 45 for the attack and the cruiser
		rolls 64 for the defense.  Since 45 > 40 the sub missed.

		The cruiser rolls 17 for the attack and the sub rolls 3 for the
		defense.  17 < 60 so the cruiser might hit, but 3 < 20 so the
		sub successfully defends.

		Now the sub roles 33 for the attack, and the cruiser rolls 72 for
		the defense.  33 < 40 so the sub might attack, and 72 > 60 so
		the cruiser is unable to defend.  The sub inflicts 3 points of
		damage on the cruiser.

	Explosions are shown on the unit for each point of damage sustained. Third party enemy units in adjacent squares can see the explosions.

Orders

	You can give orders to units so that you don't have to deal with them each turn.

	Go Home
		- give the current unit orders to move to the nearest friendly city.  Note
		  that nearest city in this case does not take into account the type of
		  terrain the unit can move on.
	
	Go Direction
		- give the current unit orders to move in the given direction

	Go Random
		- give the current unit orders to move randomly.  It chooses a direction,
		  and moves that way, each time randomly choosing to turn left, right, or
		  continue with the current direction.

	Move To
		- give the current unit orders to move to a given location
		- uses shortest (known) path.  It assumes it can move over unexplored terrain,
		  until it is explored and it finds out otherwise

	Patrol To
		- give the current unit orders to patrol between two locations
		- uses the shortest known path
		- fighters can patrol from a carrier
			- since the carrier can move up to 2 squares per turn, the fighter can only
			  patrol up to a distance of 8 squares

	Escort Ship
		- give the current unit orders to escort the given ship.  Tries to stay two squares behind the ship it is escorting
		- note: escorting a ship with faster movement will allow the escorted ship to get far ahead
			- i.e. transport (2 moves/turn) escorting destroyer (3 moves/turn)

	Explore
		- give the current unit orders to explore the unexplored areas of the map.
		- It moves to the nearest unexplored area, with a bias towards unexplored
		  areas closest to where it started.

	Sentry
		- unit will remain at current location until it sees an adjacent enemy unit
		- not good for fighters

	Clear Orders
		- remove the orders for the current unit.

	Load Ship
		- Used for loading armies and fighters on transports and carriers, respectively.
		- Adjacent armies or fighters are given orders to move to the transport or carrier.

	Unload Ship
		- For transports and carriers, All units on board the ship have their orders cleared, and the ship waits
		  to give the units an opportunity to leave.

	Skip Move
		- The current unit skips movement for this turn.

Starting a game

	Choose "Game -> New Game..." to open the new game panel.  Here you can select the map to use for this game.  [Note: It would be nice to be able to randomly select an existing map, or randomly generate a new map.]  It also provides a set of options for all three players.

	¬
	The New Game Panel.

	Each player has several attributes.  First, you can select the player type, from None, Human, Computer [not yet implemented], and Remote. Use the "About..." button to get a brief description of that player type [not yet implemented].  You can set the name, production efficiency, and combat efficiency, as well as the color of units.

	If you select a remote player, you must select the remote host to use for that player.  The remote game then chooses its efficiencies, so those shown here have no effect.  Each remote host can only support one player.

	Once you select OK, a game status window is created.  It shows the current game state, the current turn, and some information about each player.  This is incomplete, and intended primarily for the server, so clients cannot stop the game and not all the information shown is complete.

	A window will be created for each local player.  Each remote player (if any), will choose it's player type and efficiencies, and when they select OK, they will get a window.  Once all remote players have chosen, the game will begin.

	Note: The player icons are dynamically updated based on the colors from this panel.  You can use it as a preference panel until a real one is made.

Starting a network game

	For a network game, one application acts as the server, and all others are clients.  Choose "Game -> Start Server..." to show the server control window.  The server status should be "stopped", so establish the server connection.

	¬
	The Server Window.

	Each client should choose "Game -> Start Client..." to show the client control window.  Enter the server hostname and connect to the server. The client should show up in the server's client list, as well as the remote host popup buttons on the new game panel.

	¬
	The Client Window.

	Now the server starts a new game by selecting which players are local and remote.  Each client is presented with a panel to select their player attributes.

	¬
	The New Client Panel.

	Note: The game doesn't tolerate interrupted connections at all.

Resigning from a game

	A player can resign from a game.  When a player resigns, all of its cities are returned to being neutral cities, and the units of that player are stripped from the maps of all the other players.  If there is only one player remaining, that player wins the game.  Once a player has resigned from a game it can safely quit the application without affecting other players (for a remote client).  However, the server must remain until the end of the game.

Stopping a game

	The server may stop a game.  Each player is notified and the final maps are created.  The connections between the server and the clients are removed.

Game Status

	Each game has a Game Status window associated with it that shows the turn number, whose turn
it is, and current status of each player.

	¬
	The Game Status Panel.

Human Players

	The window for the human player shows the current mode, the turn number, a status line, the map, and two buttons to continue or end the turn.

	¬
	Sample Human player window.

	The status line give a summary of the currently selected thing.  For empty terrain and cities, this is just the map location.  For a unit it also shows the unit type, name, current hit points, maximum hit points, current range, remaining fuel (for fighters), and the orders (if any) for this unit.  Transports and carriers will also show the number of armies or fighters on board.

	The mode begins with the Idle mode.  At the beginning of your turn, you enter the Initial mode, where the cities that just produced a unit are shown one at a time, giving you a chance to change their production.  If no new units were produced, it automatically switches to the Move mode.  Here you give commands and orders to your units, and once all your units have move you enter the Survey mode.  This mode gives you a last chance to alter orders before you end your turn and go back to the Idle state.

	You may switch between Move and Survey modes by clicking the right mouse button.

	From both the Move and Survey modes, there are several more modes you may enter while giving orders to units.  The most common is the Move To mode, which allows you to select the destination for the currently selected unit.  A dashed line from the unit to the target location is shown while you hold down the mouse button.  Release the button to assign the order and return to the originating mode.  The status line shows the distance between the two points.

	The Patrol To mode is almost identical, except that the resulting order is to have the unit patrol between the current location and the target location.  This mode is entered by control-clicking and dragging on the target location.

	The Escort Ship mode shows a marquee around the current unit, and allows you to select a ship.  The order is only set if a friendly ship is at the target location.  This unit will then try to stay within three squares of the target ship.  Beware of trying to escort a fast ship with a slower one. 

	The Move To, Patrol To and Escort Ship orders are started slightly differently depending on the mode they are issued from.  In Move mode, a unit is already selected, so you just need to select the target.  In Survey mode, you need to click on the unit and drag to the target.

	The Direction mode allows you to select the direction to move the unit in.  Use the number pad or click on an adjacent square to set the direction.  Press escape to cancel this order.

	The Production mode shows you what each of your cities is producing by removing all the units from the map and representing each city by the unit it produces.  Select continue to return to the original mode.

	The Flight Path mode shows you the flight paths you have set up between cities.  When a fighter enters a city with a flight path, providing it has no other orders such as patrolling, it will follow the flight path to the destination city.  This is useful for automatically bringing fighters up to the front lines from distant cities.

	While in Flight Path mode you can enter the Set Flight Path mode by clicking on a city and dragging the mouse.  This will give a display like the Move To mode, allowing you to select the destination.  Once done, this flight path will show up on the map.  Flight paths may be removed by setting a flight path with a zero length.

	Finally, the Combat Report mode shows you your map as it was at the end of the last turn, and replays any observed enemy activity.

Key summary for Move and Survey modes

			Move Mode		Survey Mode		Order/Command
			1,2,3,4,6,7,8,9		n/a				move in direction
			arrow keys		n/a				move in direction
			5,c				5,c				center screen
			d				d				go direction
			e				e				escort ship
			h				h				go home
			l				l				load ship
			n/a				m				move mode
			o				o				clear orders
			p				p				patrol to
			r				r				go random
			s				s				sentry
			t				t				move to
			u				u				unload ship
			v				n/a				survey mode
			w				w				wait
			x				x				explore
			space			space			skip move

Reports

	Combat
		Replaces the current map with the map as of the end of the previous turn.
	         All the observed combat events are replayed, and then the map reverts back to
		the current map.
	Commanders
		Not implemented.  Shows the commanders, the number of games won and lost,
		and the relative skill of each commander based on the combat and production
		efficiencies of each game played.
	End of Game
		Once the game has ended for each player, they can view the combined map of
		all the active players at the time this player lost, and the final map of
		each inactive player.  The combined map shows the real location of all units.
	Production
		The current map is replaced with a map stripped of all units, and each city
		is represented with the unit type it is producing.
	Ship
		This report provides a list of all your ships, showing their name, type, location,
	       	and damage sustained.

			¬
			The Ship Report Panel.

	War
		The report shows for each unit type the number under construction, the soonest complete,
	      	how many are in combat, the number we've destroyed and how many we've lost.  It also
	      	shows how many cities we've captured, the total number of cities, and how much of the
	      	world we've explored.

			¬
			The War Report Panel.

	World Map
		This shows a smaller version of the map.  It can be used to set the target of
	      	movement for the Move To and Patrol To orders, for example.

			¬
			The World Map Panel.

The Map Editor

	A simple map editor is included for creating maps.  The map size is arbitrarily limited to 1000 by 1000 (although this is way too big in practice.)  When creating new maps keep in mind that (for a three player game), two maps are sent from the server to the client at the beginning of each turn, and one map is sent from the client to the server at the end of each turn.

			¬
			The New Map Panel.

	The initial map is entirely water.  You can select a brush size (1x1 or 3x3), and the type of terrain (water, land or city).  Paint on the map with the mouse.  Control-click to have the terrain "grow" out from the current location.  This results in solid chunks of terrain. Command-click to have the terrain "branch" out from the current location.

	¬
	The Map Editor Window.

	Choose "Reports -> World Map..." to show a smaller version of the map. You can paint directly on this map.

Other Things

	Under the Tools menu, there is an option to turn "Berserk" on or off. In berserk mode, the turn is automatically ended and new units are given orders to explore.  Note that with multiple games in progress, the menu item may not correctly reflect the proper On/Off state.

	The hovercraft was created for initial testing, when I needed a unit that could move on both land and water.  It's basically a fighter that doesn't run out of fuel, but with attack and defense factors of 0.1.  It is useful for testing.  I've left it in, but made it expensive to produce.

Application Defaults

	There are a few defaults that you can set.  This uses the new defaults system, so be sure to use, for example, "defaults write Empire DefaultPlayer1Type Human".

			Key				Values
			DefaultPlayer1Type	None, Human, or Remote
			DefaultPlayer2Type	None, Human, or Remote
			DefaultPlayer3Type	None, Human, or Remote
			DefaultPlayer1Name	- a string
			DefaultPlayer2Name	- a string
			DefaultPlayer3Name	- a string
			DefaultMap		path to show in the New Game panel
			MapWidth			default width of map for New Map panel
			MapHeight		default height of map for New Map panel
			CombatEventDelay	delay (in seconds) between each replayed combat event.  Defaults to 0.5.

To Do

	There are still a lot of things to do.  On the top of the list are computer players and automatically generated maps.  Followed by city and ship names assigned randomly from a list of names in a flat file, army and fighter names based on simple rules (47th fighter, 122nd army), sound effects, a preference panel, etc.

	Any comments and suggestions are welcomed.

		Steve Nygard <nygard@telusplanet.net>
		April 27, 1997.