chat-anaylzer is a command-line tool for Pax Galaxia which provides several useful utilities to server administrators, as well as a high-score and voting system for players. It can be run by itself to analyze the chat log, but its main purpose is to be run as a daemon (see Daemon sections below), where it will parse user input in the chat every 10 seconds to enable the use of the commands listed below.
FEATURES
High-score system.
Tracks the wins of each player by their name (in wins.txt).
Creates a command-list to output the top three players.
New command for players: #myrank : Gets the rank of the player who asked, and outputs it.
New command for players: #rank playername : Gets the rank of the specified player, and outputs it.
Voting system.
Users can vote for the next map to be played in the rotation through a new command: #vote mapname : Records a vote for mapname by a certain player. There is also the #votes command which displays the current maps being voted on, and the #vote_reset command to reset your vote.
#vote random will randomly choose a map (Note: requires extra setup, see instructions below).
Note: Your vote will be confirmed by the server within 10 game ticks of your voting. Votes made within the last 10 ticks of the game may not be recorded.
Cool administrative functions
#whois playername : Outputs the five closest players in terms of IP address to the specified player, with a percentage of how close they are to the specified player.
#telladmin message: (OS X 10.8+ only): Displays a message by a player on the server in your Notification Center.
Automatically gags swearers 10 ticks after their first swear. Swear words can be configured in 'support/swearlist.txt'. (This file is automatically created upon the first launch of the program.). A list of swearwords used is maintained in swears.txt.
Generates a nice-looking chatlog, containing only real player chat and any important messages (which can be configured in support/impmsgs.txt).
Maintains a list of users and their IP addresses (ip.txt, ip-sorted.txt). Rudimentary support for detecting dynamic IP addresses.
A new remote administration system. Administrators can log in with the passwords specified in 'support/adminpws.txt' using the command "#admin password passwordhere". Then, their IP is authenticated and they will no longer need to login. (Since they will be sending the password in the chat where anyone else can see it, the password is automatically invalidated after they use it.) The administrator can then issue regular Pax admin commands if they preface the command with "#admin". E.g. "#admin load risk" or "#admin ban green". The command will then be executed in the next 10 ticks. This system was created since traditional Pax remote admins didn't have access to some commands that they should have had, and they did have access to some that they shouldn't have had.
Ability to enter commands while daemon is running: exit, whois [playername], vote [mapname].
REQUIREMENTS
Pax Galaxia 1.15.3 (latest version)
Some programming know-how.
Mac requirements:
Windows requirements:
Windows Vista or later.
You must build the Boost serialization library.
Microsoft Visual Studio (I use the Microsoft Visual C++ 2010 Express Edition which is free.)
INSTALLATION - MAC
Initial Download & Project Setup
Download and install Xcode. (These instructions assume you have Xcode 4 or later. Earlier versions will still work, but the instructions may vary.)
Download the source archive below and unzip it.
Launch Xcode, go to File > New > Project, then select Application under OS X, then Command Line Tool, then Next. Type in a name (chat-analyzer), make sure the type is C++, then Next, uncheck "Create local git..." (Xcode 4+ only), navigate to the Desktop in the browser, and click Create.
On the left sidebar of the main window, right-click "main.cpp" and click Delete then Move to Trash. Then right-click on "chat-analyzer" and click "Add files to chat-analyzer...", then navigate to the source archive you downloaded in step 1.2, and command-click on the four files in the archive, then click Add.
Configuration of user settings
You must change the adminUsername string in globals.h (line 7) from "Joth" to your Pax username.
You must change the rotationfile string in globals.h to the location of your Pax map rotation file. Note that the path is relative from your home directory. Note: Your map rotation file must be in a specific format. See the section below for details.
(Optional) If you have edited strings2.txt of the Pax game files, you must edit the corresponding values at the end of the "globals.h" file. (I.e. if you changed the message displayed when someone leaves or joins a game.)
(Optional) If you have changed the names of the colors Pax uses (i.e. you changed 'white' to 'diamond', etc.), then you must uncomment the commented "modifiedColors" line and comment the one below it. (globals.h line 16-17)
Building Project & Folder Placement
In Xcode, click on the Product menu and select Build. You should see a "Build Succeeded" message.
Exit Xcode, and navigate to the folder ~/Library/Application Support/PaxGalaxia. Create a folder called "analysis" within that folder.
Move the built chat-analyzer program into the analysis folder. The built program should be in a folder called "chat-analyzer" on the Desktop, or wherever you selected to create it in step 1.3.
Create a folder called "support" inside the analysis folder, and download the "voting.txt" file below and move it into the support folder.
Go back to the "PaxGalaxia" folder, and create a new folder called 'random'. This folder will contain the maps from which a map will be randomly chosen when someone votes for a random map (using #vote random). Then, go through your fan/ and custom/ map directories and add the maps you think would be good for custom maps (e.g. 6-player only maps) into the 'random' folder.
You're good to go! See the sections below for how to setup the daemon and run it.
INSTALLATION - WINDOWS
Initial Download & Project Setup
Download and install Microsoft Visual C++ 2010 Express Edition.
Download the file on this page and follow the install instructions also located on that page.
Download the source archive below and unzip it. Delete any files that start with a dot, they are not necessary and may cause problems.
Download Boost and unzip it to some folder like "C:\dev". You must then build the Boost serialization library. Instructions can be found here. After entering the commands, it will take quite a while to compile depending on the speed of your computer. Note that when issuing the commands on that page, you may need to use the Visual Studio Command Prompt (located in your Start Menu) instead of cmd.exe.
Launch MSVC++. Go to File > New > Project From Existing Code... Click Next. For project file location, click Browse... and navigate to the unzipped folder you downloaded. For project name, put chat-analyzer. In the list of folders, click the checkbox near the "chat-analyzer" folder you unzipped. Click Next. Under Project Type, choose "Console application project." Click Finish.
On the left side of the window, you should see the Solution Explorer, with "chat-analyzer" in bold near the top. Right-click on "chat-analyzer" and select Properties. On the left side of the window that opens, click on "VC++ Directories." Click on "Include Directories", then click on the arrow that appears on the right side, and select "Edit..." from the drop down menu. Click on the "New folder" icon, then on the "..." button that appears. Navigate to your Boost folder that you unzipped in step 2 and select it. Click OK. Click on "Library Directories", then click on the arrow that appears on the right side; select "Edit..." from the drop down menu. Click on the "new folder" icon, then on the "..." icon. Navigate to your Boost folder, then open the "stage" folder and then the "lib" folder. Select that"lib" folder. Click OK. Then click OK to exit out of the main properties window.
Configuration of user settings
You must change the adminUsername string in globals.h (line 7) from "Joth" to your Pax username.
You must change the rotationfile string in globals.h to the location of your Pax map rotation file. Make sure you are editing the Windows version of the string (near the bottom of the file, line 49). Note: Your map rotation file must be in a specific format. See the section below for details.
If you are not using a 64-bit version of Windows, you must do a project-wide find-and-replace of "Program Files (x86)" to "Program Files".
(Optional) If you edited the messages that display when someone leaves/joins your server (in strings2.txt), you must edit the corresponding values in globals.h (line 23-24). Note that the values in globals.h must be subsets of your strings2.txt messages. If you put in strings2.txt "%s has joined the game", then in globals.h you must use "has joined the game" (you must not include the %s character).
(Optional) If you have changed the names of the colors Pax uses (i.e. you changed 'white' to 'diamond', etc.), then you must make the corresponding changes on globals.h line 13 (modifiedColors array).
(Optional) If you have changed the RGB values of player text colors that Pax uses, then you must make the corresponding changes on globals.h line 16 (RGBColors array).
Building Project & Folder Placement
In MVSC++, go to Debug > Build Solution. Then, go into your chat-analyzer folder, then into the Debug (or Release, if it exists) folder. You should see the file "chat-analyzer.exe".
Navigate to your Pax Galaxia folder, e.g. "C:\Program Files (x86)\Pax Galaxia". Then move the folder called "analysis" (which was in the zip file you downloaded below) into the Pax Galaxia folder.
Move "chat-analyzer.exe" into the analysis folder.
Go back to the Pax Galaxia folder and create a new folder called "random". Then, go through your maps (located in the fan/ and custom/ directories) and put any maps into the random/ directory which you think would make good random maps, i.e. must be six-player, etc. When someone votes for a random map using #vote random, the program will randomly choose a file from this location.
In the Pax Galaxia folder, create a file called "rotationfile.txt". This file will contain the maps you want to use on your server. The file must only contain map loading commands, and each command must have a "min x" and/or "max x" command in it, i.e. "$auto min 1 command load arenagod" or "$auto max 6 command load arenagod". Each command should be on a new line (like in any map rotation file).
You're good to go! See the sections below for how to setup the daemon and run it.
DAEMON SETUP
For the daemon to work your server must use a command-list file and it must be configured in a certain way. Actually, you need two command-list files. Let's call the first one default.txt. (This file must be in the PaxGalaxia application support folder on Mac, or if you're on Windows it should be in "C:\Program Files (x86)\Pax Galaxia".)
default.txt
-- (no $at commands in this file)
$clear-events
$ungag all
$time 1000
$welcome [message here]
$diplomacy [public/private]
$cl defaultscores.txt
$cl analysis/cmdscl.txt
$next
$say Server startup finished.
$auto on
The second one should be called defaultscores.txt and look like this. (This file must be in the same folder as the above.)
defaultscores.txt
---
$clear-events
[any $at commands for saying server rules, setting the speed, etc.]
$cl analysis/scorescl.txt
$cl analysis/support/voting.txt
$at 1 cl defaultscores.txt
$at 5 every 10 cl analysis/cmdscl.txt
Note: Your map rotation file must be in a specific format. There can only be map loading commands. Furthermore, each load command must have min and or max player requirements. E.g.: "$auto command load arenagod" will not work. Instead, you must use "$auto min 1 command load arenagod".
Note: If you have changed the colour of server text in Pax from the original, you must change it back to the original for the daemon to function.
Note: By using the daemon, you must limit your games to 1000 ticks using $time 1000. If you do not, after tick 1000, the next command issued by someone (e.g. #vote random, etc.) will cause the daemon to issue a $time 1000 command which will end the game automatically.
STARTING THE DAEMON
Mac
Open Terminal (in /Applications/Utilities).
Type "cd ~" (no quotes) and press enter.
Type the following (no quotes) and press enter, replacing USERNAME with your short username: "/Users/USERNAME/Library/Application\ Support/PaxGalaxia/analysis/chat-analyzer -daemon SECONDS" where SECONDS is the amount of seconds the daemon should run (24 hours = 86400 seconds).
Start your Pax server, and load the default.txt command-list file ($cl default.txt).
Windows
Navigate to "C:\Program Files (x86)\Pax Galaxia\analysis\". Right-click on chat-analyzer.exe and select "Run as administrator". A prompt will pop up. Press 7 and enter, then enter the number of seconds you want the daemon to run, and press enter.
Open Pax Galaxia, start your server, and enter the command "$cl default.txt". (default.txt is the file you created in Daemon Setup above.)
THANKS TO...
Dave Koelle for his alphanum algorithm, used to sort the IPs and names alphanumerically. (http://www.davekoelle.com/alphanum.html)
Egg, for helping to test the program.
England, for helping to test the Windows version.
VERSION HISTORY
v1.16
code tidied up a bit.
times recorded in times.txt are now trimmed after the phrase "ticks left."
more ai messages to player questions.
randomly shuffles maps in rotation upon first loading of rotation file (at program start).
bug fixed with #votes command, and with AI loading aidata.
bug fixed where two people voting for the same map with different capitalization would cause an inconsistency.
votes recorded between games are now queued for the next game instead of being ignored.
"#vote random" map selection now chooses again if it chooses a map that is already in the rotation.
now tries to guess if you made a spelling mistake when voting for a map, and suggests the correct spelling.
ignores a #vote random request if someone has already voted for a random map during that round.
attempt to fix a bug with the #help command.
ability to enter commands in the command-line during normal daemon execution (described above).
v1.15
now records the time each message is received in chatlog.txt, swears.txt, and log.txt
message is displayed the game after a network error occurred
if wins file can't be found but chatlog.txt does exist, the wins will be recalculated from chatlog.txt
swearers are warned first and then gagged on their second swear.
map name is now correctly capitalized in voting confirmation message.
more command shortcuts, e.g. #reset_vote instead of #vote_reset, #my rank instead of #myrank
new times.txt file shows you how many times the tick count has gone to 1000, 750, etc.
new totalwins.txt file accumulates total wins.
fixed bug where "error in your rotation file" would appear although there was no error
fixed a bug where voting would be disallowed after a game where the computer had won.
windows support
v1.14
now gets the author of the map from the map file, and displays it when loading the map.
now displays correctly capitalized name when someone asks for rank info.
new command: #votes shows the currently voted-on maps, and who voted for them.
new command: #vote_reset lets you delete your vote.
new command: #help or #commands shows a list of commands that are available for the daemon.
introduction of your personal pax assistant, Pax! ask PaxBot for a list of commands to see what it can do for you. (say in chat "Pax, can I see a list of commands?").
fixed bug where a voted-in map would not be loaded right after the current map, but after the next map.
v1.13
now automatically loads voted map in, instead of first loading the next map in rotation and then switching to the new map 10 seconds after that map was loaded.
the daemon will now respond to requests twice as fast as before.
fixed longstanding bug where, if commands were issued just before the game ended, and then it took over 20 seconds until the next game started, the commands would be ignored.
fixed message that will display when there is a 3+ map tie.
v1.12
now shows a message when a player was gagged for swearing
now shows a message if #whois done on player with no whois record
#whois now truncates to 1 decimal place
#whois now omits names with < 60% similarity of IP
#whois bug fixed where large negative percentages might be displayed in certain circumstances.
dynamic IP searching now considers the first two ranges of the IP, instead of the first 8 digits.
dynamic IPs fix when comparing a name with (dynamic) at end, in ip-sorted file.
v1.11
new command (10.8) only: #telladmin [message]: displays message in notification center.
now displays the actual ranking (e.g. #2 out of 38) when the player asks for their rank.
lots more messages sent to the game to be displayed: when the admin logs in using a p/w which gets invalidated; when the admin is authenticated; voting on a map which the server doesn't have; when there is a tie in the vote; if the remote admin tried to use a prohibited command; if you try to vote between games.
fixed a bug where the vote count wouldn't reset at the end of a game when there was a tie in the vote.
messages $say'd by the server are now auto-recorded in chatlog.txt
daemon output is nicer, and will now say how many minutes it has left to run.
the color of a remote admin is auto-saved.
fixed a few bugs relating to remote admins.
fixed a bug where the same map with different capitalizations would result in a tie.
fixed a bug relating to the server admin getting his/her own rank.
fixed a bug relating to rank commands being processed when they shouldn't be.
cleaned up the code a little and introduced a new file globals.h containing client-dependent variables.
v1.10
new command: #whois [playername] - determines probable dopplegangers (same ip)
new command: #rank [playername] - displays the rank of the specified player.
#myrank command: bugs fixed; no longer gives score to "player" (default name); outputs the rank of the winner in addition to score.
#vote: now displays a message if you try voting twice.
swearers are now automatically gagged.
output looks nicer.
v1.09
now says who voted for what.
added "#myrank" command.
added ability to customize important server messages to keep in chatlog (by editing support/impmsgs.txt).
added ability to run daemon from main menu.
output is nicer.
fixed crashing bug.
fixed bug with initial admin password file creation.
took out #admin reset command to delete cmdscl.txt - that file is now automatically deleted every 20 seconds (every daemon run).
took out ability to add scores list to the rotation automatically - you'll have to do it yourself from now on.
took out ability to modify swearlist within the program - you'll have to edit swearlist.txt now.
took out ability to change name of file to analyze - it wasn't really useful.
took out hangman.
v1.08 adds voting system. output format is more efficient.
v1.07 adds support for administrator commands. adds more default swearwords. adds daemon. changes output format slightly. fixes bug with ip console output. removes noob swear.
v1.06 adds time of score tabulation to scores command-list. adds support for command-line arguments. fixes newline bug. moves chat.txt to trash when finished instead of deleting it. no longer deletes/moves chat.txt if an error occurs during analysis.
v1.05 rudimentary dynamic ip searching. (but back up your ip-sorted.txt first!) fixes swear-checking bug. fixes empty line bug in temp_config. took out sort by name menu item and made both ip sorting types mandatory. fixes end-warning (chat.txt deletion) bug.
v1.04 now ignores computer and 'player' wins. also, displays periods to indicate progress with really long chat logs.
v1.03 lets you modify the list of swear words.
v1.02 creates a command-list for the top 3 scorers.
v1.01 fixes bug with two entries of the same exact IP being displayed in the sortedIPs.txt file (thanks egg!)
v1.00 initial release.