Farama-Foundation / MicroRTS-Py

A simple and highly efficient RTS-game-inspired environment for reinforcement learning (formerly Gym-MicroRTS)
MIT License
234 stars 45 forks source link

Broadcast error running partially observable example #135

Closed 4rChon closed 6 months ago

4rChon commented 8 months ago

The fully-observable example ran without errors.

I'm running the partially observable example with the following command:

python ppo_gridnet.py \
    --partial-obs \
    --capture-video \
    --seed 1

However I'm encountering the following broadcasting error: image

num_planes is correctly initialised with an additional entry for partial observation, giving it a length of 7. However, np.array(ro) obtained from responses.observation returned by self.vec_client.reset(...) has a length of 6. I've logged the shapes of the relevant variables here: image

It seems like passing the partial_obs argument to create a new JNIGridnetVecClient removes the unobserved units from the game state but does not add a feature indicating whether a unit is visible or not.

Looking at the GameState.java class, numVectorObservationFeatureMaps is fixed at 6. PartiallyObservableGameState.java does not add a new feature but removes the unseen units for the player.

I might be missing something. Has anyone else managed to run the partially observable example?

Thanks

DennisSoemers commented 7 months ago

@sladic has been looking / will be looking into this, he may already be able to point to a (partial) fix or later have an ETA for when it might be ready for merging into the official repo.

4rChon commented 7 months ago

Hi, any updates on this?

Sladic commented 7 months ago

Hi, sorry for the delay. There is indeed code missing for marking the visibility of the units. I hope the marking and broadcast error fix will be up early next week.

DennisSoemers commented 6 months ago

@4rChon with the latest code in the master branch of this repo (which, in turn, should also pull in updated code from the Java submodule), I expect this issue should be fixed.