Skip to content

ruflab/StacSettlers

 
 

Repository files navigation

STACSettlers

This file contains a quickstart guide and a small set of sample usages. For a more detailed description of the project and of the Stac rule-based agent see "STACSettlers documentation.pdf" file. This project contains various implementations for the Strategic Conversation (STAC) project. It also contains the code (as local dependencies) for the agents developed in the following PhD thesis:

  • Mihai Dobre, Low-resource Learning in Complex Games, School of Informatics, University of Edinburgh, 2018.

INSTALLATION

Just run make build. Check the main file for more information

RUNNING SIMULATIONS

To run an example simulation between 4 Stac agents, build the jar, create a config.txt file with the following contents:

Games=1
Log=true
ChatNegotiation=true
~
TradesTest
Trades=true
Agent=4,Stac,stac,TRY_N_BEST_BUILD_PLANS:0|FAVOUR_DEV_CARDS:-5

and run the following command:java -cp STACSettlers-1.0-bin.jar soc.robot.stac.simulation.Simulation <config-file>. This will run one game between 4 Stac heuristic agents with the best parameters. The config.txt file contained in the resources package has a set of example agents that can be run in the simulation environment. Note that smartsettlers and the TypedMCTS agents require FullyObservable=true!

REPLAY AND STORING GAMEPLAY

To replay a simulation or any other game recorded to soclog files, run the following:java -cp STACSettlers-1.0-bin.jar soc.client.SOCReplayClient then click load file and select the log file under logs_server generated by the game.

The replay client can be used to collect the gameplay (excluding chat negotiations) into a postgresql database. The database schema is included in the database folder. (Per-game tables are created as needed by the replay client.) The username, password and url to the database should be included in dbconfig.txt inside the src/main/java/resources folder. For instructions on how to use the replay client for storing the gameplay, see the pdf document and the SOCReplayClient class javadoc.

human.sql file is a dump of the database that contains the gameplay from the human corpus. The log files will be released by the STAC project (https://www.irit.fr/STAC/).

SERVER AND ONLINE GAMES

Running online games requires a mysql database; see javadocs for soc.server.database.SOCDBHelper.java on how to set up the db. Starting the server can be done via the following command:java -cp STACSettlers-1.0-bin.jar soc.server.SOCServer -Dstac.robots={number of robots to start} portNumber max_connections dbUser dbPass

HOW TO RUN THE DEEP RL AGENT

Running this agent requires Node.js and the installation of the modules contained in web folder.

(1) Run the server (DRL agent):<YourPath>/java/web/main$ node runserver.js N.B. If you want to change the host and port of the remote server, open the file YourPath>/java/config.txt and edit the variables "TCPServer_*"

(2) Run the client (JSettlers):<YourPath>/java/$ scripts/run_simulation.sh config-drl.txt N.B. If you want to change the host and port of the remote server, edit the host+port in method "getTradeFromServer" of file YourPath>/java/src/soc/server/SOCServer.java and recompile

The output of the server should look like this:

*TCP Server for JSettlers*
libraries loaded!
config file loaded!
configurations defined!
brain created!
Initialised agent!
Loading policy ../../web/policies//simpleds-policy-0.json
Network initialised!
Running in test mode!
<Press ctrl+c to quit>
request 100
request 200
request 300
request 400
request 500
request 600
request 700
...

SCRIPTS

The scripts folder contains a set of example scripts for the most common usages. Note that the jar must be renamed to STACSettlers.jar from STACSettlers-1.0-bin.jar before running the scripts.

COPYRIGHT NOTICE

STACSettlers and Jsettlers are licensed under GNU General Public License version 3. Below is the copyright notice for the STACSettlers part of the code and the license is included in LICENSE.txt. The license for JSettlers project is included in src/resources/LICENSE.txt. JavaBayes, mdp-library and weka jars contained in lib folder are also licensed under GPL v3. MCTS-1.0 (https://github.com/sorinMD/MCTS) and DeepCatan-0.0.1 (https://github.com/sorinMD/deepCatan) jars are licensed under the MIT license.

STACSettlers - An extension to the JSettlers framework
Copyright (C) 2017  STAC

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 97.5%
  • JavaScript 2.4%
  • Other 0.1%