Menu

README

John S.
                      ____            _                 _        *
                     |  _ \ _ __ ___ | |     ___   __ _(_) ___ 
                     | |_) | '__/ _ \| |    / _ \ / _` | |/ __|
                     |  __/| | | (_) | |___| (_) | (_| | | (__ 
                     |_|   |_|  \___/|_____|\___/ \__, |_|\___|
                                                  |___/      

ProLogic is a Prolog wrapper for BWAPI, a C++ interface for programming StarCraft/BroodWar.
It is a shame that the ultimate artificial intelligence language has not been considered
so far when developing StarCraft AIs. The latter has been the primary motivation for
restoring the balance of the Universe and exposing BWAPI to Prolog.

Shoutout for all declarative programmers out there - you rock!
Use the API to kick some procedural and OO asses.
                                                                -- MBax (2012)

* Logo generated at: http://patorjk.com/software/taag/

Licensing
================================================================================================
The ProLogic project is free software licensed under the GNU General Public License.
A copy of the license is provided with the code in "license\gpl-3.0.txt". 
It can also be viewed online at http://www.gnu.org/licenses/gpl.html

Dependencies and prerequisites
================================================================================================
In order to build the sources you will need:

  * Visual Studio 9+ (a.k.a. 2008)

  * BWAPI 3.7.2+                obtainable at http://code.google.com/p/bwapi/
  * SWI-Prolog 6.0.2+ (32 bit)  obtainable at http://www.swi-prolog.org/
  * TortoiseSVN      [optional] obtainable at http://tortoisesvn.net/
                                TortoiseSVN is used for generating the current revision number
                                i.e. versioning of the generated binary. This can be done
                                also manually with trivial adjustments.

For developing the Prolog code I have used Eclipse with Prolog Development Tools, obtainable at: 
  * http://www.eclipse.org/
  * http://prodevtools.sourceforge.net/

Configuring and building the sources
================================================================================================
1. Create a file "conf\configuration.bat" under the main source directory (you can use the
   supplied "configuration.bat.example" and adapt it to your environment).
   In the file set the correct paths to the BWAPI, SWI-Prolog and TortoiseSVN main directories.

2. Start "open_solution.bat"
   Visual Studio will be started with INCLUDE, LIB and PATH set up automatically.

3. Select the desired configuration (Debug or Release) and build the project.

If you encounter build errors, ensure that the paths to the dependencies are set properly
in configuration.bat. If the problems persist, try installing the proposed versions:
BWAPI 3.7.2 and SWI-Prolog 6.0.2 (32 bit), which work for me.

System requirements
================================================================================================

  * Windows OS or a compatible environment (not tested under Wine, feedback is welcome)
  * StarCraft BroodWar 1.16.1 (or whatever version suits the BWAPI version)
  * BWAPI runtime DLLs
  * SWI-Prolog runtime DLLs

Binary installation
================================================================================================

1. Install BWAPI as described in its documentation.

2. Copy ProLogicModule.dll and ProLogicModuled.dll to the ChaosLauncher directory of BWAPI:
   "C:\bwapi\3.7.2\Chaoslauncher"
   or to any directory of your choice.
   Create a subdirectory "logs" where ProLogicModule.dll is located.

   Make sure that the SWI-Prolog DLLs are in the executable PATH, or copy swipl.dll to
   the same directory where the ProLogic binaries are located.

3. Go to the StarCraft installation directory and open the subdirectory "bwapi-data".
   Edit the file "bwapi.ini" and modify the following lines:

   ai     = bwapi-data\AI\ExampleAIModule.dll
   ai_dbg = bwapi-data\AI\ExampleAIModuled.dll

   Change them to match the path where you copied the ProLogic binaries, e.g. 

   ai     = C:\bwapi\3.7.2\Chaoslauncher\ProLogicModule.dll
   ai_dbg = C:\bwapi\3.7.2\Chaoslauncher\ProLogicModuled.dll

4. Create a subdirectory "kb" where the ProLogic binaries are located.
   Then create there a file, called "module.pl".
   This is the main Prolog file that will be consulted. It needs to export certain predicates.
   For more information consult the ProLogic API / BWAPI documentation.

   You can use the provided skeleton Prolog module as startup.

5. IMPORTANT!
   Create an environment variable "SWI_HOME_DIR" and set it to the SWI Prolog main directory
   before starting the ChaosLauncher (attention: the change does not apply immediately,
   you have to log out and log in again, or restart Explorer).
   Without this StarCraft will be terminated always when trying to load ProLogicModule.dll
   and you won't be seeing any error message.

Troubleshooting
================================================================================================

* StarCraft terminates immediately upon loading of ProLogicModule.dll
  Set the "SWI_HOME_DIR" environment variable to your SWI-Prolog install directory. Log out/log in.
  -> See step 5 of the binary installation.

================================================================================================
                                      H A V E   F U N !
================================================================================================

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.