Minigrid & Miniworld: Modular & Customizable Reinforcement Learning Environments for Goal-Oriented Tasks

Maxime Chevalier-Boisvert, Bolun Dai, Mark Towers, Rodrigo De Lazcano Perez-Vicente, Lucas Willems, Salem Lahlou, Suman Pal, Pablo Samuel Castro, J K Terry

In the reinforcement learning (RL) community, researchers often face a frustrating trade-off between simplicity and realism. Benchmarks like Atari or MuJoCo focus on high-dimensional visual processing or complex physics control, but they can be computationally expensive and difficult to modify for specific research questions like logical reasoning or instruction following. Conversely, high-fidelity 3D simulators (like Habitat or VizDoom) often have steep learning curves and heavy dependency chains.

To address this gap, researchers have introduced Minigrid and Miniworld, two open-source libraries designed to provide minimalist, highly customizable 2D and 3D environments. By prioritizing a unified API and low dependency overhead, these tools enable researchers to rapidly prototype goal-oriented tasks and study transfer learning between discrete 2D grids and continuous 3D spaces.

The Environments: Minigrid and Miniworld

The authors present two distinct but philosophically aligned libraries that serve as a "middle-ground" for RL research. Both are fast, highly hackable, and specifically designed for tasks involving navigation, object manipulation, and linguistic instructions.

Minigrid (2D)

Minigrid is a GridWorld environment where the world is represented as a matrix of tiles. Each tile can contain objects such as keys, doors, or balls. The agent operates with a discrete action space (turn, move, pick up, etc.) and typically receives a partial, top-down view of its surroundings.

Example of a 2D Minigrid environment showing a top-down view of the agent, a key, and a door.

Miniworld (3D)

Miniworld is a "2.5D" environment (utilizing a flat floorplan) that simulates 3D rooms and objects. It uses Pyglet for rendering, keeping it incredibly lightweight compared to heavy-duty engines like Unreal or Unity. The agent receives RGB image observations from a first-person perspective, simulating a more realistic visual input stream.

Example of a 3D Miniworld environment showing a first-person perspective of a room with objects.

The Unified API

Crucially, both libraries follow the Gymnasium (formerly OpenAI Gym) standard. This unified API allows researchers to write a single training script and seamlessly swap between a 2D grid and a 3D world with minimal code changes. The libraries also feature a world generation API that uses simple procedural functions to place walls, goals, and agents.

Key Insights and Results

  • Simplicity as a Feature: By intentionally limiting external dependencies (relying mostly on NumPy and Pyglet), the authors ensure the libraries are easy to install and less likely to break over time due to software updates.
  • Transfer Learning Success: The unified API makes it uniquely easy to study transfer learning. Agents initialized with weights from Minigrid (2D) learned significantly faster in Miniworld (3D) than agents starting from scratch. Interestingly, transferring the critic network and mission embeddings yielded better results than transferring the actor network. This suggests that the "value" of a state (how close the agent is to a goal) translates better across dimensions than the specific "policy" (how to move).
  • The Human-RL Bridge: Because the environments are easy for humans to play, they serve as a rare platform where human and RL agent performance can be compared directly on the exact same task logic. In a study with 10 subjects, humans successfully transferred spatial reasoning from 2D to 3D, maintaining consistent goal-seeking behavior despite randomized controls.

Limitations and Future Work

While highly effective for rapid prototyping, the minimalist design comes with inherent limitations. Because the libraries are implemented in pure Python for ease of use, they are slower than environments built on C++ engines. Furthermore, they cannot simulate complex physics (e.g., friction, fluid dynamics) or hyper-realistic visual textures. The system dynamics are "idealized," meaning policies learned here might not transfer directly to real-world robots without additional sim-to-real bridging techniques.

Moving forward, the authors plan to expand the libraries to better support human-in-the-loop decision-making and more complex multi-agent scenarios. With widespread community adoption already secured, Minigrid and Miniworld stand as vital tools for the modern RL researcher.

Summary updated

BibTeX
@inproceedings{chevalierboisvert2023minigrid,
  author = {Maxime Chevalier-Boisvert and Bolun Dai and Mark Towers and Rodrigo De Lazcano Perez-Vicente and Lucas Willems and Salem Lahlou and Suman Pal and Pablo Samuel Castro and J K Terry},
  title = {{Minigrid \& Miniworld: Modular \& Customizable Reinforcement Learning Environments for Goal-Oriented Tasks}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=PFfmfspm28},
}
Figure