Skip to content

Feature Implementation for Pressure Plates#6

Open
rynky wants to merge 19 commits intomainfrom
pressure-plates
Open

Feature Implementation for Pressure Plates#6
rynky wants to merge 19 commits intomainfrom
pressure-plates

Conversation

@rynky
Copy link
Copy Markdown

@rynky rynky commented Feb 26, 2026

Introduction

This PR introduces the new pressure plates feature in our Overcooked environment.

Features

Currently, pressure plates have the same action capabilities as buttons. There is support for both moving wall and barrier interactions.

See the ButtonAction() class in jaxmarl/environments/overcooked_v3/common.py for more information. You can find an action type cheat sheet at the bottom of this PR.

Currently, due to a bug, only toggling barriers is working. This has been put on low priority because there seem to be no good ideas for levels with pressure plates and moving walls.

Initializing your Pressure Plates

Example Initialization: Pressure Plate Demo Level

pressure_plate_demo = """
WWWWWWW
0 #_AWW <----- Pressure Plate 0
WWWW WW
P #_  X <----- Pressure Plate 1
WWWW WW
1 #_AWW <----- Pressure Plate 2
WWWWWWW
"""

Note:

  • Pressure Plates are denoted with the underscore "_"
  • Barriers are denoted with the hashtag "#"
  • All layouts must be defined in the dictionary overcooked_v3_layouts from jaxmarl/environments/overcooked_v3/layouts.py

To enable pressure plate functionality, you must append the following parameters to your layout configurations:

"map_name": Layout.from_string(
        ...
        pressure_plate_config=[ ... ],
        barrier_config=[ ... ],
    ),
pressure_plate_config = [ (target_index: int, action_type: int), ... ]
barrier_config = [ initial_barrier_state: bool, ... ]

Here's how it looks for the pressure_plate_demo layout:

"pressure_plate_demo": Layout.from_string(
        ...
        pressure_plate_config=[
            (1, ButtonAction.TOGGLE_BARRIER), # Plate 0 (Top) triggers Barrier 1
            (2, ButtonAction.TOGGLE_BARRIER), # Plate 1 (Middle) triggers Barrier 2
            (0, ButtonAction.TOGGLE_BARRIER), # Plate 2 (Bottom) triggers Barrier 0
        ],
        barrier_config=[
            True,  # Barrier 0 (Top) - initially active
            True,  # Barrier 1 (Middle) - initially active
            True,  # Barrier 2 (Bottom) - initially active
        ],
    ),

Note: JAX implicitly numbers static objects of the same type from left to right, top to bottom.

Action Type Cheat Sheet

For toggling barriers, use ButtonAction.TOGGLE_BARRIER.

The other (not working) action types are:

  • ButtonAction.TOGGLE_PAUSE
  • ButtonAction.TOGGLE_DIRECTION
  • ButtonAction.TOGGLE_BOUNCE
  • ButtonAction.TRIGGER_MOVE

e-ndorfin and others added 18 commits February 6, 2026 07:50
Implements two new environment features:
- Moving walls that travel in a direction each step, with optional
  bounce mode and agent-pushing behavior
- Buttons that agents can interact with to control linked walls
  (toggle pause, direction, bounce, or trigger single-step move)

Includes layout parsing (n/s/e/w for walls, ! for buttons), demo
layouts, visualizer sprites, and an interactive play script.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…tton or by time and does not trap agents when activated on the same tile
Fixed a bunch of overhead lag, demos in moving_wall_demo.py and moving_wall_bounce_demo.py
@SeanYeSchool
Copy link
Copy Markdown

I tried using Copilot to change the graphics of the barriers when they are deactivated by the pressure plates but it seems that it is quite troublesome and instead has the behaviour of removing the barrier completely. Might come back to this if its still desired.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants