,

A Python-Based Benchmark Game

Lake Davenberg Avatar

·

Introduction

MiniDungeons is a simple turn-based roguelike puzzle game that serves as a benchmark problem for modeling decision-making styles of human players. It offers a framework for creating artificial agents capable of representing these decision-making styles. In this article, we will explore the MiniDungeons project, its objectives, and how it can be integrated with other software systems to create custom artificial agents.

The MiniDungeons Project

The MiniDungeons game was created with two primary purposes in mind. Firstly, it aims to investigate how human players enact decision-making styles in a simple game. Secondly, it provides a platform for constructing artificial agents called procedural personas, which mimic these decision-making styles. These personas make decisions based on a utility specified by the game designer, such as killing monsters, collecting treasure, surviving, or speedrunning to the exit.

The MiniDungeons project started in 2014 and has evolved over the years, resulting in numerous publications. It offers a codebase that includes the game simulation, 11 research-level maps, and a controller interface for creating custom artificial agents.

Integrating MiniDungeons with Other Software Systems

1. Docker

MiniDungeons can be integrated with Docker to easily package and deploy the game as a containerized application. Here’s an example Dockerfile for building a MiniDungeons container:

#dockerfile
FROM python:3.9

WORKDIR /app

COPY requirements.txt /app
RUN pip install --no-cache-dir -r requirements.txt

COPY . /app

CMD [ "python", "main.py" ]

2. FastAPI

FastAPI, a modern, fast (high-performance), web framework for building APIs with Python 3.7+ based on standard Python type hints, can be used to create a RESTful API for MiniDungeons. Here’s an example of how to create a basic API with FastAPI:

#python
from fastapi import FastAPI

app = FastAPI()

@app.get("/")
def read_root():
    return {"message": "Welcome to MiniDungeons API!"}

@app.get("/play")
def play_game():
    # Logic to play the MiniDungeons game
    return {"message": "Playing MiniDungeons!"}

3. SQLAlchemy

SQLAlchemy, a SQL toolkit and Object-Relational Mapping (ORM) library for Python, can be utilized to integrate MiniDungeons with various relational databases. Here’s an example of how to use SQLAlchemy to connect MiniDungeons with a MySQL database:

#python
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker

engine = create_engine('mysql://username:password@localhost/db_name')
Session = sessionmaker(bind=engine)
session = Session()

# Perform database operations using SQLAlchemy ORM

Advantages of Integration

Integrating MiniDungeons with other software systems provides several advantages:

  1. Docker enables easy packaging and deployment of the game, making it highly portable and scalable.
  2. FastAPI allows for the creation of a robust API, enabling easy interaction with MiniDungeons from external applications.
  3. SQLAlchemy provides a powerful ORM, simplifying database operations and offering flexibility in choosing the database technology.

By integrating MiniDungeons with these software systems, developers can leverage their respective strengths to enhance the functionality and usability of the game. This integration allows for seamless deployment, efficient communication through APIs, and convenient database management.

In conclusion, MiniDungeons serves as a valuable benchmark game for studying decision-making styles. By integrating it with other software systems like Docker, FastAPI, and SQLAlchemy, developers can extend its capabilities and create custom artificial agents. These integrations empower developers to explore innovative solutions, accelerating advancements in the cloud ecosystem.

References

Leave a Reply

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