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

[Feature Request] Support wrapper MaxAndSkipEnv for Atari #68

Closed
1 task done
LuciusMos opened this issue Apr 15, 2022 · 2 comments
Closed
1 task done

[Feature Request] Support wrapper MaxAndSkipEnv for Atari #68

LuciusMos opened this issue Apr 15, 2022 · 2 comments
Assignees
Labels
question Further information is requested

Comments

@LuciusMos
Copy link

LuciusMos commented Apr 15, 2022

Motivation

For Atari, you provide some built-in wrappers like OpenAI Baselines. OpenAI Baselines' wrappers include MaxAndSkipEnv. However I cannot find it in your built-in wrappers.

Solution

Can you explain why, and whether it is possible to support this wrapper?

Alternatives

Additional context

Checklist

  • I have checked that there is no similar issue in the repo (required)
@Trinkle23897
Copy link
Collaborator

MaxAndSkip steps n times and return maximum(obs[-2], obs[-1]). This is implemented in envpool. frame_skip argument is for that purpose.

int skip_id = frame_skip_;
for (; skip_id > 0 && !done_; --skip_id) {
reward += env_->act(action_set_[act]);
done_ = env_->game_over();
if (skip_id <= 2) { // put final two frames in to maxpool buffer
uint8_t* ale_screen_data = env_->getScreen().getArray();
uint8_t* ptr = static_cast<uint8_t*>(maxpool_buf_[2 - skip_id].data());
if (gray_scale_) {
env_->theOSystem->colourPalette().applyPaletteGrayscale(
ptr, ale_screen_data, kRawSize);
} else {
env_->theOSystem->colourPalette().applyPaletteRGB(
ptr, ale_screen_data, kRawSize);
}
}
}

@LuciusMos
Copy link
Author

Thank you so much!

@Trinkle23897 Trinkle23897 added the question Further information is requested label Jul 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants