Skip to content

Game freezing / general robustness to wrapped game engine #161

Description

@vzhong

I've noticed that when randomly sampling actions in real text games (e.g. ZMachine games not generated by TextWorld), the game inevitably freezes/segfaults at some point (It seems like Jericho has the same issue). Since TextWorld is a RL environment for text games, can we make it more robust to these problems? For example, having a timeout failure or game crashed failure?

Here's a code snippet that consistently freezes on my machine:

# !mkdir -p games# !wget -q http://www.ifarchive.org/if-archive/games/zcode/Balances.z5 -O games/Balances.z5importtextworldimportitertoolsimporttqdmimportnumpyasnpnp.random.seed(0)
episodes=50episode_len=500scores= []
forepisodeinrange(episodes):
print('episode {}'.format(episode))
env=textworld.start('./games/Balances.z5')
env.reset()
env.seed(0)
verbs= [w.wordforwinenv._jericho.get_dictionary() ifw.is_verb]
nouns= [w.wordforwinenv._jericho.get_dictionary() ifw.is_noun]
actions= [' '.join(tup) fortupinlist(itertools.product(verbs, nouns))]
forstepintqdm.trange(episode_len):
act=np.random.choice(actions)
print(step, act)
game_state, score, done=env.step(act)
ifdone:
breakscores.append(score)
print(scores)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions