Coder Social home page Coder Social logo

aclodic / overcooked-demo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from humancompatibleai/overcooked-demo

0.0 0.0 0.0 14.38 MB

Web application where humans can play Overcooked with AI agents.

Shell 0.31% JavaScript 46.10% Python 28.97% CSS 2.17% PureBasic 11.08% HTML 10.75% Dockerfile 0.63%

overcooked-demo's Introduction

Overcooked Demo

A web application where humans can play Overcooked with trained AI agents.

Installation

Building the server image requires Docker

Usage

The server can be deployed locally using the driver script included in the repo. To run the production server, use the command

./up.sh production

In order to build and run the development server, which includes a deterministic scheduler and helpful debugging logs, run

./up.sh

After running one of the above commands, navigate to http://localhost

In order to kill the production server, run

./down.sh

Dependencies

The Overcooked-Demo server relies on both the overcooked-ai and human-aware-rl repos. The former contains the game logic, the latter contains the rl training code required for managing agents. Both repos are automatically cloned and installed in the Docker builds.

The branch of overcooked_ai and human_aware_rl imported in both the development and production servers can be specified by the OVERCOOKED_BRANCH and HARL_BRANCH environment variables, respectively. For example, to use the branch foo from overcooked-ai and branch bar from human_aware_rl, run

OVERCOOKED_BRANCH=foo HARL_BRANCH=bar ./up.sh

The default branch for both repos is currently master.

Using Pre-trained Agents

Overcooked-Demo can dynamically load pre-trained agents provided by the user. In order to use a pre-trained agent, a pickle file should be added to the agents directory. The final structure will look like static/assets/agents/<agent_name>/agent.pickle. Note, to use the pre-defined rllib loading routine, the agent directory name must start with 'rllib', and contain the appropriate rllib checkpoint, config, and metadata files. For more detailed info and instructions see the RllibDummy_CrampedRoom example agent.

If a more complex or custom loading routing is necessary, one can subclass the OvercookedGame class and override the get_policy method, as done in DummyOvercookedGame. Make sure the subclass is properly imported here

Use the human vs. human game mode.

With the Overcooked demo, you can test the interaction between two human players. To do this, you need to deploy this code on the server (https://docs.docker.com/language/python/deploy/). After successful deployment, the first user should open http://[server_ip_address]/, select the human keyboard input for both players and click on "Create game". If everything has been successful, he will receive a message: "Waiting for game to start". Another user should open a page at http://[server_ip_address]/psiturk to start the game.

If you want to run a test on a local computer, you should use "localhost" instead of "server_ip_address" and open the corresponding links in different tabs.

Updating Overcooked_ai

This repo was designed to be as flexible to changes in overcooked_ai as possible. To change the branch used, use the OVERCOOKED_BRANCH environment variable shown above.

Changes to the JSON state representation of the game will require updating the JS graphics. At the highest level, a graphics implementation must implement the functions graphics_start, called at the start of each game, graphics_end, called at the end of each game, and drawState, called at every timestep tick. See dummy_graphcis.js for a barebones example.

The graphics file is dynamically loaded into the docker container and served to the client. Which file is loaded is determined by the GRAPHICS environment variable. For example, to server dummy_graphics.js one would run

GRAPHICS=dummy_graphics.js ./up.sh

The default graphics file is currently overcooked_graphics_v2.1.js

Configuration

Basic game settings can be configured by changing the values in config.json

Legacy Code

For legacy code compatible with the Neurips2019 submission please see this branch of this repo.

overcooked-demo's People

Contributors

nathan-miller23 avatar micahcarroll avatar decodyng avatar rohinmshah avatar alexlichtenstein avatar jyan1999 avatar mesutyang97 avatar alexdigimaker avatar bitbanger avatar dependabot[bot] avatar

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.