			Running your Empire Game
-----------------------------------------------------------------------
At this point you should have accomplished the following.

1) fully compiled all the source code.
2) have files in /bin /data
   make sure a copy of  'hours' is in the /data directory
   with your etu rate, speed, update times.
3) compiled the info files in /info
   make the   info.nr  directory if needed.
4) run "files" and some land generation program
5) started the game up, loged in at the Deity.
   use the 'change' command or 'edit country 0'
   to select a new name or password for the Deity.
6) added in all playing countries, add and newcap
7) looked at the generated world.. made any final changes to the map.

------------------------------------------------------------------------

Ok.. your read to go.

Some Deity commands you might be interested in at this point.

enable
disable

  Both of these commands are used to turn updates on and off.
Regardless of what your hours file might have in it if the updates
are disabled NO update will occure.
  You can check to see if updates are disabled in the update report.
"update"
If updates are disabled the first line will clearly point that out.

turn <on|off|mess>

  The turn command is used to control player logins and set the
message of the day.

on = enables updates and allows you to set the MOTD.
off = lock players out and allows you to post a message that people
      will see before the game kicks them out.
mess = allows you to set the MOTD

NOTE - if you turn messages off only a Deity country can login the game.
       Also the Deity will not get the 'off' message normally displayed to
       players when they try and login.  You will just see a  -=O=- 

edit
  The edit command is a nice way to chance the statistics on any game object.
You can chance any ship,plane,unit,country,sector info.
Its a commonly used command when bugs pop up or if you want to test
something.

give 
  For some reason you might need to give a country something or take
it way from them.  Bugs, cheeting, rewards.  Give works for any 
common resource item.  Gold bars, dust, iron, food,
even civs, uw's and mil.

hidden <sect>
  Hidden shows some of the hidden statistics on sectors.
Che level, oldowner, mines , plague.  These are things the
players are not allowed to see.

force <time>
  If you want to force an update for any reason you can use this command.
NOTE - updates must be enabled or nothing will happen.

set----
setresource
setsector
ect..
You will find a bunch of set commands.  Do a  'list |grep set'
from the Deity command line and you will find all of them.
For the most part the set commands are good for scripts or tools
you might use.  I've never used them myself so this part is left
to the student as an excercise. :)
I've seen that in so many math books it makes me sick. 
Now I know why they use it. 

relations
  This is a normal player command but they deity has some options with it.
Look at 'info relations' for details.


--------------------------------------------------

  Keeping your game running while your way is always a problem.
For some reason the server might crash, the machine might reset, 
some local admin killed the server cause they were bored.  The 
problem is getting it backup where your not around.
If you look in the /scripts directory you will find two very 
important shell scripts.
'saveass' and 'isempireup'
Both have documentation in the directory.

saveass
  This is a shell script that will do backups of your /data
directory and store them in a zipped format.  Its very rare that
you will be required to restore a game from a backup but better it never
hurts to be prepared.  Setup a cronjob to do backups a couple of times a day.
Usually just before an update is a good time and a few hours after
an update.
  For information on cronjobs look at your local system see 'man crontab'
or 'man cronjob' manual pages.

isempireup
  This is a very useful shell script to start, check, kill the empire
server.  Documentation is also found in the /scripts directory.
Its greatest use is to checkup on the game every 10 minutes or so.
If the script is unable to login into the game will issue a restart
order.  As you can see this is a nice thing if your machine goes down
at 3am.  Your mailbox will not be full of, "Hey what happened to the game,
I can't login??" messages.
For the new server a version of isempire2 has been created.

** isempireup is the recommended way to start or kill off your game.

---------------------------------------------------------------------
Rules for being a Deity
This issue is tough to deal with.  Basicly there are no rules, only advice.

A) Start by being fair and honest with your players and yourself. 
   Many people put alot of time into a game of empire.
   Your actions are very important.

B) Try and avoid quick decisions.  Think about things, concider how
   a change now will effect the game down the road.
   Don't be afraid to ask for advice from the players.
   They will always be full of ideas.   
   You can also ask any of the regular game Deities.
   Their e-mail addresses will show up in the Empire News

C) Setup some policies before you start a game.
   How will you handle a missed update?
   Whats going to happen if a player drops out of the game early.
   How will the game end?  One person.. a group...how big will that group be?

Being a good deity is just like any other think in life.
The longer you do it, the better you are at it.

Take a look at the info file 'info deity' in the game.
It will give you some more pointers on what you should or should not do.

----------------------------------------------------
So... what do you do if you a player finds a bug?

  First of all, it is a bug? About 90% of the so called 'bug' reports
I get are not bugs... usually someone didn't understand how the
command works.  So try and get as much information
from the player as you can.  What units were involved, what were their
statistics before and after the bug occured.  Get all the facts.
  Now, see if you can reproduce the bug.  Setup a "test game".
If you have the disk space... recompile your source code but
use a different port number.  Then take one of your game backups, if you
have a current one, and play out the situation yourself.
See if you can reproduce the bug.  If you can reproduce it then there is
a very good chance that you can solve the problem.
If you are unable to reproduce the problem then chances are its not 
a big enough problem to deal with.

So...How can you fix it?? well that will depend on your personal computer 
coding skills.  Basicly you will need to trace into the code using 
some of the popular debuging tools.  'gdb' is what I've used for years.

For Chainsaw 3.4 code and earlier:
  The source code must be compiled using a -g compiler flag.
Make the addition in make/GenMakefile

GLOBALCFLAGS: -g

the -g options creates a symbol table that most debuging tools need.
Using -g will use up alot of space.  If your having disk space problems
then only use -g in the proper directory where the problem is at.

Example:  You find a bug in the update directory.  main.c
move into /update and edit the GNUmakefile.  
Add in the -g flag in GLOBALCFLAGS.
When you recompile the code the -g will only be used on the 
files in that directory.

Recompile the code.

Start up the server.
Now that you have the code compiled with the symbol table you can
move into the /bin directory and
'gdb emp_update'  or 'gdb emp_player'
by running the program you can do player commands and trace
the code at the same time.  It will take a little practice to get use
to some of the debuging tools.

New Empire Server or any version that has 'threads'

  You still need the symbol table listed above.
However the tracing process is a bit easier to use.
It does require that you have two different terminals.
Either two PC computers or use some kind of 'screen' process.

start the server up,
do a 'ps -x' and find the pid number of emp_server
now.. move into the /bin directory and do a
'gdb emp_server <pid_number>'
gdb will attach to the current process running.

You will need to set breakpoints in the procedures you want to stop at.
break atta.c:35
Then issue a 'continue' command so the current process can run.

Then you will need to login to a country from another terminal.
Do the correct command that will cause a your break command to happen.
Like 'attack'
You will notice on the other terminal that you can now issue commands.
It hit your breakpoint.
Using display, next, step you can trace the code and hopefully
figure out where the problem is.

Using the debuging tools will take alot of practice.

So... now that you find a bug.. fixed it.. now what?!?!?

Well tell other people about it.
Either rec.games.empire or make a post on the empire-list
if your a member of the list.
Then try and get your bugfix to someone who is in charge of 
maintaining the current code.
a.k.a. "keeper of the code"
They will try and get your fix into the current code.

-------------------------------------------------------------
SOME bugs can never be fixed.

   This is the case with code upto the Chainsaw 3.3 versions.
The problem is how the server was design.  Many people are doing
things which appear to be happening at the same time.
There is no protection in the old server design that would prevent
one players actions from overwritting someone elses.  
Some common things I've heard of.
"Um, I shot plan 344 down twice in 2 minutes"
"Hey, I loaded ship 356, but the good vanished!"
"I moved 300 hcm to a fort, but its gone, I can't find it!!"

These are all common things I've see with the older code.
The only solution to these problems was the new server design.
If your in a game and someone says something like this then
maybe your should 'give' them some of the lost goods, if its within reason.
Its very rare that it will happen.

Now.. what if you find bugs in the new server.
Well you will be breaking new ground in the area.
My method above is what I used for months to debug commands
during the conversion process from Chainsaw 3.3 to the new server code.

Over the years most of the 'easy' bugs are gone.  Whats left are mostly
cases that have not been concidered or logic problems in the code that is 
not used often.  Your on your own... however you will probably be the first 
person to tackle the problem.  

-------------------------------------------------------------------
An Empire Deity is rare.  

It takes alot of time and some coding knowledge.
Most, but not all, game Deities are players with a good computer background.
They simply take the code... and make the changes needed to make the
game... 'in their opinion' better.

Alot of people are scared away from the job.  They try and get the code.
Attempt to compile it.. but don't have a clue on how to run the game.
They fight with it, try and get help, but give up cause it just too 
much work.

Now that you have read the following are you up to the task?
Nothing is easy the first time you do it.
If you dedicate some time running an empire game can be alot of fun.
Chances are you will learn alot and hopefully have some fun doing it.

After all... isn't that what empire should be... fun?

I'll leave you hanging on that one.  
------------------------------------------------
Finally...
  THE END

