                                NetPanzer
                            an open source RTS

Contents:
1. Introduction
2. Building and Installation
3. Gameplay
4. Dedicated Server and Game Configuration
5. Bot Player
6. Contact

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1. Introduction
NetPanzer is an online multiplayer tactical warfare game designed for FAST
ACTION combat. Gameplay concentrates on the core - no resource management is
needed. The game is based on quick tactical action and unit management in
real-time. Battles progress quickly and constantly as destroyed players respawn
with a set of new units. Players can join or leave multiplayer games at any
time.

1.1 A bit of history
The original development of netpanzer was done from PyroSoft inc. In
1999 they stopped development and released the game 2002 in GPL and it was nearly
forgotten, until Ingo announced it at happypenguin.org. Soon after this
announcement a group of coders did the linux port in roughly 2 weeks, with
another 2 weeks polishing for the first release.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

2. Building and Installation



2.1 Prerequesites
The game depends on some tools and libraries to be present, before you can start
building it. Here's a list of them:

* normal gnu compiler and additional tools (g++ version 3.2 or later is
  required at the moment)

* SCons build tool
  http://www.scons.org/

* SDL 1.2.5 or later
  http://www.libsdl.org

* SDL_mixer 1.2.4 or later
  http://www.libsdl.org/projects/SDL_mixer/

* Git (to fetch the source from repository)
  https://git-scm.com/

Thanks to all the authors of these helpful libraries that made our development
easy and straightforward.

To fetch the code source: git clone git://git.code.sf.net/p/netpanzer/git netpanzer-git



2.2 Building without installing on non Windows

To build the game and run as normal user do the following:

# scons

When scons finish without errors the game is ready to play, type this:

# ./netpanzer

Remember that next time you want to play you have to go to the same folder where
you compiled and type './netpanzer'



2.3 Building on Windows

Building on Windows is a little bit more complicated, developers shouldn't have
any big problem.

MinGW should be installed in C:\mingw

Get the development libraries of SDL for mingw32, copy the include directory to
C:\mingw\include\SDL so you have the file "C:\mingw\include\SDL\SDL.h", and the
lib folder to C:\mingw\lib

Get SDL_mixer development libraries for VC8, copy the header file to
C:\mingw\include\SDL and the .lib file to c:\mingw\lib

Python and scons should be installed and working.

To compile netpanzer run scons on the folder where you have the netpanzer source
code:

C:\Some\Folder\With\Netpanzer> scons

After scons finish without errors you have to copy all the .DLL files from SDL
and from SDL_mixer to the netpanzer folder.

To run you can type 'netpanzer' or click on the netpanzer.exe file in explorer.



2.4 Building for distribution on non Windows operating systems

If you plan to distribute NetPanzer for installation (on Linux systems, for example)
there are some extra steps to be taken care.

NetPanzer needs to know where the data files will be stored when the game runs. To
set this data you have to add the parameter "datadir=/some/dir/" at compile time
and NetPanzer will look there for its data files. Example:

# scons datadir=/usr/local/games/netpanzer

Using the sample line, after NetPanzer is built, it will look in /usr/local/games/netpanzer
for it's data files.

For versioning, there is a file called "RELEASE_VERSION", the first line on that file will
be the version that NetPanzer will show. You can use that file to change the version of
the game shown. You should modify the file before compilation.

Actually there is no install script, you will have to prepare the script by yourself.
The installation is actually easy, and you only have to copy several files. The following
directories should be copied on the "datadir" destination:
- cache/
- fonts/
- maps/
- pics/
- powerups/
- scripts/
- sound/
- units/
- wads/

If you want to copy some documentation, the "docs" folder has it. There is also the COPYING
 and the README (this file).

Inside "support" folder there are many useful scripts and resources. 

"netpanzer.png" and "netpanzer.xpm" are some sample icons to be use with the game.

And of course, the file "netpanzer" is the main binary that should be on the PATH.



2.5 Music

Netpanzer doesn't come with own musicfiles yet. However you can place your
favourite .mp3, .ogg or .mod files into the sound/music directory and netpanzer
will play these in random order while you play.



2.6 Starting the game

You can start the game in several ways:

If you compiled yourself NetPanzer (and didn't install), first "cd" to the folder where
you compiled it and type:
# ./netpanzer

If NetPanzer was installed and is in the PATH, type
# netpanzer

It is possible that in your distribution NetPanzer was installed and has a menu item,
if that is the case, just click on the item.

On Windows, you can click on the "netpanzer.exe" file.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



3. Gameplay

An extensive list of commands is available in the Help section of NetPanzer binary,
together with some useful tips and guides.

The same list is available while in game too - just press F1 key.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



4. Dedicated Server and Configuration Files



Checking (setting) up your Network


To run a netpanzer gameserver visible to everybody on the internet you must be able to forward port 3030 to your local PC address.

Generally this can be done in your modem/router control panel (look for the 'NAT' or 'Port Forwarding' section etc). You can google for your router brand manual and follow one of the many tutorials about port forwarding (http://en.wikipedia.org/wiki/Port_forwarding - You might already have done such a thing when configuring Emule or other file sharing tools!). You can obtain more information about your network using command 'ipconfig' in cmd. (start -> run -> type 'cmd' -> type 'ipconfig' ) 'IPv4 address' is your network device address (your machine local address) - 'Default gateway' is likely to be your modem/router address and typing that address in a browser might send you to its control panel.

Also check that Windows Firewall - and/or other antivirus software which may act as firewall - are not interfering.

TIP:  Howto check if your network is ready: start your netpanzer client normally, then choose 'Host' from the top menu (be sure that 'public' checkbox is checked), then 'play'. This is a 'non-dedicated' netpanzer server - e.g. with you inside :). Then open your browser and go to http://www.netpanzer.info/Server-Browser/, wait 30-40 seconds and see if your gameserver appear in the list. If so, your network is ready and you can immediately run a 'dedicated server' without further changes. Otherwise you might need to make some more operations...



Running a dedicated Gameserver


First of all, I strongly suggest you to download the latest Windows snapshot available (run the .exe and install):

The reason I suggest u to use this version is the new menu in Start -> Programs -> Netpanzer which allows you to choose easily among many options - notably u can 'start a dedicated server'.

A new 'terminal' or 'dos' window will appear. That is your netpanzer dedicated server running!
You can type several commands inside this window, like 'status' etc.

After succesfully creating your dedicated server, if you want to connect to it (play) with a separate client, remember to use the LOCAL server IP address (or 'localhost:3030' if it's the same PC).


Restart on crash

Here is a script that restarts the server automatically in case of a crash. This can be achieved with the following script (called start-netpanzer-dedicated.sh).

#!/bin/bash

# insert the directory of the server binary here
DIR=.

cd $DIR
running=yes
while [ $running = "yes" ]; do
    ./netpanzer -d $@
    if [ $? -ge 128 ]; then
        echo "`date`: Restarting server after crash"
        # wait a bit to not blow cpu and logfiles on constant crashs
        sleep 30
    else
        #normal exit
        running=no
    fi
done
        

Screen

Typically you don't always want to monitor your server in a terminal window. Also in case your monitoring terminal terminates the server is normally stopped too. To solve these problems there's a handy little tool called Screen that allows you to run your applications in a virtual terminal to which you can attach/detach at any time.

So typically you write another script with your startup parameters like this (also take a look at the Security Warning at the end of this document for the commented variants).

#!/bin/bash

# insert the directory of the start-netpanzer-dedicated.sh here 
DIR=.

cd $DIR

# starts the server in a screen. Please consider using 1 of the 2 variants below
# for increased security
screen -A -m -d -S netpanzer ./start-netpanzer-dedicated.sh $@

# This version switches to a more secure user account
# screen -A -m -d -S netpanzer su - netpserver -c "./start-netpanzer-dedicated.sh $@"

# This version starts the server in a chroot environment and with a different
# user for even more security
# screen -A -m -d -S netpanzer chroot /home/netpserver su - netpserver -c "./start-netpanzer-dedicated.sh $@"
        


You can attach to this virtual netpanzer terminal by typing screen -r netpanzer. You can detach again by pressing CTRL+A and then CTRL+D. See the Screen documentation for details. 

The code of the server hasn't undergone an in-depth review for security holes yet, so you should expect the possibility that attackers can find buffer overflows to obtain control over the netpanzer executable and the user account the server is running. (Experience shows that this also happens with other servers that claim to be secure...)

Therefore it is recommended to run the server in a special user account with limited rights. On linux/bsd you should also consider using a chroot environment for increased security. Consult external documentation about details. The screen startup script shown above also demonstrates in a comment how to do this with the su and chroot commands. 



Configuring the Gameserver


Let's talk now about the configuration.

In your home directory you will find a folder named .netpanzer .
Inside it, another folder named 'config', and inside that a file named server.cfg .
You might need to run once the dedicated server to generate this file.

This file (you might open it with wordpad) will contain all the entries to configure your dedicated server.

Note: not ALL the entries in server.cfg are related to the server, only those tagged as 'server.' and 'game.' - so let's see in detail the ones which are really important.



        server.port = 3030

	you can select an alternative port number - remember then to make the correct port forward - no reason to change it if u run a single server

	

	server.bindaddress = ""

	leave it blank

	

	server.motd = "Welcome to NetPanzer Server"

	This is the message that appears to players when they connect to gameserver

	

	server.logging = false

	you can save more detailed logs by setting 'true'

	

	server.public = true

	leave it 'true' if u want players to connect from the internet

	

	server.masterservers = "masterserver.netpanzer.org, masterserver2.netpanzer.org, masterserver.netpanzer.info"

	don't change these addresses unless you've been told to do so in our forum

	

	server.name = "NetPanzer Server"

	your gameserver name which will be displayed in server browser etc

	

	game.enable_bases = true

	by setting this to 'false' you disable all bases in the map

	

	game.base_capture_mode = 1

	the kind of base capture, no capture, helipad capture, full base capture

	

	game.base_limit = 0

	max bases per player

	

	game.autokicktime = 20

	kicks inactive player after given minutes

	

	game.allowmultiip = true

	by setting this to 'false' you prevent people with same IP address to connect

	

	game.unit_profiles = "Manta, Panther1, Titan, Stinger, Bobcat, Bear, Archer, Wolf, Drake, Spanzer"

	In this string separated by commas you can decide the available units in a game (the ones u see when u click on top of an outpost u own)

	

	game.unit_spawnlist = "1, 1, 1, 1, 1, 1, 1, 1, 1, 1"

	another comma separated string which must reflect the previous. Here you decide the starting number of units (on respawn)

	

	game.adminpass = ""

	you can set a password to allow admin commands via chat in a game (see the help section in your netpanzer client for a full list of commands)

	

	game.gamepass = ""

	you can set a password players must know to connect to your gameserver.

	

	game.changeflagtime = 15

	timeout for flag change in minutes

	

	game.gametype = 0

	0=objective, 1=frag limit, 2=timelimit

	

	game.maxplayers = 8

	max number of players

	

	game.maxunits = 320

	max number of units (tanks) in the game - which also determines the max number of units per player: maxunits/maxplayers

	

	game.timelimit = 30

	time limit in minutes

	

	game.fraglimit = 300

	frag limit (kills)

	

	game.powerups = true

	enables (or disable) powerups

	

	game.occupationpercentage = 75

	decides outposts percentage to end an objective game

	

	game.allowallies = true

	enables (or disable) ally



        game.anticheat = 3 

        sets the anticheat level (too fast clicking - or rather packet sending) - default is 3 (values allowed are 1 [strict] to 5 [very permissive])
	


        game.lowscorelimit = -25

        players get kicked if their score is less than this value - allowed range is -15 to -100




	game.cloudcoverage = 0

	clouds density

	

	game.respawntype = 0

	0=round robin, 1=random

	

	game.windspeed = 30

	clouds speed

	

	game.map = "Two clans"

	starting map

	

	game.mapcycle = "Two clans"

	map cycle (comma separated list)



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


5. Bot Players

In a new terminal window (Posix) or in the command prompt (Windows) type:

netpanzer -b [gameserver host:port]


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

6. Contact

Bugs should be reported to the netPanzer forum:
    https://sourceforge.net/projects/netpanzer/



