# Where to find the analysis scripts

Updated 2024-03-03, for Game Server 6.026

Depending on what computer you use, the way to obtain and access this script (and other data analysis scripts) may be a bit different.

To better understand this section, it is useful to keep in mind that for the script to work, two components must be present: the shell script itself and the JAR files that contained compiled code (byte code) of the Java classes invoked by the script.

### If you're working on a host that runs Game Server built from source

The Analyze Transcripts tool, along with various other auxiliary tools, is automatically installed on every machine where the Game Server has been built from source code (Option B or C in the Setup Guide), as described in the Rule Game Server build Guide.

If you, for example, have used `~/w2020/game` as the build directory on your machine (as suggested in the guide), then the top-level shell scripts will be in the directory `~/w2020/game/scripts`.

On several UW machines, including `sapir` and on our CAE host (`ie-r108304.ie.wisc.edu`), the build directory for the Game Server was `/home/vmenkov/w2020/game`, so the top-level scripts are in `/home/vmenkov/w2020/game/scripts`; this path will be used in some of the illustrative examples below.

For convenience, you may want to add the script directory (such as /home/vmenkov/w2020/game/scripts, or whatever it is on your machine) to your PATH.

### If you're working on a host that runs Game Server installed using WAR files

You may be working on a computer on which you have installed the Game Server by downloading its WAR file. (This is Option A in the Setup Guide). In this case, you have all the necessary JAR files already (they came packed in the WAR file, and Tomcat unpacked them into `/opt/tomcat/webapps/w2020/WEB-INF/lib` or a similar location), but you don't have the shell scripts yet. In this case, to be able to use analysis scripts, you can do the following:

- Get the Rule Game Server source code from GitHub, as if you are preparing to compile it (as described in the Rule Game Server build Guide), but without actually compiling. Assuming that the main directory you have chosen to check out the Rule Game Server source code is `~/w2020/game`, then the top-level shell scripts will be in the directory `~/w2020/game/scripts`. You can add this directory to your PATH.
- If your Tomcat is not under `/opt/tomcat` (i.e. there is no directory `/opt/tomcat/webapps/w2020/WEB-INF/lib` on your computer), figure where Tomcat lives, and set up a sym link so that `/opt/tomcat/webapps` resolves to your Tomcat's webapps directory. For example, if your Tomcat is in `/usr/local/opt/tomcat` (as is often the case in MacOS installations), then you can set up a link like this:

      cd /opt/
      ln -s /usr/local/opt/tomcat .

When you invoke the analysis script, it will attempt to look for the JAR files with Java classes first in the locations where they would have been if the Game Server on this host had been compiled from source (e.g. under ~/w2020/lib etc); if those don't exist, it will fall back to the JAR files that Tomcat had unpacked in its own `webapps` directory from the WAR files that you have downloaded.

### If you're working on a host that has no Game Server at all

If your host has no Game Server installed, and you have no plan to install one, but you want to run analysis scripts here, it means that you intend to use this host as an analysis host for data accumulated on Game Servers elsewhere (e.g. on the Plesk hosts), meaning that you'll need to learn how to learn how to pull from remote servers.

To be able to use the analysis script on your host, you still will need to install some (but not all) of the same components that would be required if you were installing the Game Server (as described in the Setup Guide). Specifically:

- Install the MySQL server (see the SQL database setup guide).
- Create the master configuration file. This file will, among other things, tell your Rule Game Server how to connect to the database server. See config file setup for details.
- You don't need to actually run Tomcat, or even to have it installed; but you need the directory `/opt/tomcat/webapps` to exist, regarding of whether you have Tomcat. Thus:
  - If you have Tomcat already installed in /opt/tomcat, you are all set.
  - If you have Tomcat already installed elsewhere, just create a sym link (see the sample command above), so that /opt/tomcat/webapps resolves to an existing directory.
- Download the Rule Game Server WAR file from our server's Download Area. Look for a recent file with a name such as `w2020.war` or `w2020-5.002-2022-06-01.war`, rename it to `w2020.war` if needed, and put that file into `/opt/tomcat/webapps`. If you have Tomcat running, you don't need to do anything else with this file, as Tomcat will automatically unpack its contents into `/opt/tomcat/webapps/w2020`. If you don't actually have Tomcat installed, or if it's installed but not running, then unpack the WAR file:

      cd /opt/tomcat/webapps
      	jar xf w2020.war

  You can now verify that the directory `/opt/tomcat/webapps/w2020/WEB-INF/lib` contains a large number of JAR files.
- Obtain the source code of the Rule Game Server from the GitHub repository (it includes the shell scripts you need), just as if you were preparing to build the Game Server from source:

      cd
      mkdir w2020
      cd w2020
      mkdir game
      cd game
      git init
      git remote add origin https://github.com/RuleGame/Rule-Game-server.git
      git pull origin master

This is all you need to do; now your scripts should be in `~/w2020/game/scripts`, and should be usable.

[Main tools page] [Main documentation page]