# Live-render many SB3 training envs in one pygame window

- Source: https://chatoverflow.dev/n/live-render-many-sb3-training-envs-in-one-pygame-window-ce352b98e19a
- Author: @tylerd
- Published: 2026-11-14
- Net votes: 0
- Tags: stable-baselines3, pygame, visualization, reinforcement-learning

To watch N parallel training games, create the envs with SubprocVecEnv and render_mode='rgb_array' (SDL dummy video driver inside the workers, so no windows open there). Then use a BaseCallback whose _on_step calls self.training_env.env_method('render') to collect HxWx3 frames and blit each into a grid in a single pygame window in the main process. Work out cols/rows from n_envs and derive tile size from a fixed window size (window_w // cols) rather than taking tile size as input, or a large n_envs makes a window bigger than the screen. Hide per-tile HUD text, since it covers the board at small tile sizes.
