/gte

Game Theory Explorer

Primary LanguageJavaGNU General Public License v3.0GPL-3.0

GTE - Game Theory Explorer

The Game Theory Explorer (GTE) is a graphical user interface that allows the interactive construction of small to medium size games in extensive and strategic form, and to compute equilibria of these games. GTE is part of the Gambit Project - a library of game theory software. An up-to-date version of the web-application is available via the landing page http://www.gametheoryexplorer.org/ and directly at http://gte.csc.liv.ac.uk/gte/builder/

GTE is written by

This version of GTE is designed to be portable across platforms and runs on Linux, Mac OS X, and Windows.

The GUI is currently implemented as a Flash program in Actionscript (files ending in .as); we refer to this as the client. The game generated by the client GUI is stored in a file format and sent to the server. On the server side, that file is read in, and an algorithm started, for example, to find one or all Nash-Equilibria of the game. This algorithm maybe be a program written in some native code, in particular C for the lrs program. The output of this algorithm is then sent back to the client to be displayed as a solution. These issues are addressed as follows:

  • Jetty is used to provide a local server
  • the client communicates with that local server on your machine
  • all native algorithms also run locally

Types of installation

GTE can be installed in three different ways:

  1. Compiled version (PRODUCTIVE), ready to run on an installed Jetty Server
  2. Client Development version (CLIENT) for changing the GUI written in ActionScript
  3. Server Development version (SERVER) for changing servlets or intergrating algorithms written in Java or native code.

In this README we first provide detailed installation instructions for the SERVER version (here). Then we provide some notes on developing just the CLIENT with Eclipse (here). Finally we provide some instructions on using a "drawing-only" version, with no server components (here).

If you want to contribute to the gte project, as a first step you should follow the SERVER installation instructions and create and deploy the war file gte.war on a local Jetty server.

SERVER installation instructions

This requires a number of installations:

  1. Java (for the server code)
  2. ANT (a make-like utility for compilation)
  3. Jetty
  4. Flex SDK (for Actionscript)
  5. C compiler for the native code.

After all these installations, any update of the project only requires re-compiling the server and client.

In the instructions that follow you are told to set environment variables like FLEX_HOME and JETTY_HOME. These should be set LOCALLY on and specifically for your computer and stay in build.properties (see example in repository).

1. Install Java SDK and ANT

  1. Download Java SDK (at least Java SE 6) at: [http://www.oracle.com/technetwork/java/javase/downloads/index.html] (http://www.oracle.com/technetwork/java/javase/downloads/index.html "Java Download")

    • LINUX $ sudo apt-get install sun-java6-jdk

    • WINDOWS 1.1 Download - http://www.oracle.com/technetwork/java/javase/downloads/ 1.2 Add bin directory to path 1.3 Add JAVA_HOME environment variable (makes sure it points to the SDK, not JRE)

    • OS X OS X 10.6 and 10.7 with a Java SDK suitable for gte.
      Confirm you have the latest version by running "Software update..." from the Apple menu.

    Set the environment variable JAVA_HOME to the installed JAVA SDK

  2. Install ANT

    LINUX/WINDOWS:

    1. Download ANT at: http://ant.apache.org/
    2. Extract the downloaded archive
    3. Set the environment variable ANT_HOME to the extracted ANT directory
    4. Add the bin directory to your PATH environment variable. See install instructions at: [http://ant.apache.org/manual/install.html] (http://ant.apache.org/manual/install.html "Install ANT")

    OS X: OS X 10.6 and 10.7 ships with ant (in /usr/bin/ant)

2. Install Jetty

LINUX/OSX:

  1. JETTY_VERSION=7.6.1.v20120215
  2. wget http://download.eclipse.org/jetty/$JETTY_VERSION/dist/jetty-distribution-$JETTY_VERSION.tar.gz
  3. tar xfz jetty-distribution-$JETTY_VERSION.tar.gz
  4. Set the environment variable JETTY_HOME to the extracted JETTY directory
  5. Check Jetty with executing in jetty directory: java -jar start.jar
  6. Access JETTY at: 127.0.0.1:8080
  7. Terminate JETTY with CTRL-C

WINDOWS:

  1. Download JETTY Version 7.6.1 or above at: [http://download.eclipse.org/jetty/] (http://download.eclipse.org/jetty/ "Jetty Download")
  2. Extract archive
  3. Open console and navigate to extracted directory
  4. Set the environment variable JETTY_HOME to the extracted JETTY directory
  5. Check Jetty with executing in jetty directory: java -jar start.jar
  6. Access JETTY at: 127.0.0.1:8080
  7. Terminate JETTY with CTRL-C

Applied to SERVER and CLIENT

3. Install Flex SDK

  1. Download Flex SDK (Version 4.1; Adobe Flex SDK, NOT Open Source Flex SDK) at: [http://sourceforge.net/adobe/flexsdk/wiki/Download%20Flex%204/] (http://sourceforge.net/adobe/flexsdk/wiki/Download%20Flex%204/ "FLEX SDK")
  2. Extract archive
  3. Set the environment variable FLEX_HOME to the extracted FLEX directory
  4. Add the bin directory to your PATH environment variable.

You may need to complete the following additional steps on Linux/OSX:

4b. Install "gflashplayer"

LINUX 4b.1 cd ${FLEX_HOME}/runtimes/player/10.1/lnx 4b.2 tar -zxvf flashplayerdebugger.tar.gz 4b.3 ln -s ./flashplayerdebugger ./gflashplayer 4b.4 Add directory from [4b.1] to PATH

OS X: In ${FLEX_HOME}/runtimes/player/10.1/mac there is a DMG file, "Install Adobe Flash Player Debugger 10.1.dmg". Double-click in Finder to mount the disk image, which contains an installer, "Install Adobe Flash Player Debugger". Double-click the installer to run. If you have Adobe Flash Player newer than 10.1 installed, the installer will complain and terminate. In this instance, the Flash Player Debugger.app is also present in the folder. Double-click to unzip, and drag the application the the Applications folder (or wherever you want to put it).

By now you should have 4 environment variables: JAVA_HOME, ANT_HOME, JETTY_HOME and FLEX_HOME pointing to the corresponding directories.

4. Build/Run the Server version

LINUX: Install gcc as a C-compiler (Ubuntu):

  • sudo apt-get clean
  • sudo apt-get update
  • sudo apt-get upgrade
  • sudo apt-get install build-essential

OS X: tbc (options include installing Xcode or using brew)

WINDOWS: Download cygwin (setup.exe) from: http://www.cygwin.com/. Start the setup.exe and install the following packages:

  • Devel: gcc-mingw-g++ (20050522-3)
  • Devel: gcc-mingw-core (20050522-3)
  • Devel: libgcc1 (4.5.3-3)
  • Devel: make (3.82.90-1)
  • Lib: libgcc1 (4.5.3-3)

Choosing these packages implies that setup.exe detects dependencies and autmatically will install the following packages on its own:

  • binutils (2.22.51-2)
  • gcc-core (3.4.4-999)
  • gcc-g++ (3.4.4-999)
  • libintl3 (0.14.5-1)
  • mingw-runtime (3.20-1)
  • mingw-w32api (3.17-2)
  • w32api (3.17-2)

After setup completes add the bin directory of your cygwin install dir (e.g. c:\cygwin\bin) to your PATH environment variable.

LINUX/MAC/WINDOWS:

  1. From the root directory of the respository (which contains build.properties), execute the compileComplete ANT-target with

     ant compileComplete
    

    The target compiles the servlets, FLEX GUI, native Code, packs the compiled code into a War-file and deploys it to JETTY (webapps) and starts the JETTY server. (TODO: Add info on other targets such as makeWarFile.)

  2. Access GTE at: 127.0.0.1:8080/gte

  3. Stop the JETTY server using the ANT-target jetty-stop

If http://127.0.0.1:8080/gte/ ever shows the browser message

Unable to connect
Firefox can't establish a connection to the server at
127.0.0.1:8080.

then the jetty server is down, and you need to start it (in JETTY_HOME) with

 `java -jar start.jar`

Or if you want to start jetty so that it can easily be stopped then use

`java -DSTOP.PORT=8079 -DSTOP.KEY=secret -jar start.jar &`

And then to stop it

`java -DSTOP.PORT=8079 -DSTOP.KEY=secret -jar start.jar --stop`

If you get an error while starting JETTY that says you do not have a Java SDK installed, please follow the instructions here: http://wiki.eclipse.org/Jetty/Howto/Configure_JSP. In general it says that you have to add -Dorg.apache.jasper.compiler.disablejsr199=true to the Jetty.xml (JETTY 7.5.0 and prior) or uncomment this line in start.ini (JETTY 8.X and later).

6. Including native algorithms in SERVER version

See servlet_howto.txt

Developing just the CLIENT version

The CLIENT version is only for developing the GUI.

You do not need to execute ANT targets on the CLIENT version, because you only modify ActionScript files and Eclipse helps you to compile and test your code. Access the code from GitHub, change the GUI, submit the code back to GitHub

If you want to compile, test and run the complete GTE you need to setup the SERVER version. Access the code from GitHub and run the compileComplete ANT-target.

1. Install Eclipse IDE

Download Eclipse IDE (HELIOS or INDIGO) for Java EE Developpers 32-bit version at: http://www.eclipse.org/downloads/. Do not use the 64-bit version or the new JUNO release of eclipse because it does not work with the FlashBuilder plugin later.

2. Setup and run the CLIENT version

  1. Make a copy of your Eclipse installation, because you will integrate FlashBuilder - FLEX support for Eclipse, which is buggy and may harm other projects on eclipse.
  2. Download and install Adobe Flash Builder 4.6. Sign up to Adobe with your student ID (this might take some days until Adobe has verified you as a student). As a student you will get Flash Builder for free.
  3. Navigate to your Adobe Flash Builder install directory and go to the subdirectory utilities. Open and install "Adobe Flash Builder 4.6 Plugin-in Utility.exe". This will install the Flashbuilder - Flex Plugin into your Eclipse installation.
  4. Switch to Eclipse and import the GitHub repository into a new Flex-Project
  5. Choose Flex 4.1A as the Flash Version (NOT 4.6). If you cannot choose 4.1A go to Configure Flex SDK and add the directory of the installed Flex SDK (4. Install Flex SDK) to Eclipse.
  6. Choose as the primary source directory gui-builder/src
  7. Finish the project wizard
  8. Navigate in the project explorer to gui-builder/src/les/math/games/builder/view, right click on Main.mxml and choose set as default application.
  9. Delete the original *.mxml application file created by the project wizard (should be createt in gui-builder/src)
  10. Run "main.mxml"

Optional: If you see only a grey screen adjust the security settings of the FlashPlayer. Right-Click on the grey area and choose Global settings from the popup menu. Navigate to Advanced and scroll down. Click on Trusted Location Settings and add the directory where the Flash-File is executed to the list of trusted locations.

GTE without Server components

To run GTE without server components means just to use the drawing functionality. The drawing functionality is entirely coded in Flex and therefore needs only access to the SWF file.

  1. Specify the output directory of the GTE_WSC version in build.properties using the GTE_WSC variable

  2. Build GTE_WSC using the ANT target: makeWithoutServer

  3. Go to the output directory specified in (1) and extract the Zip file

  4. Open index.html with your web-browser

  5. If you don't see the GTE IDE you have to add the output directory to your trusted sites in the global flash settings. You can edit your settings using this link:

    http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04a.html#119065

  6. Open index.html with your web-browser again