                             Getting Started

     Ok, you got a machine to run a game on.  So where do I get the code?
Well there are alot of ftp sights.  Before you even
think of running a game tho ask yourself a few questions.

1) Do you have enough space for the game? 
   Chainsaw code takes up about 4 Mbytes of disk space.
This is just the .c code and other utility programs. 
Fully compiled the game can easily use up 10Mbytes of disk space.
As the game runs some files grow in size.  Telegram, announcement,
ship, planes, ect. all get big.  I'd recommend you have at least
15Mbytes of space before you even start.  Now there are ways to get
around this problem.  Once you have the game compiled you can get rid 
of the source code.  This will free up alot of space but if you ever have
a problem and you half to recompile the game you might find yourself in
a bit of a pickle.  Make sure you have enough space to start with.
You will save yourself alot of headacks down the road.


2) Does your local system administrators aprove of this?
   Unless you are the sys admin, don't assume they will let you run
this game on their machine and think nothing of it.  While empire does
not have a big impact on the CPU during non-update times it will uses
up system resources.  Many people will angry if their game goes away
their Deity wasn't smart enough to ask a simple question.  
     Its happened before, please make sure running a game is ok with the 
locals and you will be better off.  They might not let you run the game 
on the machine you want but they might have room on a spare machine 
for you if your nice to them.  Yes, that means to kiss their ass if needed.

     Ok, you made it past the first 2 checks, now lets get some code.
You can get the code from any of the ftp sights.  Simple move to the
correct directory and get it.  

at ftp.cis.ksu.edu  in
/pub/Games/Empire/sources 

"bin"                       (set to binary file transfer mode)
"get chainsaw3.3.tar.Z"       or whatever the current version is?

This will transfer the file from the ftp sight to your local machine.
Once on your machine you need to unpack the files. 
You can do this a couple of ways. (check your local manual pages for syntax.)

1)    zcat file.name.Z | tar -xf -

The command above will unpack all the files for the game and will
still keep a copy of the source code in zipped form.

2)   tar -xf - file.name.Z

This works like #1 but you only end up with the game files.
You do not have a copy of the source or .Z file.

After doing either command you will see a new directory.
It might be  /E ,  /EMP , /CHAIN , something like that.
Move into that directory and do a   "ls -l"
All the files to the game will be found here.

Explanation of the main directories.
For Chainsaw.3.31 versions or earlier.. Ksu,Merc,ect..
/bin
   All the binary files created by the game are stored here.
** This directory needs to be created by YOU!

/client
   The client package is contained here.
   emp_client is created from this source code.

/data
   All the data files related to the game are stored here.
   If anything happens to the data directory the current game
** is wiped out.  This directory also need to be created.

/doc
   The old docs can be found here.

/h
   All the .h  or "header" files can be found here.
   These files hold the data structured and #included info for the
   rest of the .c files.  Changes made here may effect code in the whole
   game so be careful when playing around with them.

/info
   The info files are all located here.

/lib
   All the library functions are here.   Their are 5 parts to the library.
   Library functions are chunks of code that are used throughout the game. 
   Also most of the "global" variable that controle the game can be found here.
   /global/constants.c
   Depending on what version of code you have either 4 or 5
   lib.a files will be created.


/login
   The files that controle login into the game can be found here.
   I think its safe to say that very few changes in empire have occured
   in these files.  You shoudn't have any problems in this area.
   emp_login is created here.


/make
   The Generic makefiles for the game can be found here.
   When your compiling code for the first time you will end up
   looking at these files alot.
   Also system templates can be found in  /Systems  directory.

/player
   This is a big chunk of the game.
   You will find ALL of the player command and many other functions
   that are related to them in this section of the code.
   If you end up with a bug you will generally half to look in this
   section of the code first.  Most of the code that deal with
   commands have been used countless times but bugs still show up.
   Should you find one that might impact the game please 
   report it to r.g.e. so others can make the change in their code
   and the source code can be updated so the problem doesn't happen again.
   emp_client is create here.


/scripts
   Over the years of empire some of the legendary Deities have created
   a few simple script files to help your game run smoothly.
   While use of these files is not required you should really try and
   use them for the sake of runing a smooth game.
   Dave's Saveass script does exactly as you would expect.
   Use it if your system will allow you too.

/templates
   As a Deity you will find some usefull files here.
   A detailed explanation of the hours file can be found here.

/tm
   The files that build the transaction manager are in this directory.
   The tm handles communications from the empire_client and the games 
   data base.  The game can not function without the tm.  
   The best way to imagine the tm would be to think of it as DOS on your
   PC computer.   It acts as a median between the players and the game.
   Hopefully you will not run into any problems with the tm on your
   system when your setting up a game.  To the best of my knowledge
   the tm code has been unchanged since the release of the KSU code.
   If your machine has problems with the tm code you better seek out
   some of the early empire coders or someone who really knows 'C'
   forwards and backwards. 
   emp_tm is created here.

/update
   Files that deal with the update process can be found here.  
   In the Chainsaw code there have been many changes in this area.
   Its safe to say that if you are setting up a game you won't
   half to look at any of this code.
   emp_update is created here. 

/util
   Over the years of empire many people have written programs to
   help the deity.  This is the place you will
   find .c files to setup the game, produce resources and land, and even
   check the data files for resources.  Alot of useful
   files can be found here and they will all be explaned later on.

/xland
   Files to create worlds using x-utilities.
   I've never had the chance to use this myself so if anyone
   has any imput into this area please e-mail me so I can
   add it to this documentation.
   This might not be found in all versions of empire.
-----
For Versions Chainsaw.4.0, Emp2.0, or whatever the new empire server name is.
The directory structure has changed dramaticly with the thread package.
You now only have 2 main directories and some support directories.

/lib
/server

/make
/data
/util
/info

The /player, /update, and some other directories have been
all put in the /lib directory.  The descriptions above all
are the same.  Its just rearranged.
The /tm /login files have been merged into the /server directory.
-----

Ok, the next step is seting up and compiling the game.

1.  You need to set the correct game path in the GenMakefile.
    Its located in  ~/make/GenMakefile.
    Edit this file and look for the variable SRCDIR.
    This is what he compiler uses to find the source code.

    You must have the full path here, no '~' or any macro stuff.
    Example.

    SCRDIR= /usr/student/zabel/CHAIN

    In this case /CHAIN has all the empire realated files in it.
    If you do a 'pwd' command on your unix system you can find
    the correct path if your not totally sure what it is.
    Examples can be found in that file as well.

2.  Ok, you have made that change.  The next step is to set up some
    infomation in a .h file.  

    Move into the /h directory.

    Edit the file  gamesdef.h

    You need to edit the file to update the variables located their.
    Example on correct syntax are included in the file.
    The important variable is the Port number.

    Standard Port numbers are 1617 and 1618.
    However most machines have a range from 1601-9999.
    If you stay in that range you shouldn't have any problems.
    Each machine has its "special" port numbers tho.

    Example:
    Port 21 is the FTP port. Port 23 is the normal login port.
    As long as you don't try and use a port that someone is already
    using you won't have any problems.  
    If your machine already has another network port in use, like a MUD
    or any other network activity please make sure you don't use the same
    port number.  Problems will occure if you do.
    User port numbers must be greater then 1024.  I believe port numbers
    less then 1024 are reserved for the superuser.  
    


A couple of things that you have to do before you try and compile the game.

1) mkdir data
   /data
   "mkdir data"
   The data directory will hold all your telegram, nation, and all other
   files relted to your game.  Everything is stored here!
   When you do a backup of the game this is the only directory you need
   to worry about.

2) compile the info files.
   Instruction can be found in the original docs.
   It should be as easy as... 
   "cd info"
   "make"

3) mkdir bin
   /bin 
   You need to make this directory too.
   "mkdir bin"
   This directory will hold all your binary files.
   After all the code is compiled everything you need to run the
   game is located here.


    With the info in this file you should be able to run a :
'gnumake dependall'
'gnumake depend'
'gnumake all'
'gnumake installall'

or a
'make dependall'  
'make depend'
'make depend all'
'make instalall'

Most machines will take the gnumake format but I used a NeXT machine  
and its liked the make format so use what works.  

Compiling the whole game from scratch may take about 15-30 minutes
depeding on your local machine.

In the Chainsaw code Tom has make a quick executable file call 'compile'.
This will do all the work for you.
If you are required to use make instead of Gnumake you will half to
make a small change in the file and change the gnumake to make.

   One possible problem.  You might be required to get 'mkmf' or 'gnumake'.
If you get this error when you try and compile you will need
to ftp and commpile this small package called emptools.tar.Z.
It can be found in pub/Games/Empire/tools/Deity
Compile that package real quick and that should take care of your
problems.

A nice shortcut to use.

'compile &'

This will compile the code and put it in the background.
You will be able to do other things while the code compiles.

For the first time tho you might want to just do a normal

'compile'

and actually watch the compiler work.  This will give you an idea 
how things are setup and what is required to get this monster to work.
You only need to watch it 1 or 2 times then you should be able to 
understand and use the 'compile &' command.  
Compiling code is a real long and painful process.
Just do it and go grab a pot of coffee and wait for it to finish.

   If all this works correctly the following files should appear
in your /bin directory.

emp_client
emp_login
emp_player
emp_tm
emp_update

or with the new empire server just a
emp_server

and a bunch of utility functions.

If your lucky it will all work the first time.
If not well you might have to dig into the code and fix some small
problems but it should not be too much work.

Alot of work has been done over the years to make it compile out
of the box but its still not foolproof.

------------
Well if you have managed to get everything compiled at this point,
Congratulations!!, your've just made it though the tough part.
Give yourself a big pat on the back cause its all down hill from here.  


   
   
 
