Feed on Posts or Comments 11 March 2010

Monthly ArchiveOctober 2007



Games Wytze on 18 Oct 2007

Team Fortress 2 – Dedicated Server

Ok, in this short tutorial I will show you how to set up a TF2 dedicated server on a windows machine.

  1. Download the HLDS Update Tool from the Steam site.
  2. Run the tool to get it installed.
  3. Create a directory for steam, the game files will be created in this directory.
  4. Run the hldsupdatetool executable: (I ran a windows installation, but linux will be similar)

    Windows command:

    HldsUpdateTool.exe 
        -command update 
        -game tf 
        -dir <directory name created in step 3, surround with quotes if spaces are in it>

    Linux command:

    ./steam 
        -command update 
        -game tf 
        -dir <directory name created in step 3, surround with quotes if spaces are in it>

    You can use the same command when you need to update your server to the latest version.

  5. This will take some time, grab a beer, a cup of coffee, or something else that will help you relax.
  6. Don’t relax too much! You might get some ‘Connection reset by peer’ exceptions. Don’t worry, just rerun the same command again and again and again and again until finally you have received all files.
  7. Create a server.cfg file in the orangebox/tf/cfg directory.
  8. Fill it with some basic info. See a small example below.
  9. // The name of your server shown in the server browser
    hostname "TF2 Server"
    // Server e-mail contact
    sv_contact youremail@here.com
    // Password used for remote console access
    rcon_password "asillypassword"
    // If you are having trouble connecting with rcon try enabling the rcon_address line.
    // Also make sure your ports are forwarded (tcp: 27000-27020)
    // rcon_address "your_ip_address"
    // 1 for private LAN, 0 for internet play
    sv_lan 1
    // Region that the server is located in
    // U.S. East - sv_region 0
    // U.S. West - sv_region 1
    // South America - sv_region 2
    // Europe - sv_region 3
    // Asia - sv_region 4
    // Australia - sv_region 5
    // Middle East - sv_region 6
    // Africa - sv_region 7
    // Rest of the World - sv_region 255
    sv_region 3
    // Network settings
    sv_mincmdrate 30
    sv_minupdaterate 20
    sv_maxcmdrate 100
    sv_maxupdaterate 100
    sv_maxrate 100000
    sv_minrate 1000
    //sv_unlag 1 Unknown Command
    // Enforces fair and optimal settings
    sv_client_predict 1
    sv_client_interpolate 1
    sv_client_min_interp_ratio 1.0
    sv_client_max_interp_ratio 2.0
    sv_client_cmdrate_difference 30
    // External download server
    // sv_downloadurl "http://yoursite.com/cstrike"
    // Max download size of 100 MB
    net_maxfilesize 100
    // mp_capstyle (Sets the style of capture points used. 0 = Fixed players required to cap. 1 = More players cap faster, but longer cap times)
    // mp_respawnwavetime (Time between respawn waves)
    // mp_capdeteriorate_time 90.0 (Time it takes for a full capture point to deteriorate)
    // mp_teams_unbalance_limit (Teams are unbalanced when one team has this many more players than the other team. (0 disables check))
    // mp_bonusroundtime (Time after round win until round restarts)
    // mp_winlimit (Max number of rounds one team can win before server changes maps)
    // mp_stalemate_timelimit (Timelimit (in seconds) of the stalemate round.)
    // mp_switchteams (Switch teams and restart the game)
    // mp_scrambleteams (Scramble the teams and restart the game)
    // mp_forcerespawnplayers (Force all players to respawn.)
    // mp_disable_respawn_times (Disable respawn timer)
    // mp_timelimit (Set timelimit for map)
    // mp_maxrounds (Set number of rounds before reset. Mutually exclusive with mp_timelimit. So if this is enabled disable the mp_timelimit)
    // mp_tournament (Enable or Disable tournament mode)
    // tf_weapon_criticals (Enable or disable weapon crits)
    // tf_flag_caps_per_round (Number of flag caps before round ends)
  10. Create a shortcut to the srcds.exe executable in the /orangebox directory
  11. Edit the shortcut and change the startup command to look like something like this
  12. "C:\Program Files\Valve\HLServer\orangebox\srcds.exe" -game tf -console +exec server.cfg +maxplayers 24 +map ctf_2fort

    This will make the server run the TF2 game, with console enabled and it will execute the server.cfg file we created. Next to that it will set the player limit to 24 and load the map ctf_2fort at startup.

  13. Start the server by running the shortcut

Please note that you can also create custom map cfg files which will run automatically when a mapchange occurs. Eg: If you have the map cp_dustbowl you could create a custom cp_dustbowl.cfg file and place it in the cfg directory and it will be auto-executed when the level is loaded. This will enable you to use settings that are map specific.

The next part in this tutorial will describe how to install MetaMod:Source and SourceMod on your (TF2) dedicated server.

MetaMod and SourceMod are plugin API’s/frameworks that will allow you to run custom administration/game plugins on your server.
Visit this link to see what mods are available for SourceMod.

  1. Visit this page and follow the directives there. Be sure to download the a version >= 1.6 of MetaMod:Source.
  2. Go to the SourceMod site and download the latest release. Then follow the directives found here.

If you got SourceMod running you can install any plugins you like. Have fun!

Games Wytze on 16 Oct 2007

Team Fortress 2

Team Fortress 2

Last week I bought this really cool game created by Valve.

There is a total of nine character classes to choose from.
Although it is nice to all be soldiers a good mix of classes in your team might mean victory.

I will state some advantages and disadvantages here which might help you pick a class. I will work this one from left to right according to the image displayed here.

  1. Pyro
    • + Spray ‘n pray comes to life with this dude
    • + Burn damage over time
    • + Good against groups standing close together
    • - Limited range
  2. Engineer
    • + Good support class
    • + Can build Sentry Guns, Dispensers (health, ammo, mechanical parts) and Teleporters
    • - Not good as offensive class
  3. Spy
    • + Can sneak behind enemy lines to do mass damage
    • + Cloaking
    • + Backstabbing and Sabotaging mayhem
    • - Servers with FF off will often shoot you in the head when approaching their base
  4. Heavy Weapons Guy
    • + Loads of damage
    • + Health
    • - Slow moving, especially when shooting the minigun
  5. Sniper
    • + Good defensive unit
    • + Effective on long range
    • - Vulnerable on short range
  6. Scout
    • + Good for reconnaissance
    • + Fast moving
    • + Can capture control points quickly
    • - Limited damage
  7. Soldier
    • + Good allround class
    • + Can perform rocket jumps which might give a tactical edge

    Hint: Aim rockets at the ground to prevent enemies from dodging your rockets

  8. Demoman
    • + Good defensive class
    • + Can placy sticky bombs and remotely detonate them.
    • + Can launch grenades around corners and other places one could otherwise not reach
    • - Vulnerable at short range
  9. Medic
    • + Exceptionally good support class
    • + Can support the other classes by healing.
    • + When enough healing has been performed the ubercharge will become ready which grants the medic and its target invulnerability for a short period of time. Exellent in combination with a Heavy Weapons Guy for example.

    Hint: Healing more injured teammates fills your ubercharge quicker

You could also take a look at the Wikipedia page of Team Fortress 2 for additional information.

Coding & General Wytze on 12 Oct 2007

MoBlock and Hamachi

After installing moblock (a p2p guardian program) I found that my hamachi was no longer working. :(

To fix this I had to modify the moblock.conf file in the /etc/moblock directory.
I did so by specifying a network address with a netmask.

Hamachi’s ip-range starts with a 5. So the address would be 5.0.0.0
The netmask is 255.0.0.0 to allow all hamachi ip’s to connect. Because 255.0.0.0 means we have 8 bits on 1. The line becomes: 5.0.0.0/8

Add this line to the IP_TCP_IN line for example and restart moblock with moblock-control restart. After I did this I was able to reconnect with my linux server from hamachi. Hurray!

[update]Ok, maybe you also want to add LOGMEIN to your ignore block list. :S
Do so by changing the IP_REMOVE line into IP_REMOVE=”LOGMEIN”.
Do a moblock-control reload after this to reload the new configuration[/update]

Coding Wytze on 11 Oct 2007

Eclipse search and destroy

Eclipse (Popular IDE) offers the possibility to do ’search and replace’ with regular expressions. Today this came in quite handy as I had to change a large amount of sql insert statements into sql update statements.

Although loading the file of 4MB took quite some time (probably because of the syntax highlighting eclipse was trying to apply) the file could be loaded. After that I opened the search & replace option from the menu and started creating something that looked like a regular expression.

Here is one line of the original input:

INSERT INTO MEDIA (MEDIA_ID,UPLOADFILE_FILENAME,UPLOADFILE_FILESIZE,UPLOADFILE_HEIGHT,UPLOADFILE_WIDTH)
VALUES (1579,'1579.jpg',1095082,2575,4075);

This is the regex I came up with:

.*?\(.*?\((\d+),(.*?),(\d+),(\d+),(\d+)\)\;

I had it replaced with:

update MEDIA
set UPLOADFILE_FILENAME=$2, UPLOADFILE_FILESIZE=$3,UPLOADFILE_HEIGHT=$4,UPLOADFILE_WIDTH=$5
where MEDIA_ID=$1;

Worked like a charm. The lines now looked like this:

UPDATE MEDIA
SET UPLOADFILE_FILENAME='1579.jpg', UPLOADFILE_FILESIZE=1095082,UPLOADFILE_HEIGHT=2575,UPLOADFILE_WIDTH=4075
WHERE MEDIA_ID=1579;

Seems like abracadabra? Well it is, since the outcome was magical. :)

Coding Wytze on 10 Oct 2007

java.sql.SQLException: No suitable driver

After trying to set up Maven2 with Spring 2, Hibernate 3 (with annotations) I tried to configure the maven2 hibernate3 plugin so the schema could be exported for manual creation.

Then it hit me, a:

java.sql.SQLException: No suitable driver

I didn’t get this one before when using XDoclet2 to generate the hbm.xml files and schema-export for me. I did some research on the net and found out that the calling program is verifying the jdbc url against all available drivers. When none of the drivers accepts the jdbc url the above error is thrown. It’s good to know that the jdbc drivers are loaded dynamically.

Knowing this solved the puzzle: Either the jdbc url was not ok or the driver was not loaded at the point of the schema-export. The latter was the case. By adding the jdbc jar to the classpath I could luckily fix this issue. Maybe I should have done so in the first place. Well at least I learned something from all this and I hope you will too by reading this.

Here is a small snippet of my pom.xml for maven2. The db-properties are read from the META-INF/persistence.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!-- Hibernate3 Plugin, used for creating SQL statements for table creation -->
<plugin>
	<groupid>org.codehaus.mojo</groupid>
	<artifactid>hibernate3-maven-plugin</artifactid>
	<version>2.0-SNAPSHOT</version>
	<configuration>
		<executions>
			<execution>
				<phase>process-classes</phase>
				<goals>
					<goal>hbm2ddl</goal>
				</goals>
			</execution>
		</executions>
		<components>
			<component>
				<name>hbm2ddl</name>
			</component>
		</components>
		<componentproperties>
			<implementation>jpaconfiguration</implementation>
			<!-- Output in pretty format -->
			<format>true</format>
			<!-- Do not create drop statements -->
			<drop>false</drop>
			<!-- Generate script -->
			<text>true</text>
			<!-- Do not output sql to screen -->
			<quiet>false</quiet>
			<!-- Do not export tables into database -->
			<export>false</export>
			<outputfilename>
				schema-export.sql
			</outputfilename>
		</componentproperties>
	</configuration>
	<dependencies>
		<!-- Necessary to be able to connect to db -->
		<dependency>
			<groupid>local</groupid>
			<artifactid>oracle-classes</artifactid>
			<version>1.2</version>
		</dependency>
	</dependencies>
</plugin>

Hardware Wytze on 09 Oct 2007

A new monitor on the horizon

Samsung 226CWAfter I used my energy meter on my monitor I found out it used a total of ~75W to display all kinds of neat stuff on my screen. Because it was a CRT I decided it was time for something new. So I ordered this new monitor with a specified power usage of 45W max. Well this baby is going to earn itself back while I will also get some more space on my desk. :)

Specifications

Hardware Wytze on 04 Oct 2007

Managing the electricity bill

Energy Cost Meter

Ok I wasn’t actually looking into saving a quick buck but well good things happen sometimes. ;)

I bought this meter to measure how much power an electronic device uses. I was especially interested in my new VIA Epia board. It measured a mere 17W average after booting. I was quite satisfied by the results at this point. (Via Epia EK8000EG, 1GB Kingston RAM, Samsung 2.5″ 120GB hdd)

Less satisfied I was with my printer, a HP 7310 which apparently still used 9W while being turned off completely. Quite angry I pulled the electrical cord, no more power flowed towards this device now. A short click was the last response it gave to my action…