Kingpin For Linux
---------------------

Please see the readme.txt file included for general information about the
game.  This file contains Linux specific information.

Requirements
------------

Kingpin for Linux supports the following video subsystems:

- 3DFX fxMesa with Mesa 3-D or 3DFX Miniport (ref_gl.so)
	- Mesa 3-D 2.6 or later, specifically compiled for 3DFX support
	  Mesa 3-D 2.6 compiled with 3DFX support is provided with this archive.
- Generic glX (X11) based OpenGL (ref_glx.so)
	- Requires a glX based hardware accelerated OpenGL implementation.
	  Mesa 3-D 2.6 supports this on 3DFX hardware.

Also included is a specific 3DFX mini-OpenGL implementation for running Kingpin
on 3DFX hardware.

Installation
------------

To install the Kingpin files, you will need to install Kingpin under win32,
and then mount the installation folder under linux, and copy the installed
files across.

Kingpin requires approx 550mb of free hard drive space.

If you are installing onto a Linux partition, you will need to run the
upper-lower case converter supplied in the "kingpin/main" folder. To run this,
type the following, from within the "main" folder:

  ./ccase -r *

Thanks to Vincent Harvey <vharvey@enteract.com> for the conversion script.


Make sure you have the appropriate hardware, drivers and libraries installed
for the renderer you are going to play on.


  By default, the mouse will not be 'tied' to the Kingpin window.  To cause
  Kingpin to grab the mouse, select 'Windowed Mouse' from the options menu,
  or type '_windowed_mouse 1' at the console.  Do the reverse to release it.
  You can bind keys to grab and release the mouse in the console, like so:
    bind i "_windowed_mouse 1"
    bind o "_windowed_mouse 0"
  Then "i" will grab the mouse and "o" will release it.


Kingpin for Linux supports the following renderers:

- ref_gl
  This render can be run with two different OpenGL drivers:  Mesa 3-D
  ontop of Linux GLIDE, or 3DFX's mini-OpenGL Quake driver.
  For Mesa 3-D, the necessary libMesaGL.so.2.6 is included with this archive.
  You must copy it to /usr/lib or /usr/local/lib and run ldconfig (as root)
  in order to use it.  You can do this as follows:
    tar cf - lib*GL* | (cd /usr/lib; tar xf -)
  You should use tar to keep the symlinks intact. Once you copy them over
  run ldconfig.
  You must also download and install the Linux GLIDE drivers at
  http://www.3dfx.com/software/download_glidel.html
  And install them as instructed.
  RPMs for GLIDE are available at :
     http://glide.xxedgexx.com/3DfxRPMS.html
  The GL library is entirely runtime loaded.  This means you can specify
  what shared object to load for GL display.
  To use Mesa 3-D GL (console), run quake with:
  	 ./kingpin +set vid_ref gl +set gl_driver libMesaGL.so.2
  To use the 3DFX OpenGL Miniport, run the included Kingpin.3dfxgl:
     ./kingpin +set vid_ref gl +set gl_driver lib3dfxgl.so
  The gl_driver cvar indicates the name of the library to load for GL
  functions.  It can be in any directory listed in /etc/ld.so.conf
  or in /etc/Kingpin.conf

  **NOTE:  Kingpin has been compiled only under glibc, it will therefore
	not likely work under libc.

- ref_glx
  ref_glx should run on many different hardward OpenGL implementations under
  Linux and X11.  This binary is an X11 application and must be run under
  X11.  It will work with Mesa 3-D as a standard glX based OpenGL
  applications.  If the Mesa 3-D library is compiled with 3DFX support,
  you can have Mesa 3-D support 3DFX hardware under X11 by setting the
  enviroment variable "MESA_GLX_FX" to "fullscreen" for fullscreen mode
  and "window" for windowed mode, eg. "export MESA_GLX_FX=fullscreen" for sh
  or "setenv MESA_GLX_FX fullscreen" for csh.

  As with ref_gl, the "gl_driver" cvar indicates the shared library to load
  for OpenGL functions (the glX functions must provided in that library
  as well).


Permissions
-----------

Kingpin requires root permissions to run. In order to make this secure, some
special considerations must be made.

Kingpin should get setuid root:
	chown root kingpin
	chmod 4711 kingpin

And the ref_gl.so and ref_glx.so files must owned by root.

The file /etc/kingpin.conf must be installed.  This file contains a single
line with the path of where the ref shared libraries can be found.
A sample one is included that lists /usr/games/kingpin as the default
path.  The libraries are only loaded out of the directory listed in
/etc/kingpin.conf for security considerations.

NOTE:  If you use a setuid Kingpin binary and run it as a normal user, it
will NOT be able to switch renderers on the fly because root permissions
are given up after the renderer is loaded.  You can switch renderers on the
fly if you run Kingpin as root (su or log in as root).

NOTE:  When the Kingpin binary is run in dedicated server mode
(+set dedicated 1), no special permissions are required and
/etc/kingpin.conf is not read since no renderer is loaded.

----

Kingpin will initially try various combinations of ref_gl.so and ref_glx.so
along with the various GL libraries. If it fails to find a working driver,
you can force Kingpin to use a certain combination.

To force the loading of a specific renderer at load time, use the following
command lines:

	./kingpin +set vid_ref soft
	./kingpin +set vid_ref softx
	./kingpin +set vid_ref gl
	./kingpin +set vid_ref glx

My current setup uses a TNT2 card, which works with the enclosed "libTNTgl.so".
Kingpin should automatically try and use this library, however if you have troubles,
try using the following startup line:

	./kingpin +set vid_ref glx +set gl_driver libTNTgl.so


Linux Specific Cvars
--------------------

To set this, use +set on the command line, i.e.:
	./kingpin +set cd_dev /dev/hdc +set sndmono 1

nocdaudio (defaults to 0)
  Do not enable cd audio if not zero

sndbits (defaults to 16)
  Set sound bit sample size.

sndspeed (defaults to 0)
  Set sound speed.  Usual values are 8000, 11025, 22051 and 44100.
  If set to zero, causes the sound driver to attempt speeds in the following
  order:  11025, 22051, 44100, 8000.

sndchannels (defaults to 2)
  Indicates stereo or mono sound.  Defaults to 2 (stereo). Use 1 for mono.

nostdout (defaults to 0)
  Whether to output console msgs to standard out.  Non-zero is cease output.

Dedicated server
----------------

To run Linux Kingpin as a dedicated server, just run it as follows:

  ./kingpin +set dedicated 1 +exec server.cfg

See the server.cfg located in the kingpin/main folder for setting up the game.

To run a dedicated server in the background, use this;

	nohup ./kingpin +set dedicated 1 +exec server.cfg &

A better way is to run Kingpin on a tty via screen.  screen can be found
at ftp://prep.ai.mit.edu/pub/gnu/screen-3.7.4.tar.gz, but it comes with
most modern Linux installations now.

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

Linux Kingpin is an unsupported product.  Usage of this product is bound by
the legal notice found on the distribution Kingpin CDROM.

Ryan Feltrin
ridah@frag.com