,

Exploring Dungeon Environments with gym-md

Blake Bradford Avatar

·

Exploring Dungeon Environments with gym-md

MiniDungeons Screenshot

Are you a fan of dungeon exploration games? Look no further than gym-md – a python reimplementation of the popular game MiniDungeons. In this article, we’ll dive into the world of dungeon environments and explore the features and capabilities of gym-md.

Overview

gym-md is a reimplementation of the dungeon exploration game MiniDungeons, created as an OpenAI Gym environment. MiniDungeons is well-known as a benchmark research domain for modeling decision-making styles of human players. With gym-md, you can leverage this environment to develop and test AI algorithms, analyze player decision-making, and more.

Installation

Installing gym-md is a breeze. Simply use pip to install the gym-md package from PyPI:

#bash
pip install gym-md

If you want to build and run tests from source code, follow the instructions provided in the README.

Usage

Using gym-md is straightforward. After importing the necessary packages, simply create an instance of the desired gym environment. In the example below, we create an instance of the md-test-v0 environment:

#python
import gym
import gym_md

env = gym.make('md-test-v0')

With the environment set up, you can now interact with it using the step method. This method takes an action as input and returns the observation, reward, done flag, and additional information. Here’s an example of using the step method:

#python
observation = env.reset()
done = False

while not done:
    action = env.action_space.sample()
    observation, reward, done, info = env.step(action)
    # process the outputs accordingly

The MiniDungeons Gym Environment

The gym-md environment consists of a grid world representing the MiniDungeons game stage. The environment provides a variety of actions for the agent to take, including heading towards monsters, treasures, potions, and the exit. The environment also provides observation values, rewards, and termination flags based on the agent’s actions.

Actions

The available actions in the gym-md environment are represented as a list of floating-point values. Each index in the action list corresponds to a specific action. For example, index 0 represents “heading to the monster,” index 1 represents “heading to the treasure,” and so on. The environment selects the action with the highest value in the list.

Environment

The gym-md environment provides several objects and methods to interact with. The env object contains information about the current stage, the environment’s settings, the grid representation of the stage, and the agent’s attributes. You can access these objects and attributes to gather information about the current state of the environment.

Levels and Settings

You can create your own levels by inheriting from the MdEnvBase class and specifying the stage’s name. Additionally, you can customize the level’s properties by modifying the respective level JSON and TXT files. To add your own levels to gym-md, make sure to update the necessary files.

For a complete list of available gym-md environment levels, please refer to the Stages README.md or env_levels.txt files.

Conclusion

With gym-md, exploring dungeon environments has never been easier. You have learned how to install and use gym-md, understand the available actions, and interact with the environment’s objects. You also have the ability to create and customize your own levels, opening up countless opportunities for AI development and decision-making analysis.

If you have any questions or need further assistance with gym-md, feel free to reach out. Happy exploring!

References

This article was written by Blake Bradford for the fictional technology blog “Tech Talk”. For licensing information, please refer to the repository’s LICENSE file.

Leave a Reply

Your email address will not be published. Required fields are marked *