Monday, March 8, 2010

Server Config File

Hi there, I only plan to post once on this blog, but visit it multiple times for if I dont have the file with me anymore. It will have the instructions as to set up a server for TeeWorlds, which all the appropriate files are hosted for you to download at http://www.teeworlds.com/ but I went and made myself a server config file and a batch file so that the server was activated with one click (programmers are the type to spend many hours to save themselves a minute of work 10 times). Well now onto the part why I am doing this, the way to set up a server.

I started with making a batch file. For those who have never touched a batch file before it is surprisingly simple to make a small batch file, mine has 2 lines.

First open up a new notepad document and insert the following:

teeworlds_srv -f my_server_config.cfg
pause

Then save that file in the root directory of teeworlds (where the EXE is), this is the part where you make a batch file, after the name (I called mine start_server so I will refer to it as that from now) you are to type ".bat" as an extension to stop it from being saved as a text file. Before you save you will also have to select 'All Files' in the 'Save as type' section otherwise it will still try to save as a text document.

The next step is to set up the server config file. I called mine my_server_config and is the reason that I have written that name in the batch file, if you desire to call it something else please note that you must make the batch file match, if you right click the batch file and select edit, it should reopen in notepad.

Before I display the config file I would like to mention for those that are unaware, lines with // have everything after the slashes commented out and they do not affect the server in anyway, they are only there to make it more readable.

Below is the config file:

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Death Match Settings //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Server name

sv_name I set up this server thanks to http://teeworlds-server.blogspot.com/


// server message.

sv_motd Play fair and have fun.


// Maps to be played

sv_maprotation dm1 dm2 dm6 dm7 dm8 dm9


// Score to win

sv_scorelimit 20


// Ammount of Minutes in game (0 makes infinite)

sv_timelimit 10


// Death match, capture the flag and team death match (dm, ctf or tdm)

sv_gametype dm


// 1 to include katana, 0 to disable

sv_powerups 1

// Times to play a map before changing

sv_rounds_per_map 1

// Warmup time

sv_warmup 0

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Network Settings //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// Port number for internet play (default: 8303). Remember to allow port forwarding on router!

sv_port 8303


// Remote server control password: remember

sv_rcon_password remember


// people on the server.

sv_max_clients 12


// Note: reduces clients. (e.g. sv_max_clients 12 - sv_spectator_slots 2 = 10 people playing)

sv_spectator_slots 2


// 1 to advertise on the net, 0 to not.

sv_register 1


// Optimises packets for local play (make this the opposite of sv_register)

sv_high_bandwidth 0


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Extra Information //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// Capture the flag rotation default maps: ctf1 ctf2 ctf3 ctf4 ctf5
// Death Match (+TDM) rotation default maps: dm1 dm2 dm6 dm7 dm8 dm9

// More information can be found at the following web pages:

// http://www.teeworlds.com/?page=docs&wiki=ServerSettings
// http://www.teeworlds.com/?page=docs&wiki=SettingUpAServer
// http://www.teeworlds.com/?page=docs&wiki=ServerTuning (See below for WARNING)
// http://www.teeworlds.com/?page=docs&wiki=ServerCommands

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Modding //
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// To fiddle with the following settings set sv_gamemode to mod.
// Then uncomment the tune commands you want and change the values

/////////////////////////////////////////////////////////////////////////////////////
// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING //
/////////////////////////////////////////////////////////////////////////////////////
// //
// WARNING: using this game mod mode without advertising it can result in a BAN!!! //
// For this reason I recomend only modding for LAN games or when //
// you know you are following all of the rules. To learn more visit: //
// //
// http://teeworlds.com/?page=banned //
// //
/////////////////////////////////////////////////////////////////////////////////////
// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING //
/////////////////////////////////////////////////////////////////////////////////////

// Physics

// tune ground_control_speed 10.0
// tune ground_control_accel 2.0
// tune ground_friction 0.5
// tune ground_jump_impulse 13.2
// tune air_jump_impulse 12.0
// tune air_control_speed 5.0
// tune air_control_accel 1.5
// tune air_friction 0.95
// tune hook_length 380.0
// tune hook_fire_speed 80.0
// tune hook_drag_accel 3.0
// tune hook_drag_speed 15.0
// tune gravity 0.5
// tune velramp_start 550.0
// tune velramp_range 2000.0
// tune velramp_curvature 1.4
// tune player_collision 1
// tune player_hooking 1


// Weapons

// tune gun_curvature 1.25
// tune gun_speed 2200.0
// tune gun_lifetime 2.0
// tune shotgun_curvature 1.25
// tune shotgun_speed 2750.0
// tune shotgun_speeddiff 0.8
// tune shotgun_lifetime 0.20
// tune grenade_curvature 7.0
// tune grenade_speed 1000.0
// tune grenade_lifetime 2.0
// tune laser_reach 800.0
// tune laser_bounce_delay 150.0
// tune laser_bounce_num 1.0
// tune laser_bounce_cost 0.0
// tune laser_damage 5.0


Now its time to save the config file, like with the batch file it is important to have the correct extension and check that you are saving as 'All Files'. A config file for teeworlds saves with the extension ".cfg", if you have directly copied from this web page to create the batch file you will name the config file "my_server_config.cfg", and this also goes in the directory that the teeworlds.exe file is located.

Once that is saved the batch file should run properly but it will not be able to create a server if you have not enabled port forwarding on your router. Teeworlds uses the port number 8303 with upd protocols, to do this is not difficult, log onto your router (if you are unaware of how to do this read the bottom of this post) and find port forwarding, as each router has a different setup for this I can only be vauge. For my router it is in Advanced->Port Forwarding, and to make a new one I have to go to a user setting to avoid all the preset ones and click add, then activate it once it is saved and that requires a router reset. The fields that it is likely to ask for are a name (Teeworlds) the start and end port numbers (8303 for both) and a port map (also 8303). Another thing to note is what IP address you are setting up the server on as it might ask (also explained below).

Well that is about it, I hope that is enough explanation as that is all I did to set up my server, if you have any problems after this feel free to leave a comment, although don't be surprised if it takes me a few days to reply.



Now for the router and IP address explanations:

To find out the IP address of both you and you router open up command prompt and type:

ipconfig

this will show you some information on the network setting of your computer.

The Default Gateway is you router address and I will mention more on that in a minute and the IP address is you computers address, if you are using vista or later it is likely that what you are looking for is IPv4 because most private networks will use that until the end of time (like the way I am future-proofing my blog with an assumption?), you will only need this if your router asks with port forwarding as explained above.

To gain access to your router go to the address found in Default Gateway by typing it into the address bar of a web browser (internet explorer, mozilla firefox, google chrome, opera, safari ect.). You should then be prompted for a username and password, the default of these is often 'admin' for both, but yours may not be. If you think no password has been set you should go look at your router and google for the default password for the brand and model number, if that does not work you will need to find the person who set up the router and ask them for the username and password. Once you gain access follow the instructions above.



I hope this has helped you as I know it will help me when I am at someone elses house who wants to play teeworlds on a LAN and I forgot to bring my config files (has happened before).


-Trent