openai / procgen

Procgen Benchmark: Procedurally-Generated Game-Like Gym-Environments
https://openai.com/blog/procgen-benchmark/
MIT License
1.02k stars 210 forks source link

Changing background colour #11

Closed srikarym closed 4 years ago

srikarym commented 4 years ago

Is there an easy way to change the background color of maps in fruitbot while keeping the rest of the objects same? Background color is one of the attributes that varies across levels. I'm trying to change it without having to manually modify the pixel values.

christopherhesse commented 4 years ago

You can set it to use whatever backgrounds you want here: https://github.com/openai/procgen/blob/master/procgen/src/games/fruitbot.cpp#L42

topdown_backgrounds is loaded here: https://github.com/openai/procgen/blob/master/procgen/src/resources.cpp#L108 so you can replace those filenames with the files you actually want to load.

srikarym commented 4 years ago

I installed procgen via pip and I couldn't find the cpp files in site-packages/procgen. I was able to change the background by downloading the source and editing the cpp and running procgen from the source code folder because it is built and then executed. Is there a way I can pass an argument while creating the env from python, based on which a certain map is selected?

christopherhesse commented 4 years ago

I'm afraid there is no option for that. You can add your own option if you want, game-level options should be parsed here: https://github.com/openai/procgen/blob/50b607bbad69282043a2cd42591016520ca9747f/procgen/src/game.cpp#L41

christopherhesse commented 4 years ago

And on the python side they are set here: https://github.com/openai/procgen/blob/master/procgen/env.py#L98

srikarym commented 4 years ago

This is helpful. Thanks