设为首页收藏本站新闻投稿

MOD中国同盟社

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 911|回复: 2

Psychostats的相关中文版技术文档[转帖] [复制链接]

Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20

帖子
2836
精华
2
声望
12984 点
金币
2999 Mold
被赞许
28 次
注册时间
2006-4-28

Mod中国同盟社至高荣誉

发表于 2011-6-13 18:49:05 |显示全部楼层
要安装Psychostats,那么首先要有Psychostats这个系统的安装文件。大家可以去http://www. Psychostats.com上下载最新版本的文件,目前最新版本是2.3.1。另外我们需要系统有其他软件的支持:perl的支持、vbscript的支持(安装perl时需要[windows下])、mysql的支持、apache的支持(不推荐用IIS,因为IIS对PHP处理不是很好)以及php(网页服务需要用到的解析)。
这些相应的软件下载地址如下:
Perl:http://www.perl.com/download.csp
Vbscript:http://www.microsoft.com/downloads/search.aspx?displaylang=zh-cn
Mysql:http://dev.mysql.com/downloads/
Apache:http://www.apache.org/dyn/closer.cgi
Php:http://www.php.net/downloads.php

另外,如果要Psychostats系统能在服务器上更好的运行,那么我们还需要一些游戏服务器的插件, metamod插件(用来加挂amxmodx的插件)、amxmodx插件(用到的是mysql插件以及Psychostats自己的一个插件)以及statsme插件(记录射击部位的插件)。
这些插件的下载地址如下:
Metamod:http://metamod.org/
Amxmodx:http://www.amxmodx.org/downloads.php
Statsme:http://www.unitedadmins.com/inde ... amp;content=statsme




安装过程
首先在游戏服务器上安装支持软件,顺序依次是apache、php、mysql、vbscript,最后是perl。

Windows下的安装:
1. 安装apache,使用默认安装,如果想把apache服务装在默认的80端口的话,那么在安装前请确认你的服务器上的IIS服务是否已经启动,如果启动的话,要么你调整apache的服务端口,要么你把IIS的服务停止。默认安装完成以后,apache的配置文件在系统盘的Program files\Apache Group\Apache\conf目录下的httpd.conf,apache的web服务文件放在系统盘的Program files\Apache Group\Apache\htdocs目录下。
2. 安装php,使用默认安装,注意在选择http服务软件的时候选择apache,默认安装路径应该是在C:\PHP。
3. 安装mysql,使用默认安装,默认路径是C:\Mysql。安装完毕后,在C:\Mysql\bin目录下运行winmysqladmin.exe设置访问数据库的帐号和密码。
4. 安装vbscript,默认安装,安装完毕后需要重新启动机器。
5. 安装ActivePerl,使用默认安装。安装完毕后运行开始菜单中的“Perl Package Manager”,进入命令行模式。在命令行模式下执行“install TermReadKey”、“install DBI”以及“install DBD-mysql”安装完毕这3个组件后输入quit退出命令行模式。
6. 解压Psychostats的最新版本的包到C:\ps23目录下,然后进入命令行模式,到C:\ps23目录下执行install.pl,则开始安装Psychostats系统。
7. 安装完毕以后运行C:\ps23目录下的stats.pl进行数据的同步。第一次运行完毕以后在计划任务中添加stats.pl为每日0点1分运行,表示每天晚上0点1分进行log日志转数据库的操作,以同步数据。
8. 在游戏服务器上加上metamod插件,在dod目录下建立addons目录。在addons目录下建立amxmodx目录存放amxmodx插件;建立metamod目录存放metamod插件;建立statsme目录存放statsme插件。在metamod目录下建立dlls目录,把metamod.dll文件解压到dlls目录里,在metamod目录下建立plugins.ini文件,用记事本打开后输入“win32 addons\amxmodx\dlls\amxmodx_mm.dll”,另起一行输入“win32 addons\statsme\dlls\statsme_mm.dll”。在amxmodx目录下的config目录下存放Psychostats插件的配置文件ps.cfg,在amxmodx目录下的plugins目录下存放Psychostats插件文件ps.amxx;在amxmodx目录的config目录下修改modules.ini,把mysql_amxx.dll前面的分号去掉,修改plugins.ini,在最后添加一行ps.amxx。
9. 编辑游戏服务器上dod目录下的liblist.gam文件,在“gamedll dlls\dod.dll”前面添加“//”,另起一行输入“gamedll addons\metamod\dlls\metamod.dll”。
10. 重新启动游戏服务就OK了。

Linux下安装:
1. 安装apache,配置安装目录到/usr/local/apache。
2. 安装mysql,配置安装目录到 /usr/local/mysql。
3. 安装php,配置自动添加到apache和mysql,使用参数—with-apxs=/usr/local/apache/bin/apxs和—with-mysql。
4. 安装perl及其相关组件,perl-DBI和perl-DBD-MySQL组件。
5. 解压Psychostats包到/game/ps23/下,进入/game/ps23目录后执行“./install.pl”,则开始安装Psychostats系统。
6. 安装完毕后进入/game/ps23/后执行“./stats.pl”进行数据同步。用crontab命令把这个设置成每天0点1分自动执行。
7. 在游戏服务器上加上metamod插件,在dod目录下建立addons目录。在addons目录下建立amxmodx目录存放amxmodx插件;建立metamod目录存放metamod插件;建立statsme目录存放statsme插件。在metamod目录下建立dlls目录,把metamod_i386.so文件解压到dlls目录里,在metamod目录下建立plugins.ini文件,用记事本打开后输入“linux addons/amxmodx/dlls/amxmodx_mm_i386.so”,另起一行输入“linux addons/statsme/dlls/statsme_mm_i386.so”。在amxmodx目录下的config目录下存放Psychostats插件的配置文件ps.cfg,在amxmodx目录下的plugins目录下存放Psychostats插件文件ps.amxx;在amxmodx目录的config目录下修改modules.ini,把mysql_amxx_i386.so前面的分号去掉,修改plugins.ini,在最后添加一行ps.amxx。
8. 编辑游戏服务器上dod目录下的liblist.gam文件,在“gamedll_linux dlls/dod_i386.so”前面添加“//”,另起一行输入“gamedll_linux addons/metamod/dlls/metamod_i386.so”。
9. 重新启动游戏服务就OK了。

实现逻辑
前提:假设游戏服务器为A,MySQL数据库服务器为B,HTTP服务器为C。
整个一套Psychostats的实现逻辑是这样的:在游戏服务器A上存储日志,运行stats.pl把日志转换到MySQL数据库服务器B上。大家访问HTTP服务器C的时候HTTP服务器C从MySQL数据库服务器上读取数据进行显示。所以Psychostats这套系统是支持对所有服务器上的player进行统计和排名的。也就是说,只要一台HTTP服务器,一台MySQL服务器就可以对N台游戏服务器一起进行统计排名。如果更加理想的话就是HTTP服务和MySQL服务是可以在同一台服务器上运行。

在上述的Windows安装过程中的步骤1和步骤2是安装HTTP服务器所需要的步骤;步骤3是安装MySQL服务器所需要的步骤;步骤4到步骤10是游戏服务器上所需要进行操作的步骤。
在上述的Linux安装过程中的步骤1、步骤2和步骤3是安装HTTP服务器所需要的步骤;步骤2是安装MySQL服务器所需要的步骤;步骤4到步骤9是游戏服务器上所需要进行操作的步骤。

注意事项
1.先转一下点通论坛上Songsong发表的一篇PS2.2说明文档,我们现在截取其中的部分,主要是用来显示在安装Psychostats系统过程中所涉及到的参数问题。

Linux/Unix detected (Perl v5.8.1)
Loaded language file 'english' successfully.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
The Psychostats v2.2 installation has several steps, all of which will be
handled automatically by this setup wizard. The wizard is interactive and will
ask you several questions along the way. New and veteran users will both find
this setup quick, easy and helpful.

*** UPGRADE NOTES ***
If you are upgrading from the previous version 2.1 and everything is currently
working for you, DO NOT run this install wizard. Run the 'upgrade.pl' script
instead. That will alter your database to the new format w/o losing any of
your current stats and will update your Psychostats files on your website.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Press enter to continue ...
按回车继续

Before we begin installing Psychostats v2.2 on your system I need to know
where your web server is located. If your web server shown below is set to
'localhost' this means the web server will be considered local to the machine
that you're running this install wizard.

Web server host: localhost [127.0.0.1]
Do you want to change your settings? [Y,n]:
是否要更改您的服务器类型设定,不要管127.0.0.1这个IP,一般选择n,如果是远程则选择Y,进行修改

Press enter to continue with next step
按回车继续下一步

>>> STEP: Verifying required perl modules ...
Searching for required perl modules ...
x = module installed
[x] DBI v1.37
[x] DBD::mysql v2.9002
[x] Data:umper v2.121
All required perl modules are installed! Congratulations!

Press enter to continue with next step
检测系统是否支持DBI及DBD::mysql,如果全部为[x]则为通过,按回车继续下一步

>>> STEP: Database initialization and setup ...
SQL initialization file successfully loaded (34 tables).

A database needs to be setup for Psychostats to use. In order to verify and
create the database you need to provide a user that has admin privileges on
the DB server. Follow the prompts below to setup the database. Each prompt
will show its current setting in [brackets]. If you do not want to change a
setting just press enter at the prompt.

WARNING: Your password, if given, will be echoed to the screen!

Most databases will require a username to connect with. If a default username
appears in the [] brackets and you need to use a blank username type in 'none'
(w/o quotes) at the prompt.
DB Username []: root
数据库用户,输入root或者您的帐号

Most databases will require a password to connect with. If a default password appears in the [] brackets and you need to use

a blank password type in 'none' (w/o quotes) at the prompt.
DB Password []: xxxxxx
数据库密码,输入上步骤用户所使用的密码

Where is the MYSQL server? Enter 'localhost' if its on this same machine
otherwise enter the IP or hostname of the server.
DB Hostname [localhost]: xxx.xxx.xxx.xxx
数据库连接类型,使用MySQL服务器的地址。[原文是:一般使用localhost]

Each database on a server has a different name. Which name will you use for
Psychostats? We will try to create this DB later if it doesn't already exist.
DB Name [ps_stats]: ps22
Psychostats使用的数据库,这里使用我们在安装MySQL时建立的ps22

Choose a table name prefix. The default prefix is "pstats_" this helps keep
all related tables in the DB together. Each table in the DB will start with
this prefix. Just accept the default if you're not sure.
DB Table prefix [pstats_]: pstats_
ps22数据库的表前缀,便于数据库操作,可以采用pstats_或者您喜欢的

Should compression be used for your DB connection? This may or may not help performance (especially if your DB server is

remote). If you experience any problems disable this.
DB Compression [0]: 0
数据库连接时是否压缩,建议为0

Checking for DB ps22@localhost ...DB EXISTS!
Preparing to create database 'ps22' table structure ...

If a table already exists with the same name in the 'ps22' database should it
be deleted and replaced with a new empty table? (any data in the original
table will be lost).
Delete existing tables first? [y,N]: N
是否删除已经存在的,选择N(因为您创建的数据库是空的,没有必要删除,如果失败后再次安装可以选择Y)

Creating table 'pstatsclans' ...OK
Creating table 'pstatsdefs_awards' ...OK
Creating table 'pstatsdefs_events' ...OK
-----------------省略-----------------
Creating table 'pstatsplrvictims' ...OK
Creating table 'pstatsplrweapons' ...OK
Creating table 'pstatsrcons' ...OK
Creating table 'pstatssessions' ...OK

Congratulations! DB 'ps22' has been fully initialized!

Press enter to continue with next step
按回车继续下一步

>>> STEP: Basic Configuration ...

Each question will show your current config setting in [brackets], If you do
not want to change the current setting just press <enter> at the prompt.

The 'logsource' option specifies where your logs are stored for your game
server. You can specify multiple log directories and each will be scanned in
the order given. Enter a blank line if you do not want to enter any more log
directories. To delete a directory from the list enter the number shown next
to it and press enter.

Current log sources (enter a blank line to stop).
An asterix '*' in front of the directory means the directory does not exist!
0. * none *
LOGSOURCE 1: D:\cstrike1\logs
您的第一日志地址(填写您自己的地址)

Current log sources (enter a blank line to stop).
An asterix '*' in front of the directory means the directory does not exist!
1. /root/old_logs
LOGSOURCE 2: D:\cstrike2\logs
您的第二日志地址(填写您自己的地址)

Current log sources (enter a blank line to stop).
An asterix '*' in front of the directory means the directory does not exist!
1. /root/old_logs
2. * /root/old
LOGSOURCE 3:
如果您有第三个日志地址,可以继续填写,直到您满意,否则就回车退出日志地址填写

The 'modtype' option specifies what MOD of the primary 'gametype' you're
playing.
Valid mods: cstrike, dod, ns
MODTYPE [cstrike]: dod
游戏类型,选择您的类型

The 'uniqueid' option specifies how players are tracked in the game logs.
Note: 'wonid' and 'steamid' are the same thing as 'worldid'.
Valid options: ipaddr, name, steamid, wonid, worldid
UNIQUEID [worldid]: name
统计类型,根据您的情况来决定
ipaddr适合针对IP统计
name适合针对玩家名字,比较常用,特别适合于大型网吧
steamid适合针对Steam系统,比较常用
wonid适合针对WonID系统(目前好象淘汰了)
worldid适合PS自己的全球ID系统

The [decay] 'skill' option specifies a percentage that will decay a players
skill value for each day they do not play since their last played date. It is
recommended that this value be kept low (less than 5%).
DECAY.SKILL [0%]: 2%
技巧统计对比率为2%,可以为0%-5%,不要超过5%

The [decay] 'minskill' option specifies the minimum value a players skill is
allowed to decay to. A players skill will never automatically decay lower than
this value but its still possible for a player to go lower if they simply
aren't playing that well.
DECAY.MINSKILL [1000]: 1000
技巧基础得分(每一个玩家一旦进入排名,赋予每人一个公平的起始分数),一般为1000,不要小于750

The 'servername' option should be a short name for your game server. The
themes can use this in their output.
SERVERNAME [Powered By Psychostats v2]: Powered By Psychostats v2
出现在页面顶部的标识,随便填

The 'serverip' option should be the IPort for your game server. The theme
will use this to show real-time server information by querying the server. If
you do not want this information to be displayed just leave the field blank.
SERVERIP []: 192.168.1.10:27015
监控服务器地址,这一监控是动态的,可以随时反映其在线状况,如果没有,可以为空

Very Important: You must provide a valid directory that the website files for
Psychostats will be copied or uploaded to. This directory should be within
your web server directory tree.

'statsroot' specifies the directory where your Psychostats website files will
be located.
THEME.STATSROOT [c:\inetpub\wwwroot\stats\]: C:\Program Files\Apache Group\Apache2\htdocs\
这是Psychostats2.2发布的主地址,这里填写上绝对地址

'statsurl' is an absolute URL pointing to the location of your stats on your
website. You do NOT put http://domain.com in front of this option. This will
usually resemble the statsroot option you entered above but w/o the phyiscal
directory path in front of it. Often only leaving the last directory name.
Example: If statsroot = '/var/www/stats/', then statsurl would be '/stats/'.
THEME.STATSURL [\stats\]: \
这是Psychostats2.2发布的文件所在的相对地址,这里是\
这两个地址非常关键,但是第一次安装往往容易搞错,错误的话导致图片显示不正常,当然可以在后面的配置文件中修改

Updating configuration ...
Press enter to continue with next step
>>> STEP: Test PS subsystems ...
Attempting to initialize PS CORE system ...OK
Attempting to initialize PS SAVER sub-system ...OK
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Required installation is now complete!
Psychostats should now be able to load and store logs from this system.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Press enter to continue with next step
按回车继续下一步

>>> STEP: Copying theme to web server ...

Psychostats uses 'themes' to produce its output for the stats. Listed below
are all the themes currently available on your system. Choose the theme you'd
like to use.

Available themes: psweb
Choose your theme [psweb]: psweb
psweb是目前唯一的选择,请输入psweb然后确定
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Theme config loaded for 'psweb':
Theme name: Psychostats.com
Version: 2.2
Author: Stormtrooper
Email: stormtrooper@Psychostats.com
Total files: 235 (size: 421.10 KB)
Dep. files: 12 (size: 96.07 KB)

Notes from the author:
The "psweb" theme was designed to look just like the Psychostats.com
website. It will work for any of the currently supported mods. Adding new
support for a mod is as simple as adding a few new files to the theme. No
changes would have to be made to any of the current files within the theme.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Do you want to install this theme? [Y,n]: Y
是否安装这一风格,选择Y


The files for this theme will be copied into your statsroot
'C:\Program Files\Apache Group\Apache2\htdocs\'.

Copying [ 0.08%][ 324.00 B] themes\psweb\admin.html ...OK
Copying [ 0.85%][ 3.28 KB] themes\psweb\admin_body_awards.html ...OK
Copying [ 2.37%][ 6.38 KB] themes\psweb\admin_body_db.html ...OK
-----------------省略-----------------
Copying [ 99.64%][ 442.00 B] themes\psweb\languages/slovak/usersearch.lng ...OK
Copying [ 99.87%][ 994.00 B] themes\psweb\languages/slovak/weapon.lng ...OK
Copying [100.00%][ 541.00 B] themes\psweb\languages/slovak/weaponlist.lng ...OK

The theme has dependant files that need to be copied over to your website. All
paths will be created automatically starting within the statsroot specified in
your config: 'C:\Program Files\Apache Group\Apache2\htdocs\' on your web
server.

Copying [ 7.98%][ 7.67 KB] psweb.css ...OK
Copying [ 8.25%][ 270.00 B] images\arrow_blue_asc.gif ...OK
-----------------省略-----------------
Copying [ 99.64%][ 361.00 B] images\title_left.png ...OK
Copying [100.00%][ 357.00 B] images\title_right.png ...OK
Done copying files.

Press enter to continue with next step
按回车继续下一步


>>> STEP: Uploading web related files ...

Updating web/config.php based on your local config ...
done.

Copying web files to web server.
Root destination: C:\Program Files\Apache Group\Apache2\htdocs\
Copying [ 0.82%][ 4.61 KB] admin.php ...OK
-----------------省略-----------------
Copying [100.00%][ 925.00 B] smarty\plugins\shared.make_timestamp.php ...OK
Done copying files.

Copying weapon images to web server.
Root destination: C:\Program Files\Apache Group\Apache2\htdocs\images\weapons\
Copying [ 0.31%][ 1.08 KB] cstrike_ak47.gif ...OK
-----------------省略-----------------
Copying [ 97.38%][ 8.91 KB] large\cstrike_usp.jpg ...OK
Copying [100.00%][ 9.05 KB] large\cstrike_xm1014.jpg ...OK
Done copying files.

Copying map images to web server.
Root destination: C:\Program Files\Apache Group\Apache2\htdocs\images\maps\
No files to copy.
Done copying files.

Press enter to continue with next step
按回车继续下一步

*** Install has been completed ***

Now that you've installed Psychostats v2.2 the next step would be to run a
'stats update' to scan your log direcories for game and player stats.

Linux users can run the stats update by typing "./stats.pl" at your shell
prompt (w/o the quotes).

The first time you run the stats update it may take a long time depending on
the number of logs you have. Subsequent updates will be much quicker since
only new logs (after your last update) will have to be scanned. You will need
to periodically run the stats update so new stats are collected and inserted
into your DB.

Linux users can use their crontab and have the stats.pl process run
automatically at set intervals.

Once you have data in the database you should be able to browse to your
website stats URL to view the stats. For example: http://localhost/stats/

Press enter to exit installation.

Installation completed!


2.运行Psychostats的安装程序后,把刚才设路径的C:\Program Files\Apache Group\Apache2\htdocs\下的stats目录拷贝到你的HTTP服务器上的相应Web发布的文件夹里。


3.在安装完毕以后需要注意的是默认的安装完成以后,数据库中是少2张表的,一张是pstats_clans_profile,另外一张是:pstats_plr_profile。这2张表是需要手工去导入的,具体的参数是:
创建pstats_clans_profile的命令如下:
CREATE TABLE `pstats_clans_profile` (
`clanprofileid` int(10) unsigned NOT NULL auto_increment,
`clantag` varchar(32) NOT NULL default '',
`clanname` varchar(128) NOT NULL default '',
`clanlogo` text NOT NULL,
`clanemail` varchar(128) NOT NULL default '',
`clanicon` varchar(64) NOT NULL default '',
`clanwebsite` varchar(255) NOT NULL default '',
`clanlocked` tinyint(1) unsigned NOT NULL default '0',
PRIMARY KEY (`clanprofileid`),
UNIQUE KEY `clantag` (`clantag`)
) TYPE=MyISAM COMMENT='Registered clan profiles';

创建pstats_plr_profile的命令如下:
CREATE TABLE `pstats_plr_profile` (
`plrprofileid` int(10) unsigned NOT NULL auto_increment,
`worldid` varchar(32) NOT NULL default '',
`name` varchar(64) NOT NULL default '',
`ipaddr` int(10) unsigned NOT NULL default '0',
`plremail` varchar(128) NOT NULL default '',
`plraim` varchar(64) NOT NULL default '',
`plricq` varchar(16) NOT NULL default '',
`plrmsn` varchar(128) NOT NULL default '',
`plrwebsite` varchar(128) NOT NULL default '',
`plricon` varchar(64) NOT NULL default '',
`plrlogo` text NOT NULL,
`username` varchar(64) NOT NULL default '',
`password` varchar(32) NOT NULL default '',
`accesslevel` tinyint(2) unsigned NOT NULL default '1',
`plrnamelocked` tinyint(1) unsigned NOT NULL default '0',
PRIMARY KEY (`plrprofileid`),
KEY `username` (`username`),
KEY `worldid` (`worldid`),
KEY `name` (`name`),
KEY `ipaddr` (`ipaddr`)
) TYPE=MyISAM;

4.在创建MySQL数据库服务器的时候需要进行设置远程连接的帐号以及权限,Windows下用DOS命令行方式下执行“mysql –uroot -p”,然后输入你刚才设置的数据库登录密码进入“mysql>”模式,输入“grant create, update, insert, select ON ps23.* root@”%” identified by ‘123456’ with grant option;”[其中ps23是Psychostats的数据库名字;123456是root登录的密码],再输入“flush privileges;”刷新数据库权限。

使用道具 举报

Super Moderator

「Cusmo17」

Rank: 10Rank: 10Rank: 10

帖子
1211
精华
0
声望
3355 点
金币
143 Mold
被赞许
59 次
注册时间
2010-10-16

MTT职员 可爱小猫 懒人勋章

发表于 2011-6-13 18:58:58 |显示全部楼层
..........为啥我会有点蛋疼呢。。大哥。。
马勺也会出去专贴教程的么。。。。。

osu个人→http://osu.ppy.sh/u/970833
FPS转型MUG狗.jubeat/osu!/taiko

使用道具 举报

Modchina声望-崇拜

在逃模客

Rank: 15Rank: 15Rank: 15Rank: 15Rank: 15

帖子
2536
精华
0
声望
8050 点
金币
1500 Mold
被赞许
120 次
注册时间
2010-2-7

懒人勋章

发表于 2011-6-13 18:59:45 |显示全部楼层
能简单说下是干什么的么?太长了我实在看不懂
その一   いつもと违う髪形に気が付くこと
その二   ちゃんと靴まで见ること   いいね?
その三   わたしの一言には三つの言叶で返

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

回顶部