User:Deej
http://www.fragland.org/deej/572.gif
Guilty for founding the Retired Old Farts which provide:
- ETPro servers
- ETTV servers
- ETPub servers
- General annoyance
- Pub requests for a compition mod
My interpretation of ETTV setups
Since I'm quite fond of toying around with new developments, I'm always one of the first to test new ETTV / ETPro releases and bug bani with questions about them. Having said that, here's my 'personal' view on a good ETTV broadcast (this is not the Bible!):
There are 5 different "participants" possibly involved in an ETTV broadcaster:
- Master - the gameserver hosting the actual game
- Viewer - the viewer wanting to view a game (duh)
- Broadcaster - a server that is directly connected to a gameserver and allows viewer to connect directly to itself
- Hub - a server that is directly connected to a gameserver and allows other ETTV 'slaves' to connect to itself, but not viewers
- Slave - a server that connects to a hub or perhaps a broadcaster and and allows viewers to connect to itself
Keep this terminology in mind when you stroll through my text ;-).
Now ideally a good broadcast model would look like this:
Viewer -> Slave -> Hub -> Master
Sounds simple doesn't it? Well in theory yes but in practice there must be something wrong since most ETTV games I see still do this:
Viewer -> Broadcaster -> Master
If you remember that an ETTV server connects at an unlimited rate to another server, you might see a problem arising when lots of people would like to see a "big match".
The trouble was / is that before ETTV b8 and 'autodelay', we had to do some fancy flying to get a delayed broadcast or delayed hub up. Usually you would start a 'recorder' daemone that recorded demos and a 'playback' daemon from that same directory, so it played back the recorded demo after roughly 60 seconds. This does require fancy scripting and lots of manual work to sort out demos, connect slaves to hubs etc...
With ettv_autodelay, things have become a lot easier. Ideally the gameserver now only allows 2 or 4 ETTV hubs to connect to it, which delay and relay the signal. The responsibility for the admins of the hub is of course greater as they should not have any PK3s active on their hubs that are not on the pure list of the server.
The best setup IMHO is now to have:
Viewers -> Slave 1 |
Viewers -> Slave 2 |
Viewers -> Slave 3 |--> Hub 1 |
|--> Hub 2 | --> Master
Viewers -> Slave ... |--> Hub n |
|
Viewers -> Slave n |
This alleviates the load on the Master firmly as only 2 or 4 hubs are required where slaves can then connect to!
Some scripts I use
Hub script
This script launches a hub that delays its feed by x seconds, configurable inside the script. You can safely remove the stuff like PERONI_IP, FRAGLAND_IP etc... at the beginning since those only store the IPs of the root servers we manage (it's easier for me to keep track of them that way).
How do you use this script? Copy / paste this script and save it as hub.sh or any other name you prefer. Then use ./hub.sh start to start and ./hub.sh stop to stop your hub.
Be aware that it's much better to actually do "quit" in the console of your hub instead of ./hub.sh stop as this cleanly disconnects the hub from a game server. With ./hub.sh stop the hub stays with ping 999 on the gameserver and needs to time out. Maybe we should ask Bani to improve POSIX signal interpretation of the ETTV binary :-).
#!/bin/bash
#################################################################
# #
# reT!reD.ettv delayed hub script #
# - #
# reT!reD.deej #
# #
#################################################################
# #
# This script can be used to start up a delayed ETTV stream #
# where ETTV slaves connect to the hub to relay the signal. #
# #
# The daemon serves as a hub for other ETTV slaves to connect #
# to and as such alleviate the load on the game server hosting #
# the match. #
# #
# This script creates a subdirectory which represents the #
# date of the match and stores the demos in this subdir. #
# #
# The script launches the daemon in a different screen #
# which you can reattach with "screen -r hub". #
# #
# Credits: #
# - Daita (pourix.net) for the original idea & script #
# - Tony J. White (et.tjw.org) for his ETDED on Linux guide #
# - aNgel (fragland.org) for debugging Beavis' mistakes ;-) #
# #
# Questions? Contact me on deej@fragland.org or go to #r0f.et #
# #
#################################################################
# #
# http://www.fragland.org #
# #
#################################################################
# Webperoni Game Server IP
# ettv.fragland.org
PERONI_IP="83.133.81.192"
# Deinprovider WebServer IP
# ettv2.fragland.org
FRAGLAND_IP="217.20.115.116"
# Ionmedia Game Server IP
# ettv3.fragland.org
IONMEDIA_IP="62.216.174.68"
# Hetzner Game Server IP
# WServer2.ath.cx IP
# ettv4.fragland.org
HETZNER_IP="213.239.207.195"
# Planet Hosting Game Server IP
# ettv5.fragland.org
PLANET_IP="85.190.1.13"
#################################################################
# #
# Start Modifying From Here #
# #
#################################################################
#
# Parameters of the Game Server to Connect to
#
# IMPORTANT: Let the admin of the game server do
# "fdir *.pk3" in his console and give you the output!
#
# PK3 mismatches between game server and ETTV hosts
# account for the majority of crashes of ETTV.
#
MATCH_DATE=`date +%Y%m%d` # Do NOT modify
MATCH_HOST="et.fragland.org:27965" # Match server port & address
MATCH_ETTV_PASS="[putpasshere]" # Match server ETTV password
MATCH_PASS="[putpasshere]" # Match server password
#
# IPs & Ports For Your Host
#
THISHOST_IP=$PERONI_IP # Replace with your IP
HUB_PORT="50000" # Port of the public hub for ETTV slaves
#
# Hostnames & ETTV Client name
#
# - hostname shows up in server browsers
# - ETTV client name shows up as the name
# of your server in the game server.
#
HUB_HOSTNAME="^7reT^1!^7reD^1.^7ettv ^7hub ^1#^71"
ETTV_CLIENT=$HUB_HOSTNAME
#
# Passwords
#
HUB_RCON_PASS="[putpasshere]"
HUB_PRIVATE_PASS="[putpasshere]"
HUB_ETTV_PASS="[putpasshere]"
HUB_PASS="[putpasshere]"
#
# Directories
#
BASEPATH="/srv/et/ETTV/ettv_hub" # Path to ettv.x86. Use absolute paths!
#
# ETTV Net settings for ETTV b8 & up
#
ETTV_NETBLAST="1" # Sends all packets as one big one
ETTV_TV_IPTOS="0"
ETTV_SV_IPTOS="0"
ETTV_MTU="1400" # Only increase when ettv_netblast is 0
#
# Other relevant ETTV settings
#
SHOUTCAST_DELAY="60" # Delay between live match & broadcasting hub in seconds
HUB_SLAVES="8" # 1 ETTV slave connects at an UNLIMITED rate to the hub!
ALLOW_DL="0" # Allow downloading (only works for viewers on slaves)
ALLOW_WWW_DL="0" # Allow downloading over http?
WWW_DL_URL="http://www.yoursite.com" # Do not append a "/" at the end!
#
# User To Launch Daemon
#
# Good practice:
# What doesn't need root priviliges doesn't get them!
#
# User gamed mentioned here under is not a standard linux user,
# he was created on our systems by us.
#
# gamed can not log in. His homedir is equal to the path
# where all our servers are installed.
#
USER="gamed"
#################################################################
# #
# STOP Modifying Here #
# #
#################################################################
#
# Assembling the Command Line
#
HOMEPATH="$BASEPATH/$MATCH_DATE"
BINARY="ettv.x86"
DAEMON="$BASEPATH/$BINARY"
HUB_OPTIONS="\
+set fs_game etpro \
+set dedicated 2 \
+set net_ip $THISHOST_IP \
+set net_port $HUB_PORT \
+set fs_basepath $BASEPATH \
+set fs_homepath $HOMEPATH \
+set com_hunkMegs 128 \
+set g_password $HUB_PASS \
+set rconpassword $HUB_RCON_PASS \
+set sv_hostname $HUB_HOSTNAME \
+set sv_maxclients $((HUB_SLAVES+2)) \
+set sv_maxRate 25000 \
+set sv_allowDownload $ALLOW_DL \
+set sv_wwwDownload $ALLOW_WWW_DL \
+set sv_wwwBaseURL "$WWW_DL_URL" \
+set sv_wwwDlDisconnected 0 \
+set g_log "hub.log" \
+set logfile 2 \
+set b_ettv_flags 3 \
+set ettv_autorecord 1 \
+set ettv_clientname $ETTV_CLIENT \
+set ettv_sv_maxslaves $HUB_SLAVES \
+set ettv_password $HUB_ETTV_PASS \
+set ettv_netblast $ETTV_NETBLAST \
+set ettv_tv_iptos $ETTV_TV_IPTOS \
+set ettv_sv_iptos $ETTV_SV_IPTOS \
+set ettv_mtu $ETTV_MTU \
+set ettv_delay $SHOUTCAST_DELAY \
+tv connect $MATCH_HOST $MATCH_ETTV_PASS $MATCH_PASS"
#
# Functions
#
hub_start () {
#
# FYI'ing the user
#
echo -n "Match Date is "
echo -n "$MATCH_DATE"
echo -e ".\nDemos are stored in $HOMEPATH/etpro/demos/.\n"
echo -n "Starting Hub: "
screen -dmS hub su -m -c "$DAEMON $HUB_OPTIONS" - $USER
sleep 1
echo -e "done.\n"
echo -e "Getting PID...\n"
get_pids
echo -n "Hub has PID "
echo -e "$HUB_PID\n"
echo "ETTV slaves can now connect to your box by issuing:"
echo -e "tv connect $THISHOST_IP:$HUB_PORT $HUB_ETTV_PASS $HUB_PASS\n"
}
hub_stop () {
#
# Refresh the PIDs
#
get_pids
echo -n "Shutting Down Hub: "
sleep 1
if [ $HUB_PID ]
then
kill -3 $HUB_PID
echo -e "done."
else
echo -e "failed.\nHub wasn't active anymore.\n"
fi
sleep 1
}
get_pids (){
#
# We used to launch the same binary twice so pidof didn't work.
# As from beta 8 ettv delayed feeds were automatic so
# no more fancy scripting tricks are required :-)
#
HUB_PID=`pidof $DAEMON`
}
clean_up (){
#
# Clean up prompt
#
echo -n "Clean up demos directory [y/n]? "
read ANSWER
case "$ANSWER" in
y)
rm -Rf $BASEPATH/$MATCH_DATE
ls -l --color=always $BASEPATH
;;
*)
echo "Following demos still exist:"
ls -l --color=always $BASEPATH/$MATCH_DATE/etpro/demos/
;;
esac
}
#
# Performing The magic :-)
#
case "$1" in
start)
hub_start
;;
stop)
hub_stop
clean_up
;;
*)
SCRIPT_NAME=`basename $0`
echo "Usage: $SCRIPT_NAME {start|stop}"
exit 1
;;
esac
exit 0
Slave script
Will add this later
deej 11:38, 5 November 2005 (PST)