GithubHelp home page GithubHelp logo

virtualcommons / foraging Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 6.0 16.82 MB

Spatially explicit, multiplayer foraging experiment for studying collective action

License: MIT License

Java 99.35% HTML 0.03% Batchfile 0.07% Shell 0.02% Python 0.51% Dockerfile 0.03%
collective-action multiplayer-game java experiments social-ecological-systems

foraging's Issues

data processing pipeline

aggregate participant round data into summary files:

  • Round (1-60)
  • Block (1-3)
  • Growth rate (low, medium, high)
  • Bot type (nice, aggressive)
  • Date
  • ID (101-219)
  • Total number of tokens harvested by subject during the round
  • Total number of tokens harvested by bot during the round
  • Time (500-40000) when for the first time the number of tokens on the screen is 0 (if never, say 50000 so we can sort this)
  • Total number of tokens on the screen at the end of the round
  • Total number of movements by subject during the round
  • Total number of movements by bot during the round
  • Average distance between the avatars of bot and subject during the 40 seconds
  • SCL (average over the 40 seconds of the round)[this info is not in the game data, but where is it?)

fMRI UI changes

  1. don't render number for single person / private property or 2 person games
  2. change harvest animation: when issuing a harvest request, square behind the dot highlights to green. On successful harvest, overlay token onto the dot, then fade it out.
  3. change token image to fill back square

update treatment configuration

  • 3x3 treatment with no bot / nice bot / aggressive bot X low / medium / high growth rates
  • fix instructions w.r.t. payments
  • 20 repeated rounds
  • expose movement / harvest probability in configuration

Key data variables:

  • number of tokens in the resource per second of each round (I guess this could be connected to biopack data, is this also data in seconds?)
  • number of tokens collected per round
  • number of tokens left in the resource at the end of the round

possible classloader issue

Deployment at Carleton is unsuccessful, possibly due to OpenJDK vs Oracle JDK classloader issues:

# ant demo
...
compile:

prepare-demo:

demo:

check-configuration:

BUILD FAILED
/opt/foraging/build.xml:202: The following error occurred while executing this line:
/opt/foraging/build.xml:311: Did not find any configuration files in src/main/resources/configuration, please copy over an appropriate set of configuration files into src/main/resources/configuration

Total time: 3 seconds
# java -version
openjdk version "1.8.0_71"
OpenJDK Runtime Environment (build 1.8.0_71-b15)
OpenJDK 64-Bit Server VM (build 25.71-b15, mixed mode)

split quiz results page from instructions

For coding expedience the quiz results are shown alongside the current round instructions. Daniel would like to change this into separate screens but this would involve adding another GUI click through window for quiz results, or (better long-term) refactoring how quizzes are rendered.

Relevant code in GameWindow2D.createQuizListener

disable sanction guards

Currently costly sanctioning is only allowed if there are still resources on the board to prevent revenge sanctioning after the round is effectively over. Dan would like to disable this rule for the next set of treatments.

remove time remaining label from embedded TextEntryPanel

During in-round-chat, no need for duplicate time remaining label. Also the thread of execution that updates it is not being cleaned up when we manually start a round while chat is running, creating spurious time remaining data

Participants placed in groups of 1 (Docker, demo config files)

I've been unable to get the demo configuration files and the docker setup included in the repository to work properly. Whenever we run the facilitator and connect to it with 5 clients, each client is placed in it's own harvesting group instead of all competing on the same board. The initial practice round and questions seems to work fine.

We've tried setting clients-per-group and removing that configuration value (as 5 appears to be the default group size in the code).

I know it's loading the configuration files correctly since other changes I've tried, like board size, are reflected in the clients. Any help or advice you could provide would be really appreciated. It's entirely possible I'm misunderstanding what the demo files are supposed to produce.

Java 8 webstart issues

Java 8 clients appear to make a separate initial request that generates an invalid stream header exception on initial socket connect - need to investigate and fix. Killing the server and restarting it pops up a notification on the client saying "Do you want to connect to x.x.x.x?". At that point if you click OK on the client, it will connect normally to the server.

Mar 21, 2015 1:09:15 PM edu.asu.commons.net.ServerSocketDispatcher processIncomingConnections
INFO: incoming connection: Socket[addr=/72.201.66.20,port=49539,localport=16001]
java.io.StreamCorruptedException: invalid stream header: 47455420
        at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:806)
        at java.io.ObjectInputStream.<init>(ObjectInputStream.java:299)
        at edu.asu.commons.net.SocketDispatcherWorker.<init>(SocketDispatcherWorker.java:38)
        at edu.asu.commons.net.SocketDispatcherWorker.<init>(SocketDispatcherWorker.java:42)
        at edu.asu.commons.net.ServerSocketDispatcher.processIncomingConnections(ServerSocketDispatcher.java:91)
        at edu.asu.commons.net.AbstractServerDispatcher$2.run(AbstractServerDispatcher.java:118)
Mar 21, 2015 1:09:15 PM edu.asu.commons.net.AbstractServerDispatcher$2 run
SEVERE: IO Exception while processing incoming connections: java.io.StreamCorruptedException: invalid stream header: 47455420

dust off MovieCreatorProcessor

It's likely the quick time movie processor will no longer work due to missing / aging libraries. Check if it's still functional and see if there are any viable replacements to generate movies from the data files again.

ostrom lab pretest

Pretest 2 participants in a group, full vision, twice as large as private property

spontaneous generation

Private property round had spontaneous generation after all tokens appeared to be gone

single player optimizations

Single player version can be optimized to maintain the game state on the client and send it to the server in batches.

update bot types

rename aggressive/cooperative types to chase/nochase and add a givespace bot that values distance to the player

update data conversion

  • need to update conversion scripts to take into account new variables of interest
  • possibly aggregate by repeated round, with a file for each repeated round and add round number to column list

deal with upcoming java reflection security

Will need to do something about xstream serialization, either disable it or figure out how to permit "illegal" access.

     [java] WARNING: An illegal reflective access operation has occurred
     [java] WARNING: Illegal reflective access by com.thoughtworks.xstream.core.util.Fields (file:/home/alllee/workspace/foraging/lib/xstream-1.4.10.jar) to field java.util.TreeMap.comparator
     [java] WARNING: Please consider reporting this to the maintainers of com.thoughtworks.xstream.core.util.Fields
     [java] WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
     [java] WARNING: All illegal access operations will be denied in a future release

x-stream/xstream#101

strange SAXParseExceptions in round configuration

Super annoying bug related to the new FMRI config parameterization. Will reliably generate SAXParseExceptions whenever the 25 line is changed in source control. Changing it locally gets rid of the exception, but once it's committed it starts up again.

     [copy] Copying 150 files to /home/alllee/workspace/foraging/target/classes/conf                                                                                                                                                                                      [22/1833]
     [java] java.util.InvalidPropertiesFormatException: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
     [java]     at sun.util.xml.PlatformXmlPropertiesProvider.load(PlatformXmlPropertiesProvider.java:80)
     [java]     at java.util.Properties$XmlSupport.load(Properties.java:1201)
     [java]     at java.util.Properties.loadFromXML(Properties.java:881)
     [java]     at edu.asu.commons.conf.PropertiesConfiguration.loadProperties(PropertiesConfiguration.java:55)
     [java]     at edu.asu.commons.conf.ExperimentRoundParameters$Base.<init>(ExperimentRoundParameters.java:71)
     [java]     at edu.asu.commons.foraging.conf.RoundConfiguration.<init>(RoundConfiguration.java:146)
     [java]     at edu.asu.commons.foraging.conf.ServerConfiguration.createRoundConfiguration(ServerConfiguration.java:49)
     [java]     at edu.asu.commons.foraging.conf.ServerConfiguration.createRoundConfiguration(ServerConfiguration.java:28)
     [java]     at edu.asu.commons.conf.ExperimentConfiguration$Base.loadParameters(ExperimentConfiguration.java:181)
     [java]     at edu.asu.commons.conf.ExperimentConfiguration$Base.loadServerProperties(ExperimentConfiguration.java:170)
     [java]     at edu.asu.commons.conf.ExperimentConfiguration$Base.<init>(ExperimentConfiguration.java:150)
     [java]     at edu.asu.commons.conf.ExperimentConfiguration$Base.<init>(ExperimentConfiguration.java:137)
     [java]     at edu.asu.commons.foraging.conf.ServerConfiguration.<init>(ServerConfiguration.java:40)
     [java]     at edu.asu.commons.foraging.server.ForagingServer.<init>(ForagingServer.java:135)
     [java]     at edu.asu.commons.foraging.server.ForagingServer.main(ForagingServer.java:1181)
     [java] Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
     [java]     at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
     [java]     at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
     [java]     at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
     [java]     at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
     [java]     at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1438)
     [java]     at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:999)
     [java]     at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
     [java]     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
     [java]     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
     [java]     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
     [java]     at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
     [java]     at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:243)
     [java]     at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
     [java]     at sun.util.xml.PlatformXmlPropertiesProvider.getLoadingDoc(PlatformXmlPropertiesProvider.java:106)
     [java]     at sun.util.xml.PlatformXmlPropertiesProvider.load(PlatformXmlPropertiesProvider.java:78)
     [java]     ... 14 more
     [java] Exception in thread "main" java.lang.IllegalArgumentException: Couldn't loadFromXML using resource: conf/ and stream: java.io.ByteArrayInputStream@a09ee92
     [java]     at edu.asu.commons.conf.PropertiesConfiguration.loadProperties(PropertiesConfiguration.java:58)
     [java]     at edu.asu.commons.conf.ExperimentRoundParameters$Base.<init>(ExperimentRoundParameters.java:71)
     [java]     at edu.asu.commons.foraging.conf.RoundConfiguration.<init>(RoundConfiguration.java:146)
     [java]     at edu.asu.commons.foraging.conf.ServerConfiguration.createRoundConfiguration(ServerConfiguration.java:49)
     [java]     at edu.asu.commons.foraging.conf.ServerConfiguration.createRoundConfiguration(ServerConfiguration.java:28)
     [java]     at edu.asu.commons.conf.ExperimentConfiguration$Base.loadParameters(ExperimentConfiguration.java:181)
     [java]     at edu.asu.commons.conf.ExperimentConfiguration$Base.loadServerProperties(ExperimentConfiguration.java:170)
     [java]     at edu.asu.commons.conf.ExperimentConfiguration$Base.<init>(ExperimentConfiguration.java:150)
     [java]     at edu.asu.commons.conf.ExperimentConfiguration$Base.<init>(ExperimentConfiguration.java:137)
     [java]     at edu.asu.commons.foraging.conf.ServerConfiguration.<init>(ServerConfiguration.java:40)
     [java]     at edu.asu.commons.foraging.server.ForagingServer.<init>(ForagingServer.java:135)
     [java]     at edu.asu.commons.foraging.server.ForagingServer.main(ForagingServer.java:1181)
     [java] Caused by: java.util.InvalidPropertiesFormatException: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
     [java]     at sun.util.xml.PlatformXmlPropertiesProvider.load(PlatformXmlPropertiesProvider.java:80)
     [java]     at java.util.Properties$XmlSupport.load(Properties.java:1201)
     [java]     at java.util.Properties.loadFromXML(Properties.java:881)
     [java]     at edu.asu.commons.conf.PropertiesConfiguration.loadProperties(PropertiesConfiguration.java:55)
     [java]     ... 11 more
     [java] Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog.
     [java]     at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
     [java]     at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
     [java]     at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
     [java]     at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
     [java]     at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1438)
     [java]     at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:999)
     [java]     at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
     [java]     at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
     [java]     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
     [java]     at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
     [java]     at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
     [java]     at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:243)
     [java]     at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339)
     [java]     at sun.util.xml.PlatformXmlPropertiesProvider.getLoadingDoc(PlatformXmlPropertiesProvider.java:106)
     [java]     at sun.util.xml.PlatformXmlPropertiesProvider.load(PlatformXmlPropertiesProvider.java:78)
     [java]     ... 14 more

chat data improvements

  • generate unique group numbers across the entire experiment
  • add sort order: date > round > group > timestamp

improve deployment + configuration

update configuration:

  • rename round files to stage
  • remove 'a' and 'n' prefixes
  • create ant tasks to deploy appropriate fmri config and run test server / facilitator / client

add install / run scripts for centos + ubuntu

Add a simple install script for centos for Carleton. The Docker build still has issues with older kernels / distributions.

  • install ant via package manager
  • set up nginx
  • create appropriate build.properties (possibly)

add new resource regeneration type and config type

Add new ResourceDispenser.Type for non-neighboring-density-dependent (still spatially explicit / overall density dependent).

Algorithm:

  1. raw regrowth = number of trees * regrowth rate
  2. if raw regrowth > 1, Math.max(Math.round(raw regrowth * ratio of all open spots to total spots), 1)
  3. if 0 < raw regrowth < 1, use uniformly distributed random number to determine (e.g, 0.9 = 90% chance for new tree, 0.8 = 80% chance)

update decaro config

  • replace earning reductions with fines & monetary penalties rubric
  • make sure occupancy check is set
  • revert exit survey instructions change

data conversion issue

  [java] java.lang.NullPointerException
     [java]     at edu.asu.commons.foraging.data.MovementStatisticsProcessor.process(MovementStatisticsProcessor.java:58)
     [java]     at edu.asu.commons.experiment.SaveFileProcessor$Base.process(SaveFileProcessor.java:125)
     [java]     at edu.asu.commons.experiment.SaveFileProcessor$Base.process(SaveFileProcessor.java:100)
     [java]     at edu.asu.commons.experiment.Persister.processSaveDirectory(Persister.java:241)
     [java]     at edu.asu.commons.experiment.Persister.processSaveFiles(Persister.java:215)
     [java]     at edu.asu.commons.experiment.Persister.processSaveFiles(Persister.java:220)
     [java]     at edu.asu.commons.experiment.Persister.processSaveFiles(Persister.java:220)
     [java]     at edu.asu.commons.foraging.data.ForagingSaveFileConverter.convert(ForagingSaveFileConverter.java:38)
     [java]     at edu.asu.commons.foraging.data.ForagingSaveFileConverter.main(ForagingSaveFileConverter.java:53)

bot logic improvements

  • when searching for a new location, don't delay after harvest
  • add aggressive radius for token proximity, bot makes a beeline for closest point within the aggressive radius when enabled
  • reduce delays, actions should be less timed
  • distinguish between bot-beeline and within-player-radius behavior

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.