Examples of rendered and/or interactive RLLib environments?

Hi, does anyone have example code to get ray to render an environment? I tried using the env_rendering_and_recording.py file but it didn’t actually render anything (I think I am misunderstanding how it works or something).

I would like to just view a simple game like connect four or cartpole or something. I imagine this file I linked above is intended as the reference for env rendering, maybe it is a bug that a window didn’t pop up for me or something? I checked the ray_results folder and didn’t find anything rendered in there either. I was going to make an issue on GitHub but I think it is probably user error. That said, better documentation for that file would be nice as I am not even sure what it is supposed to yield.

My end goal is to adapt custom env I have created to be trained with RLLib and be able to watch the games (to see if the agents are actually performing intelligently), and eventually allow a human to interact with a trained agent. I would think that this would be something a lot of people would be interested in doing, but I couldn’t find good examples of either rendering or custom input/interactive environments.

In PettingZoo there is a single example of an interactive environment with basic keyboard input but nothing using mouse input. Maybe OpenSpiel or something else has games in which humans can play against trained agents?

I’d be interested in this too… I’m building an env that only renders at the end of a train iteration. There’s no way to find out whether the agent is taking actions or whether the reward system is sufficient enough for the agent to take an action until the training is done.

Such a rendering solution would be great

I’m not sure exactly what you’re looking for but since posting this I’ve gotten an interactive example working, just having issues getting the agent to learn. I made a little PR for rllib with an example of doing this with pettingzoo, although now a few of the workarounds to get it working with gymnasium are no longer necessary so I think I’ll update it. But that file has some simple example code for having an environment render the game normally after training.

Once I get training to work I’ll upload working code for pettingzoo rendering and interaction with RLlib to my project’s repo here: GitHub - elliottower/gobblet-rl: Interactive Multi-Agent Reinforcement Learning Environment for the board game Gobblet using PettingZoo.