Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug for VizdoomEnv #574

Closed
caozhenxiang-kouji opened this issue Dec 15, 2023 · 3 comments
Closed

Bug for VizdoomEnv #574

caozhenxiang-kouji opened this issue Dec 15, 2023 · 3 comments
Assignees
Milestone

Comments

@caozhenxiang-kouji
Copy link

caozhenxiang-kouji commented Dec 15, 2023

There seems to be a serious bug with your VizdoomEnv.

When I use the following code to build a doom environment:

import gymnasium
from vizdoom import gymnasium_wrapper

env = gymnasium.make("VizdoomHealthGathering-v0", frame_skip=4)

And I try to use the following code to step forward for the environment:

obs, reward, terminated, truncated, info = env.step(env.action_space.sample())

And my agent is always moving forward and never turn left or right.

It seems that if the env.step function takes in an int type, the env_action in env.step function can produce correct results like [0,0,0],[0,0,1],[0,1,0],[1,0,0]. However when the env.step function takes in a numpy.int64 type, the env_action will turn into [0,0,0],[1,1,1],[2,2,2],[3,3,3], which forces the agent to keep moving forward.

My way of solving this bug is to write another gym.Wrapper to overwrite the step function:

class ChangeAction(gym.Wrapper):
    def step(self, action):
        action = int(action)
        return self.env.step(action)

It doesn't seem to be an elegant way since every time you make a environment you should wrap it again. But it works fine.

Hopes you can fix this bug soon!

mwydmuch added a commit that referenced this issue Dec 15, 2023
@mwydmuch mwydmuch added this to the 1.2.3 milestone Dec 15, 2023
@mwydmuch mwydmuch self-assigned this Dec 15, 2023
@mwydmuch
Copy link
Member

Hi @caozhenxiang-kouji, thank you very much for the report; this is indeed a serious bug! The fix will be merged soon, and a new patch release should be available on PyPI in a few hours.

mwydmuch added a commit that referenced this issue Dec 15, 2023
@mwydmuch
Copy link
Member

I released new version 1.2.3 that fixes the problem, it should be deployed to PyPI in ~2-3h. Once again, thanks for reporting the problem.

@caozhenxiang-kouji
Copy link
Author

Great, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants