.com.unity Forums

.com.unity Forums (http://forum.shrapnelgames.com/index.php)
-   Dominions 3: The Awakening (http://forum.shrapnelgames.com/forumdisplay.php?f=138)
-   -   Utility: Linux Admining (http://forum.shrapnelgames.com/showthread.php?t=30044)

Gandalf Parker September 10th, 2006 10:00 PM

Re: Linux Admining
 
PRE hosting script
------------------

GAME="Armageddon"
DIR="/home/dom3/dominions3/savedgames/"$GAME
WEB="/home/dom3/public_html/games/"$GAME

# make backups
#maybe later I will make it rotating backups
zip -9 $GAME.zip $DIR/*

# blank the log file since it grows by about 5 meg each turn
# this way Im only logging one turn at a time
cp /dev/null $DIR/$GAME.log

# update the viewable copies of the shell files
cp /home/dom3/dominions3/$GAME.sh $WEB/$GAME_sh.txt
cp $DIR/pre_$GAME.sh $WEB/pre_$GAME_sh.txt
cp post_$GAME.sh $WEB/post_$GAME_sh.txt

# mark the time and load at the beginning of hosting
echo pre >>$DIR/system_load.txt
uptime >>$DIR/system_load.txt

Gandalf Parker September 10th, 2006 10:04 PM

Re: Linux Admining
 
POST hosting script
-------------------
$GAME="Armageddon"
DIR="/home/dom3/dominions3/savedgames/"$GAME
WEB="/home/dom3/public_html/games/"$GAME

# mark time and system load after host processing
#and make it available for viewing in the games web dir
echo post >>$DIR/system_load.txt
uptime >>$DIR/system_load.txt
echo " " >>$DIR/system_load.txt
cp $DIR/system_load.txt $WEB/system_load.txt

# rotate the score html files
mv $WEB/scores-4.html $WEB/scores-5.html
mv $WEB/scores-3.html $WEB/scores-4.html
mv $WEB/scores-2.html $WEB/scores-3.html
mv $WEB/scores-1.html $WEB/scores-2.html
mv $WEB/scores.html $WEB/scores-1.html
cp $DIR/scores.html $WEB/scores.html
cp $DIR/stats.txt $WEB/stats.txt

# zip up the debug log and then zero the log
zip -9 $DIR/$GAME.zip $DIR/$GAME.log
mv $DIR/$GAME.zip $WEB/$GAME.zip
cp $DIR/$GAME.log "$DIR/OLD"$GAME".log"
cp /dev/null $DIR/$GAME.log

# email notify players that have asked to be told of turns
cat $DIR/notify.txt |/usr/sbin/sendmail gandalf@example.com
cat $DIR/notify.txt |/usr/sbin/sendmail bogus@example.net

Gandalf Parker September 10th, 2006 10:17 PM

Re: Linux Admining
 
the notify.txt that is sent to players
--------------------------------------

Subject: the Armageddon game processed

Your turn is ready at
dom3minions.com

(courtesy of Gandalf Parker at Any1can.net)

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

the notification could also be changed to include the turn number. It could also easily be changed to include emailing the turn file.

Which makes you automatically think PbEM. If a game had its own email address such as armageddon@dom3minons.com then something like procmail could manage incoming emails to place the .2h files (which means "to host") into the game directory. It could also kick off a script to check for all turns being in and then run/quit the host. This would raise the number of games that a server can run by many levels.

Gandalf Parker September 14th, 2006 05:38 PM

Re: Linux Admining
 
I just realized that maybe this will interest some people....
Gandalf Parker

usage: dom3 [option(s)] [gamename]
options:
-v --version Print version number and exit
-d Increase debug level
-g --host Generate new turn and exit
--verify Verify all 2h-files and exit (creates .chk files)
--statfile Create a player info file after each turn (stats.txt)
--scoredump Create a score file after each turn (scores.html)
--finalhost Generate new turn, send out final score msg and exit
-c --nocredits Disables the end credits
******* Network Options *******
-C --tcpclient Connect to a Dominions multiplayer server
-S --tcpserver Start a Dominions multiplayer server
--ipadr XXX Use this IP-adr when connecting to server
--port X Use this port nbr
--preexec CMD Execute this command before each turn generation
--postexec CMD Execute this command after each turn generation
-t --hosttime X Y Host on day X (0=sunday) hour Y (0-23)
--minutes X Set host interval in minutes
-h --hours X Set host interval in hours
--pauseday X Stop timer on this day (0=sunday)
-q --quickhost Host as soon as all turns are done
-n --nonationsel No nation selection when resuming a network game
--noclientstart Clients cannot start the game during Choose Participants
--uploadtime X Game is created after this many minutes.
--uploadmaxp X Game is created if this many players join.
--closed X Nation closed X=nation number (0-79)
--easyai X Nation ai controlled X=nation number (0-79)
--normai X Nation ai controlled X=nation number (0-79)
--diffai X Nation ai controlled X=nation number (0-79)
--mightyai X Nation ai controlled X=nation number (0-79)
--impai X Nation ai controlled X=nation number (0-79)
******* New Game Options *******
--mapfile XXX Filename of map. E.g. eye.map
--randmap X Make and use a random map with X prov per player (10,15,20)
--research X Research difficulty 0-3 (default 1)
--hofsize X Size of Hall of Fame 5-15 (default 10)
--indepstr X Strength of Independents 0-9 (default 5)
--magicsites X Magic site frequency 0-75 (default 40)
--eventrarity X Random event rarity 1-2, 1=common 2=rare
--totalvp X Vic. points available in the world 0-25
--capitalvp One extra victory per capital
--requiredvp X Vic. points required for victory (default total/2)
--summervp Vic. points are accumulated each summer
--richness X Money multiple 50-300 (default 100)
--resources X Resource multiple 50-300 (default 100)
--supplies X Supply multiple 50-300 (default 100)
--masterpass XX Master password. E.g. masterblaster
--startprov X Number of starting provinces (1-9)
--renaming Enable commander renaming
--noscoregraphs Disable score graphs
--nonationinfo No info at all on other nations
--era X New game created in this era (1-3)
-M --enablemod XXX Enable the mod with filename XXX
******* Random Map Options *******
--makemap XXX Generate a random map with filename XXX and exit
--riverpart X 100 = normal amount of rivers, 0=no rivers
--seapart X Percent of map that is below water level (default=30)
--mountpart X Percent of map that is mountains (default=20)
--forestpart X Percent of lands that are forests (default=20)
--farmpart X Percent of lands that are farm lands (default=15)
--wastepart X Percent of lands that are wastes (default=10)
--swamppart X Percent of lands that are swamps (default=10)
--mapaa Enable antialiasing for random maps
--mapsize W H Set width and height of random map (default=1600 1200)
--mapprov X Set number of provinces (default=150)
--passmount Don't use impassable mountains on random maps
--mapgcol RGBA Ground color 0-255 (default=170 146 116 255)
--mapscol RGBA Sea color 0-255 (default=54 54 130 255)
--mapbcol RGBA Ground border color 0-255 (x4)
--mapsbcol RGBA Sea border color 0-255 (x4)
--mapnoise X Ground color noise 0-255 (default 15)
--borderwidth X Border width 0-500 (default 100)
******* Video Options *******
-w --window Run Dominions 3 in a window
-u --fullscreen Use the entire screen
--bitplanes X Try to use a color depth of X bits per pixel
--zbuffer X Try to use a depth buffer of X bits per pixel (default=16)
-T --textonly Use this with --tcpserver to get graphicless server
--gamma X Set gamma function (brightness) 0.1 - 5.0 (default=1.0)
--opacity X Set gui opacity 0 - 100
-r --res X Y Set screen resolution / window size (default=800 600)
--animback Use animated backgrounds
-a --noanimback Don't use animated backgrounds
--fade Use fade effects
-f --nofade No fade effects
--nopopups No helpful popups
--fps X Aim for this nbr of frames per second (default=20)
--maxfps X Maximum nbr of frames per second (default=50)
--filtering X Quality of OpenGL filtering 0-3 (default=2)
--maxtexsize X Max texture size in pixels 32-4096 (default=unlimited)
--treequal X Tree quality 1-5 (default=3)
--texqual X Texture quality 1-5 (default=3)
--nolightfx No light effects in battles
--partamount X Max nbr of particles 0-8 (0=none, 4=default, 8=max)
--nograss Don't draw the grass
--noarcade Don't draw floating damage numbers
--noglext Don't use any OpenGL extensions
--vsync Enable vsync
-V --novsync Disable vsync
--renderpath X Use different optimizations 0-1 (0=good for low mem cards)
-x --fastgrx Faster graphics (use 3 times for best performance (-xxx))
-p --perftest Run a performance test and exit
******* Audio Options *******
-s --nosound No sound effects or music
-m --nomusic No music
--musicvol X Set music volume, 0-100
--clickvol X Set mouse click volume, 0-100
--defsound Use default sound device
--directsound Use direct sound
--waveout Use waveout for sound
Example: dom3 -wm Run Dominons 3 in a window and without music

Gandalf Parker September 19th, 2006 12:11 PM

Re: Linux Admining
 
OK all of you Linux people. Have fun with THIS one. This is my bl_game.sh for creating small blitz games.
<font class="small">Code:</font><hr /><pre>
#!/bin/bash

OP1=`echo $RANDOM % 79|bc`
OP2=`echo $RANDOM % 79|bc`
OP3=`echo $RANDOM % 79|bc`
for OP in $OP1 $OP2 $OP3
do
if [ $OP -eq 25 ]
then $OP=0
fi
done

PORT=7777
PTtest=1
until [ $PTtest -eq 0 ]; do
PORT=`echo $RANDOM % 1000 + 8000|bc`
PTtest=`netstat -an|grep -c :$PORT`
done

MPASS=`makepasswd`
WURDnum=`echo $RANDOM$RANDOM % 118614 |bc`
WURD=`egrep "^....$|^.....$|^......$|^.......$|^........$|^... ......$" \
/usr/share/dict/words|head -$WURDnum|tail -1`
GAME=bl_$WURD
MAP=eye.map
DIR=~/dominions3/savedgames/$GAME
ERA=$1
if [ -z "$1" ]
then
ERA=`echo $RANDOM % 3 + 1 |bc`
fi

DESC=" era $ERA game $GAME on port $PORT "
echo $DESC
#with $OP1 $OP2 $OP3
# --normai $OP1 --normai $OP2 --normai $OP3 \

dom3 -T --makemap $GAME --mapaa --mapsize 640 480 --mapprov 30
MAP=$GAME.map
echo $DESC
mkdir $DIR

nohup dom3 -g $GAME --port $PORT -ST --statfile --scoredump \
--preexec $DIR/pre.sh --postexec $DIR/post.sh \
--era $ERA --indepstr 6 --hofsize 15 --magicsites 65 \
--renaming --mapfile $MAP --masterpass $MPASS \
-q --hours 24 &gt;$DIR/game.log 2&gt;$DIR/game.err &amp;

echo $DESC &gt;&gt;BLITZ_games.txt

PID=`ps a | grep $GAME | grep dom3 | cut -d" " -f2`
echo "kill -9 "$PID &gt;$DIR/kill.sh
echo $MPASS &gt;$DIR/master.txt
ls -blart /tmp/dominion* |tail -1 &gt;$DIR/tmp.sh
echo " " &gt;$DIR/pre.sh
echo " " &gt;$DIR/post.sh

chmod +x $DIR/*.sh

# to stop the game immeadaitely after start
# unremark the next line
#cp $DIR/kill.sh $DIR/post.sh

echo "mv ~/dominions3/maps/$GAME.* $DIR/" &gt;$DIR/pre.sh
echo "cp /dev/null $DIR/pre.sh" &gt;&gt;$DIR/pre.sh

echo "cp $DIR/game.log $DIR/~game.log" &gt;$DIR/post.sh
echo "cp /dev/null $DIR/game.log" &gt;&gt;$DIR/post.sh
</pre><hr />

Gandalf Parker September 19th, 2006 12:23 PM

Re: Linux Admining
 
Some highlists on that blitz script...

It selects random opponents (presently rem'd out in its use)

It selects a random port and it tests to see if that port is in use

It creates a random password and uses that as the master password for the game

It chooses a random word from the system spelling dictionary and uses that as the game name (some very interesting results have come from that)

It chooses a random era

It creates a random map for the game of 640x480 and 30 provinces. Suitable for a 2 or 3 player blitz game

It creates a game log and a game error file

It adds the games description (game name, port, settings) to a BLITZ_games.txt so that if I whip off 10 quick new games I can just upload that text to announce them

It creates a quick-kill shell in the games directory

It creates pre and post shells.

Sets up the pre shell to move the blitz map to the game directory once the game starts. That saves on cleanup of the games later.

Sets up the post shell to rotate the logs which can get very large depending on how many d's you use on the games command line

Any questions?

Neophyte September 30th, 2006 12:56 AM

Re: Linux Admining
 
Does the IP address need to be specified (in the script) if one is IP forwarding through a firewall? If so, the address needs to be the address that remote clients will be using, correct? I hope I got the terminology right.

Thank's!

Gandalf Parker September 30th, 2006 12:01 PM

Re: Linux Admining
 
I understand your question but Im afraid that I dont know the answer. I dont know of any way to tell the game which IP to run on. I think that when hosting, the game only concerns itself with port. So if the clients address hits the firewall, and the firewall forwards it to the right machine, things should be transparent to the user. But Im afraid thats just guesswork on my part.

By the way, Dom3 handles both IP or domain name for the server. Thats something I have tested quite abit. So Im able to send people to either 63.199.8.158 OR dom3minions.com for a game. (also 63.199.8.157 host.dom3minions.com which I use for blitz games)

Neophyte September 30th, 2006 03:07 PM

Re: Linux Admining
 
Upon reflection, the whole IP thing is probably a switch issue not a computer issue anyhow - i.e. addyX:portZ internally is in all ways equivalent to addyY:portZ externally with IP forwarding setup. Should have thought of this last night, but it was late, and my networking knowledge is sporadic.

Thank's for the reply - I'll test out your scripts once Dom3 shows up hopefully next week.

Gandalf Parker October 14th, 2006 12:08 PM

Re: Linux Admining
 
PbEM scripting has been ironed out. The key is two switches which will start a game hosting automatically. The thread where this was discussed fully is at
http://www.shrapnelcommunity.com/thr...amp;Forum=f187

The switches are:
--uploadtime
--uploadmaxp


All times are GMT -4. The time now is 12:40 AM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2024, Shrapnel Games, Inc. - All Rights Reserved.