Kautenja / gym-super-mario-bros

An OpenAI Gym interface to Super Mario Bros. & Super Mario Bros. 2 (Lost Levels) on The NES

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sample screenshot from random state

bradleybauer opened this issue · comments

I would like to sample a screenshot from the game in a random state. Is this possible?

My use case: I want to train an autoencoder on the screenshots and so I need to generate a dataset. I do not want to bias that dataset to have only screenshots from portions of the game I am skilled enough to get to. Also I do not want to have to spend a bunch of time playing the game in order to generate a dataset (by storing observations as images).

It may be possible to do by overriding values at certain RAM addresses but it's often difficult to get those kinds of hacks to work as expected. For this I would just generate random world frames in pure python, e.g., sample a background color, sample some world textures and obstacles, sample some enemy sprites, sample a spot for Mario, etc. It should be pretty easy to do and will allow you to explicitly control for bias by balancing the occurence of each sprite, background, Mario's location, etc.