Skip to content

HumanCompatibleAI/overcooked_ai

Repository files navigation

MDP python tests overcooked-ai codecov PyPI version "Open Issues" GitHub issues by-label Downloads arXiv

Overcooked-AI 🧑‍🍳🤖

5 of the available layouts. New layouts are easy to hardcode or generate programmatically.

Introduction 🥘

Overcooked-AI is a benchmark environment for fully cooperative human-AI task performance, based on the wildly popular video game Overcooked.

The goal of the game is to deliver soups as fast as possible. Each soup requires placing up to 3 ingredients in a pot, waiting for the soup to cook, and then having an agent pick up the soup and delivering it. The agents should split up tasks on the fly and coordinate effectively in order to achieve high reward.

You can try out the game here (playing with some previously trained DRL agents). To play with your own trained agents using this interface, or to collect more human-AI or human-human data, you can use the code here. You can find some human-human and human-AI gameplay data already collected here.

NOTE + LOOKING FOR CONTRIBUTORS: DRL and BC implementations are now deprecated. We used to include code for training BC and PPO agents in the human_aware_rl directory. See this issue for more details.

This benchmark was build in the context of a 2019 paper: On the Utility of Learning about Humans for Human-AI Coordination. Also see our blog post.

Research Papers using Overcooked-AI 📑

Installation ☑️

Installing from PyPI 🗜

You can install the pre-compiled wheel file using pip.

pip install overcooked-ai

Note that PyPI releases are stable but infrequent. For the most up-to-date development features, build from source. We recommend using uv to install the package, so that you can use the provided lockfile to ensure no minimal package version issues.

Building from source 🔧

Clone the repo

git clone https://github.com/HumanCompatibleAI/overcooked_ai.git

Using uv (recommended):

uv venv
uv sync

Verifying Installation 📈

When building from source, you can verify the installation by running the Overcooked unit test suite. The following commands should all be run from the overcooked_ai project root directory:

python testing/overcooked_test.py

If you're thinking of using the planning code extensively, you should run the full testing suite that verifies all of the Overcooked accessory tools (this can take 5-10 mins):

python -m unittest discover -s testing/ -p "*_test.py"

See this notebook for a quick guide on getting started using the environment.

Code Structure Overview 🗺

overcooked_ai_py contains:

mdp/:

  • overcooked_mdp.py: main Overcooked game logic
  • overcooked_env.py: environment classes built on top of the Overcooked mdp
  • layout_generator.py: functions to generate random layouts programmatically

agents/:

  • agent.py: location of agent classes
  • benchmarking.py: sample trajectories of agents (both trained and planners) and load various models

planning/:

  • planners.py: near-optimal agent planning logic
  • search.py: A* search and shortest path logic

overcooked_demo contains:

server/:

  • app.py: The Flask app
  • game.py: The main logic of the game. State transitions are handled by overcooked.Gridworld object embedded in the game environment
  • move_agents.py: A script that simplifies copying checkpoints to agents directory. Instruction of how to use can be found inside the file or by running python move_agents.py -h

up.sh: Shell script to spin up the Docker server that hosts the game

human_aware_rl contains (NOTE: this is not supported anymore, see bottom of the README for more info):

ppo/:

  • ppo_rllib.py: Primary module where code for training a PPO agent resides. This includes an rllib compatible wrapper on OvercookedEnv, utilities for converting rllib Policy classes to Overcooked Agents, as well as utility functions and callbacks
  • ppo_rllib_client.py Driver code for configuing and launching the training of an agent. More details about usage below
  • ppo_rllib_from_params_client.py: train one agent with PPO in Overcooked with variable-MDPs
  • ppo_rllib_test.py Reproducibility tests for local sanity checks
  • run_experiments.sh Script for training agents on 5 classical layouts
  • trained_example/ Pretrained model for testing purposes

rllib/:

  • rllib.py: rllib agent and training utils that utilize Overcooked APIs
  • utils.py: utils for the above
  • tests.py: preliminary tests for the above

imitation/:

  • behavior_cloning_tf2.py: Module for training, saving, and loading a BC model
  • behavior_cloning_tf2_test.py: Contains basic reproducibility tests as well as unit tests for the various components of the bc module.

human/:

  • process_data.py script to process human data in specific formats to be used by DRL algorithms
  • data_processing_utils.py utils for the above

utils.py: utils for the repo

Raw Data 📒

The raw data used during BC training is >100 MB, which makes it inconvenient to distribute via git. The code uses pickled dataframes for training and testing, but in case one needs to original data it can be found here

Deprecated: Behavior Cloning and Reinforcement Learning

Further Issues and questions ❓

If you have issues or questions, you can contact Micah Carroll at mdc@berkeley.edu.