Closed goekce closed 5 months ago
I believe you will need to define the keys_to_action
parameter that specifies keyboard presses to actions in the game
@pseudo-rnd-thoughts you can try this example:
import gymnasium as gym
from gymnasium.utils.play import play
env = gym.make("Blackjack-v1", render_mode="rgb_array")
play(
env,
keys_to_action={
"0": 0,
"1": 1,
},
# noop=0, default is `0`
)
env.close()
Play
automatically continues after each step to not interrupt the environment.
@goekce Apologies for not replying, yes, play was designed for high fps games, therefore, does not consider turn based games where you want to wait for a user action. We would happily accept a PR to add this feature
I don't have the capacity to improve play
right now. At least a note in the docs could save time for the users.
Question
I would like to use
utils.play.Play
to playBlackjack
, however I failed.utils.play.Play
does not wait for keypresses and proceed with the next step using thenoop
key (default 0) if the user does not provide any input.Can
utils.play.Play
be used for playingBlackjack
? Or: Isutils.play.Play
primarily implemented for high fps games likeCarRacing
?If yes, I can happily open an enhancement request to note that in the docs.