summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'games-fps/ut2003-demo/files')
-rw-r--r--games-fps/ut2003-demo/files/benchmark37
-rw-r--r--games-fps/ut2003-demo/files/results.py61
-rw-r--r--games-fps/ut2003-demo/files/results.sh79
-rw-r--r--games-fps/ut2003-demo/files/ut2003-demo30
4 files changed, 207 insertions, 0 deletions
diff --git a/games-fps/ut2003-demo/files/benchmark b/games-fps/ut2003-demo/files/benchmark
new file mode 100644
index 000000000000..2047897da9ab
--- /dev/null
+++ b/games-fps/ut2003-demo/files/benchmark
@@ -0,0 +1,37 @@
+#!/bin/sh
+# Originally from linuxforen.de
+# Modified by phoen][x <phoenix@gentoo.org>, Sep/19/2002
+# Modifications, enhancements or bugs? Mail me.
+
+# Tweaks by Daniel Robbins <drobbins@gentoo.org> 25 Feb 2003
+
+STUFF=GAMES_PREFIX_OPT/ut2003-demo/Benchmark/Stuff
+MYPATH=${HOME}/.ut2003/Benchmark
+TEMPLOG=${MYPATH}/benchmark.log
+LOG=${MYPATH}/bench.log
+
+[ -d ${MYPATH} ] || mkdir -p ${MYPATH}
+
+rm -f ${TEMPLOG} ${LOG}
+touch ${TEMPLOG} ${LOG}
+
+date > $LOG
+
+echo ">> Starting benchmark"
+cd GAMES_PREFIX_OPT//ut2003-demo/System
+for BENCH in GAMES_PREFIX_OPT//ut2003-demo/Benchmark/*-*.sh
+do
+ echo "Running ${BENCH} with MinDetail"
+ ${BENCH} -ini=${STUFF}/MinDetail.ini -userini=${STUFF}/MinDetailUser.ini &> /dev/null
+ echo -n "${BENCH} / MinDetail / " >> ${LOG}
+ cat ${TEMPLOG} | tail -n1 >> ${LOG}
+
+ echo "Running ${BENCH} with MaxDetail"
+ ${BENCH} -ini=${STUFF}/MaxDetail.ini -userini=${STUFF}/MaxDetailUser.ini &> /dev/null
+ echo -n "${BENCH} / MaxDetail / " >> ${LOG}
+ cat ${TEMPLOG} | tail -n1 >> ${LOG}
+done
+
+echo ">> Benchmark complete"
+GAMES_PREFIX_OPT/ut2003-demo/Benchmark/results.sh
+echo ">> Use 'ut2003-demo --results' to show these results again (without benchmarking)"
diff --git a/games-fps/ut2003-demo/files/results.py b/games-fps/ut2003-demo/files/results.py
new file mode 100644
index 000000000000..3e626239129d
--- /dev/null
+++ b/games-fps/ut2003-demo/files/results.py
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+# Written by phoen][x <phoenix@gentoo.org>, Sep/19/2002
+# Modifications, enhancements or bugs? Mail me.
+import sys
+
+def help():
+ print "Usage"
+ print " results.py logfile"
+
+def stats(data,mode):
+ print(
+""">> Score for %s
+MinDetail: %f (%d tests)
+MaxDetail: %f (%d tests)
+Average : %f (%d tests)
+""" % (mode,data[0][0]/data[0][1],data[0][1],data[1][0]/data[1][1],data[1][1],
+ (data[0][0]+data[1][0])/(data[0][1]+data[1][1]),data[0][1]+data[1][1]))
+
+args = sys.argv[1:]
+if "--help" in args:
+ help()
+else:
+ if len(args):
+ file = args[0]
+ else:
+ import user
+ file = "%s/.ut2003/Benchmark/bench.log" % user.home
+ try:
+ myfile = open(file)
+ date = myfile.readline()
+ print(">> Results of the UT2003-demo benchmark")
+ print(">> created on %s" % date)
+
+ botmatch = ([0,0],[0,0])
+ flyby = ([0,0],[0,0])
+
+ for line in myfile.readlines():
+ results = line.split()
+ category = results[0].split("-")[0]
+
+ if results[2] == "MinDetail":
+ detail = 0
+ elif results[2] == "MaxDetail":
+ detail = 1
+ else:
+ assert "Neither MinDetail nor MaxDetail?"
+
+ if category == "botmatch":
+ botmatch[detail][0] += float(results[13])
+ botmatch[detail][1] += 1
+ elif category == "flyby":
+ flyby[detail][0] += float(results[13])
+ flyby[detail][1] += 1
+ else:
+ assert "Neither botmach nor flyby?"
+
+ stats(botmatch,"Botmatch")
+ stats(flyby,"FlyBy")
+
+ except IOError:
+ print("Unable to open file %s" % file)
diff --git a/games-fps/ut2003-demo/files/results.sh b/games-fps/ut2003-demo/files/results.sh
new file mode 100644
index 000000000000..a74cf909c9ad
--- /dev/null
+++ b/games-fps/ut2003-demo/files/results.sh
@@ -0,0 +1,79 @@
+#!/bin/bash
+# Written by phoen][x <phoenix@gentoo.org>, Sep/21/2002
+# Modifications, enhancements or bugs? Contact games@gentoo.org
+
+[[ -z "${1}" ]] \
+ && FILE="${HOME}/.ut2003/Benchmark/bench.log" \
+ || FILE="${1}"
+
+CURLINE=0
+
+BM_MIN_SCORE=0
+BM_MIN_COUNT=0
+BM_MAX_SCORE=0
+BM_MAX_COUNT=0
+
+FB_MIN_SCORE=0
+FB_MIN_COUNT=0
+FB_MAX_SCORE=0
+FB_MAX_COUNT=0
+
+while read LINE ; do
+ CURLINE=`expr $CURLINE + 1`
+ if [[ ${CURLINE} -eq 1 ]] ; then
+ echo ">> Results of the UT2003-demo benchmark"
+ echo ">> Created on ${LINE}"
+ continue
+ fi
+
+ set -- ${LINE}
+ TYPE=$(echo $(basename ${1}) | cut -d- -f1)
+ DETAIL=${3}
+ SCORE=${14}
+
+ case ${TYPE} in
+ "botmatch")
+ case ${DETAIL} in
+ "MinDetail")
+ BM_MIN_SCORE=`echo ${BM_MIN_SCORE} + ${SCORE} | bc`
+ BM_MIN_COUNT=`expr ${BM_MIN_COUNT} + 1`
+ ;;
+ "MaxDetail")
+ BM_MAX_SCORE=`echo ${BM_MAX_SCORE} + ${SCORE} | bc`
+ BM_MAX_COUNT=`expr ${BM_MAX_COUNT} + 1`
+ ;;
+ esac
+ ;;
+ "flyby")
+ case ${DETAIL} in
+ "MinDetail")
+ FB_MIN_SCORE=`echo ${FB_MIN_SCORE} + ${SCORE} | bc`
+ FB_MIN_COUNT=`expr ${FB_MIN_COUNT} + 1`
+ ;;
+ "MaxDetail")
+ FB_MAX_SCORE=`echo ${FB_MAX_SCORE} + ${SCORE} | bc`
+ FB_MAX_COUNT=`expr ${FB_MAX_COUNT} + 1`
+ ;;
+ esac
+ ;;
+ esac
+done < ${FILE}
+
+BM_MIN_AVG=`echo "scale=6; ${BM_MIN_SCORE} / ${BM_MIN_COUNT}" | bc`
+BM_MAX_AVG=`echo "scale=6; ${BM_MAX_SCORE} / ${BM_MAX_COUNT}" | bc`
+BM_ALL_AVG=`echo "scale=6; (${BM_MIN_SCORE} + ${BM_MAX_SCORE}) / (${BM_MIN_COUNT} + ${BM_MAX_COUNT})" | bc`
+
+FB_MIN_AVG=`echo "scale=6; ${FB_MIN_SCORE} / ${FB_MIN_COUNT}" | bc`
+FB_MAX_AVG=`echo "scale=6; ${FB_MAX_SCORE} / ${FB_MAX_COUNT}" | bc`
+FB_ALL_AVG=`echo "scale=6; (${FB_MIN_SCORE} + ${FB_MAX_SCORE}) / (${FB_MIN_COUNT} + ${FB_MAX_COUNT})" | bc`
+
+echo "
+>> Score for Botmatch
+MinDetail: ${BM_MIN_AVG} (${BM_MIN_COUNT} tests)
+MaxDetail: ${BM_MAX_AVG} (${BM_MAX_COUNT} tests)
+Average : ${BM_ALL_AVG} (`expr ${BM_MIN_COUNT} + ${BM_MAX_COUNT}` tests)
+
+>> Score for FlyBy
+MinDetail: ${FB_MIN_AVG} (${FB_MIN_COUNT} tests)
+MaxDetail: ${FB_MAX_AVG} (${FB_MAX_COUNT} tests)
+Average : ${FB_ALL_AVG} (`expr ${FB_MIN_COUNT} + ${FB_MAX_COUNT}` tests)"
diff --git a/games-fps/ut2003-demo/files/ut2003-demo b/games-fps/ut2003-demo/files/ut2003-demo
new file mode 100644
index 000000000000..56d7e10e6a73
--- /dev/null
+++ b/games-fps/ut2003-demo/files/ut2003-demo
@@ -0,0 +1,30 @@
+#!/bin/bash
+# Written by phoen][x <phoenix@gentoo.org>, Sep/19/2002
+# Modifications, enhancements or bugs? Mail me.
+
+INSTALL="GAMES_PREFIX_OPT//ut2003-demo"
+
+case ${1} in
+ "--results")
+ pushd ${INSTALL}/Benchmark &> /dev/null
+ ./results.sh
+ popd &> /dev/null
+ ;;
+ "--bench")
+ pushd ${INSTALL}/Benchmark &> /dev/null
+ ./benchmark
+ popd &> /dev/null
+ ;;
+ "--help")
+ echo "Usage:"
+ echo " ut2003-demo [--bench] || [--results]"
+ echo " Optional parameters, only one at a time."
+ echo " --bench : starts ut2003-demo in benchmark mode"
+ echo " --results : outputs the results of your last benchmark"
+ ;;
+ *)
+ pushd ${INSTALL} &> /dev/null
+ ./ut2003_demo
+ popd &> /dev/null
+ ;;
+esac