Phase 2:  Setting up a game.
--------------------------------------------------------------------

   At this point you should have the main files compiled.
They should all be located in /bin.

   Before you can set up a game you need to decide on the type of game
you want to run.  There are many types of empire games.
 
Blitz Game   :  Generally these games last for a day or two.
                The ETU games of these games vary but generally
                They range from 48-60.  The game generally updates
                every 10 to 20 minutes.  The number of players
                range from 4 to 20.

Normal Game  :  ETU rate very from 8 TO 60.  A normal game may have
                updates from 1 per day to 4 per day.  Number of players
                range from 10 to 100.

Slow Game    :  They follow the same game format as the Normal games
                but tend to have a very slow update pace.
                Usually 1 update every 2 to 4 days.

------------
Theme games:
------------

   After choosing a game type you might want to make your
game be special in some way.  

Newbie game  :  All players have limited experiance.

Invitational :  The Deity invited the players to play.

Test Game    :  Usually games run on a machine for the first time.
                Their purpose is to test out the new code and 
                find bugs.

World War II :  Tech starts with WW2 toys and won't increase.

Europe       :  Create a map that looks like Europe and break the
 		countries and name them similar to the current European
                geography.

Be creative, be original, or just run a boring normal game. :)

--------------------------
Setting up game variables:
--------------------------

   The first thing you should do is look at or get a print out of
~/CHAIN/templates/hours
   or look at 
~/CHAIN/wantupd.h

   The hours file is what you use to controle some of the
game variables.  Its greatest use is setting the ETU rate,
and update times of the game. 

** The hours file is placed in the
** /data directory with all the other game files.

   To create an hours file you can:
1) If you have a directoy called /templates you can simply copy
   the file into the /data directory.
   cp hours ~/CHAIN/data
   Then edit the file and change the variable give.

2) If you don't have that directory look at ~/CHAIN/wantupd.h 
   Move to the data directory and start a new file.
   'vi hours'
   'jove hours'
   then fill in the varaible found in  ~/CHAIN/wantupd.h

Some examples are given later on. 
 
----------------------
Selecting update times
----------------------

   Setting the correct update time requires a couple small calculation.
Lets say you want to set up a game that will update once a day
at 9pm on your machine with 60 ETU's.

The update formula is:
     ETU * seconds per Etu = seconds_update.

Just plug in the numbers.
    ETU = 60
    seconds_update = 86400   ( 60*60*24=86400 seconds in 1 day ).

86400 / 60 = 1440.

So what would the hours file look like??

s_p_etu: 1440                   - the number of seconds per ETU
etu_per_update: 60              - the ETU rate.
update_policy: 0
update_demandpolicy: 2

Ok, using the same info we can change the numbers to any type
of game we want.

Example:  We want 2 updates a day instead of just one.

This means the s_p_etu rate will be cut in half.

s_p_etu: 720
etu_per_update: 60
update policy: 0
update_demandpolicy: 2

You can contine to change the etu rates and s_p_etu values and
have the game update as often as you want.

Now the first 2 ideas will work but sometimes you might want to
have the game update at a specific time thats not on a nice pace.

Example:  A 32 ETU game with 4 updates a day but at 3AM,5AM,9PM,11PM.
As you can see those times are not divided equally so the idea above
using update_policy 0 will not work.
Instead look at update_policy 1.

Pick numbers the look good for s_p_etu, this number is used in
btu generation so try and keep is reasonable.
i.e. a real low number will generate alot of btu's
and a real high number will slow it down.  
Btu generation is also controled elsewhere but more on that later.

The hours file would look like this.

s_p_etu: 675             ( 86400 / 32 = 2700,  2100 / 4 updates )
etu_per_update: 32
update_policy:1
update_times: 3:00 5:00 21:00 23:00
update_demandpolicy: 2

You can play around with the update options 0 and 1 and set up
any type of game you want.

Update_demandpolicy:  
   If you don't want to use normal updates you can use the
zdone command and the players can force game updates.

An example of a game with 10 players, an ETU rate of 40.
The Deity decided that if 7 of the 10 must decide must vote 
'yes' using the zdone command.
(On the average you have 10 updates a day, thats a guess. )

s_p_etu: 216           (86400 / 40 = 2160, 2160 / 10 updates = 216 )
etu_per_update: 40
update_policy: 2
update_demandpolicy: 1        - check when the player sets zdone.
update_wantmin: 7             - we must have 7 yes votes for an update.

Now if you wanted to be picky about the times you could add.
update_demandtimes: 18:00-24:00

This would limit updates from 6pm to 12pm.

-----------------------
Other global constants:
-----------------------
 
After the update time(s) have been decided you need to look at a
few other game variable.  Look at the file  ~/CHAIN/lib/constants.c
Printing it out in advance would be helpful.

This file holds most of the variable you will need to change
if you are not happy with the default values.  Each one is explained
in the file.

Take a look at them and based on your own empire experiance
you can alter them to design the type of game you want.

You do not need to change the s_p_etu rates or etu_per_update
values cause the number you put in the hours file will override
the numbers found in this file.

-------------
Game Options:
-------------

Now that you have the update time and have set up the game variable
you need to look at some of the special modification other empire
coders have added to the game that are not standard.

Look at the file    ~/h/options.h

This file is filled with a whole set of #define options.

Print this file out or look at it real quick.

This file changes alot depeding on what version of empire you have.
In the Chainsaw code the file is divided up into 3 sections.
In the Chainsaw options.h file most of the new game options have
been commented.

This file will help those of you who have older versions of the 
code like the KSU or MERC code and are not familiar with them.

To change an option either comment it out or uncomment it.

Example

#define SUPER_BARS
#define EASY_BRIDGES
#define BETTERARMOR

You want to remove the easy bridge option.

#define SUPER_BARS
/* #define EASY_BRIDGES */
#define BETTERARMOR

With the new empire server, "threaded" empire, the options list
is much shorter.  The commenting has been redone as well so 
all options should be strait forward.

Once you start a game you shouldn't change any of the game
options.  Adding or deleting an option might change the size
of the data structures and if this happens in the middle of a game
you better have a backup handy cause thing will get messed up.

-----------------------
Other things to change:
-----------------------
Some other files that you might want to look at are:
~/lib/global/ship.c
~/lib/global/plane.c
~/lib/global/nuke.c
~/lib/global/land.c    (for chainsaw 3.x code )
~/h/product.c          

Ship, plane, nuke, and land.c files all hold the actual
values for each type of piece in the game.  If you are unhappy
with the current setting or wish to change them do so before
you start the game.  Also if you add or subtract something you might
need to change a constant variable located in ~/h/ship.h  land.h ..ect..

If you want to change the production levels or do some strange stuff
with production you need to look at the product.c file.

Example:
If you want to make the cost per tech. point cheeper, 
set it up so countries can produce guns and shells at tech 10
instead of 20, or be creative and maybe allow a radar station
produce small amounts of food.  (Hey I did that once just
to see if anyone was paying attention.)

-------------
Game commands
-------------
   Just about everyone has their own view of the "perfect game".
One option might be to enable or disable some of the existing
commands that the players can use.  To do this you need to make
changes in the /player directory.

/player/empmod.c

If you want to disable a command or change the BTU cost for the
command edit the lines at the bottom secton of the file.

/*  command form              cost  lck     addr   permit   */

permit:  This is the game flag that you need to worry about.
         Some of its options are:

         GOD   -  Only the deity can use the command.
         NORM  -  Normal players and the deity can use the command.
         VIS   -  A visitor, player, or deity can use the command.
         SANCT -  A everyone can use the command.
         CAP   -  The country must have an active capital.
         MONEY -  The country must have a positive nation treasury.

In the chainsaw code the 'market' command is set for 'GOD'
This means that players will not be able to use market for
your game.  If you decide that you want to use the market
goto the line labled market and make the change.

Before:
"market [COMM]",             0, 0,  mark, GOD,

After:
"market [COMM]",             0, 0,  mark, NORM,

Also keep this in mind.  If you enable or disable commands make
sure you take care of other commands that depend on each other.

In the case of "trade", you also need to look at "buy", "sell" and "set".

-------------------
adding new commands
-------------------
   Many new deities have ideas on how in improve or customise
their own game.  If you want to add a new command you need
to make 3 changes.
1) In the /player/commands directory make the .c file.
2) In empmod.c add in the line at the top half of the file
   extern int ----();    the name ---- must be equal to the
   name you start with in the .c file.  
   Take a quick look at a few of the files in /player/command
   and you'll see how easy it is.
3) Then add in a line in the bottom half of empmod.c
   "---- [bla bla bla]",        1, 0,    ----, NORM, 

If you have new ideas please think about what adding them to the
game might do.  Are your new options really needed?
Will they make the game more complicated or easier for players?
Will all of your work be worth the effort?
----------------------
One last thing to do in this section, take care of security.
In the Chainsaw version 3.x and up and in the new "threaded" server
some security for the Deity has been added.

Empire has 2 files that must be placed in the /data directory.
  If you have not make the directory yet do it at this time.
  'mkdir data'

  In the /template directory you will see ban and auth files.
Examples are included.
'ban' is a list of all machines you will not allow login from.
Hopefully you will not need to ban anyone from the game but the option
now exists.
'auth' is a list of people who can login as the Deity.  So putting your
machines and user login helps.

One note on these files.  Make sure you have one blank line at the end
of the file.
Example auth
-----------------
coffee.engg.com
yakkel

localhost 
joe
             (one blank line at the end of the file)
-----------------
this will avoid problems down the road.

Since you 'ban' file will probably be empty just create a 0 byte file.
'vi ban'  then insert a blank character... remove the blank character
then save the file... you have a 0 byte file now.

----------------------------------------------
Well at this point you should be able to design the empire
game of your dreams.

On to Phase3, setting up a world.

