Custom Gymnasium Environment… observation_space?

Hi, thanks for reading this.

I’m trying to adapt a ‘snake’ game to the Gym.Env() class, but struggling to get my head around the observation space.

The games output is a 3-channel ‘screen’, represented by a numpy array with size(19,19,3), containing either 1’s or 0’s.

There’s also a bunch of other self.variables, initialised in the Env() class and updated by the Env.step() method, that are only used to calculate the screens output. (E.g. head position etc.)

Two questions:

Should these other self.variables be returned from the env.step() and included in the observation space? (I don’t intend to train the RL algo with them).

Assuming no, how do I define a suitable observation_space for just the ‘screen’ array? I guess it uses spaces.Box(low=np.array(0) , high=np.array(1) , shape=(19,19,3), dtype=np.int8) …is that correct?

submitted by /u/Low_Corner_9061
[link] [comments]

Leave a Reply

The Future Is A.I. !
To top
en_USEnglish