Skip to content

Web application where humans can play Overcooked with AI agents.

Notifications You must be signed in to change notification settings

HumanCompatibleAI/overcooked-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Web application where humans can play Overcooked with AI agents.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published