Skip to content

Loading of Environment Timing Out #9

@ZachariusSousa

Description

@ZachariusSousa

Minetest version

Minetest 5.6.1 (Linux)
Using Irrlicht 1.9.0mt8
Using LuaJIT 2.1.1703358377
BUILD_TYPE=RelWithDebInfo
RUN_IN_PLACE=0
USE_CURL=1
USE_GETTEXT=1
USE_SOUND=1
STATIC_SHAREDIR="/usr/share/games/minetest"
STATIC_LOCALEDIR="/usr/share/locale"

Irrlicht device

No response

Operating system and version

Linux (Ubuntu 20.04)

CPU model

i9-14900HX

GPU model

RTX 4090

Active renderer

No response

Summary

I'm trying to run the simple custom environment example. It will try to start but while it saying "Connecting to server" on Luanti startup I continuously get the following error.
==> Creating Minetest run directory: ./minetest-run-e8021cb4-c9b7-44b3-b84b-fbd4be86a5dd

Traceback (most recent call last):
File "/home/zss/Intrinsic/Testing/test.py", line 18, in
observation, info = env.reset()
^^^^^^^^^^^
File "/home/zss/Intrinsic/.venv/lib/python3.12/site-packages/craftium/craftium_env.py", line 191, in reset
_observation, _reward, _term = self.mt_chann.receive()
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/zss/Intrinsic/.venv/lib/python3.12/site-packages/craftium/mt_channel.py", line 32, in receive
img, reward, termination = mt_server.server_recv(
^^^^^^^^^^^^^^^^^^^^^^
ConnectionError: Failed to receive from MT. Connection closed by peer: is MT down?
I believe I've followed all the proper steps and it does try to run. It works fine when manually starting a world with
./bin/luanti Any help would be greatly appreciated thank you so much in advance.

Steps to reproduce

import time
import os

from craftium import CraftiumEnv

env = CraftiumEnv(
env_dir="/home/zss/Intrinsic/Environment/small-room",
render_mode="human",
obs_width=512,
obs_height=512,
minetest_dir="/home/zss/Intrinsic/craftium"
)

print(env)

iters = 1000

observation, info = env.reset()

ep_ret = 0
start = time.time()
for i in range(iters):
action = dict() # empty action (do nothing)
observation, reward, terminated, truncated, _info = env.step(action)

ep_ret += reward
print(i, reward, terminated, truncated, ep_ret)

if terminated or truncated:
    observation, info = env.reset()
    ep_ret = 0

end = time.time()
print(f"** {iters} frames in {end-start}s => {(end-start)/iters} per frame")

env.close() This is my code snippet and I followed the Creating custom environments section of the docs. It fails at the Using the custom environment section.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions