Skip to content

Recreate RL interface #2

@WillieCubed

Description

@WillieCubed

Overview

The baselines currently rely on a low-level socket to handle communication and send commands. As more complex RL models are developed using this library, such communication with the game client should be abstracted into an interface like one popularized by OpenAI's Gym.

Implementation

The PolycraftEnv should support the following functions:

  • reset
    • Prepares the client for a new experiment
  • step
    • Sends an action to the client and receives an observation
  • close
    • Shuts down the client

Additionally, the game should be initialized when the constructor is called. The environment should support the following workflow:

from polycraft_env import setup_env

env = setup_env()
observation = env.reset()
for episode in range(10):
    action = 'SENSE_ALL'
    observation, reward, done, info = env.step(action)
env.close()

And for convenience it should support context manager functionality:

from polycraft_env import setup_env

with setup_env() as env:
    for episode in range(10):
        action = 'SENSE_ALL'
        observation, reward, done, info = env.step(action)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions