Otto Bonilla: RL Playground

Learning experiment

RL Playground: building a reusable Gymnasium basketball environment

A custom reinforcement-learning environment library with basketball physics, wind, manual play, a ballistic controller, and reusable Gymnasium interfaces.

An environment and the agent learning inside it solve different problems. RL Playground separates a reusable simulated world from the training studies that import it, beginning with a basketball launcher.

Feel the physics before training

The player chooses angle and launch power while reading a wind indicator. Gravity, rim edges, and backboard collisions influence the shot. Wind changes between attempts and stays fixed during a shot.

Manual play, a hardcoded ballistic controller, and neural examples provide different ways to explore the same world. The ballistic demo solves projectile equations; it is a reference controller rather than a learned strategy.

Make the environment an importable dependency

The library registers BasketballLauncher-v0 with Gymnasium. Other Python projects can create it through the familiar reset, step, and close interface. Human rendering, RGB-array output, and headless use support different workflows.

Physics, scoring, configuration, rendering, and examples live within the basketball module. The environment does not require PyTorch; the optional training extra supplies the neural examples and chart tools.

One environment and simplified physics

Basketball Launcher is the first implemented environment. The modular layout allows others to be added, but the repository does not yet supply a catalog of additional worlds.

Wind is modeled as horizontal acceleration rather than airflow. That simplification makes the task controlled and inspectable. It should not be interpreted as an experimentally validated basketball simulation.

Reuse the world in a separate study

Basketball Shot imports this library instead of copying its environment code. Reading both projects shows where environment design ends and policy design, training, and evaluation begin. The README documents controls and integration examples.

Sources and further reading

Based on the linked project documentation, reviewed on 2 November 2026. Capabilities and limitations describe that documented version.

View repository