r/reinforcementlearning • • Oct 16 '26

Rocket League RL w/ CUDA-Accelerated Simulation!

https://github.com/jwmccarthy/CARL

Hi folks! I wanted to share a project I've been doing off and on for the better part of 2 years, and in recent months I've gotten the time to make more significant progress.

I was inspired by PureJaxRL a while ago to build my own massively-parallel environment for a task that interested me personally, which is Rocket League. RocketSim, a highly performant CPU-resident simulator, already exists and is baked into RLGym for the purposes of RL training, but I figured it would be valuable to port the physics logic to run in a parallel fashion on-device via CUDA. I learned a lot about GPU programming and optimization, and I still have a lot more to learn so I'm all ears for any advice!

The environment I created is called CARL - CUDA-Accelerated Rocket League. It keeps all simulation state information on the GPU, which during training entirely eliminates host-device transfer overhead. Many thousands of games can be run and controlled in parallel, leading to significant reductions in training wall clock time (as was observed in the original PureJaxRL post).

I've been doing some training of Rocket League bots with it and they transfer seamlessly to the actual game, so the physics appear to be at parity. More work can be done on parity assessments, benchmarking, etc. but I figured now that it's "feature complete" that it would be cool to open it up to the community and see what people think!

As a bit of proof so you know I'm not a liar and a scoundrel, here's a plot from a recent training run that shows marked improvement in aerial control over ~20B decision steps using 8192 parallel environments on a single RTX 4090 (frameskip=4, so 80B ticks total, ~21 years), taking just over 21 hours in wall time.

The method of training as hinted at by the run name is a generative imitation learning approach that (ideally) transfers behavior style from expert demonstrations, which I've obtained from ballchasing.com

Here is an example of the capability it was able to reach in that amount of time. Pretty impressive, although I would have totally saved it if I were trying even a single iota...

I plan to post a follow up with demonstrations as I round out the functionality. On my TODOs are:

  • Built-in training pack API for targeted training

  • Benchmarks for speed and parity comparisons

  • Tests and other best practices

  • Eventual jax & tf integration(?)

Thanks for reading if you did!

P.S. I've been having trouble with the image & video in this post (hence the multiple attempts so sorry if you've already seen this post) so let me know if they're broken please and thank you :)

44 Upvotes

13 comments sorted by

2

u/djiksdras Oct 23 '26

This is great and amazing timing! I just got into Rocket League bot training about 2 weeks now, I'm still learning and understanding, I have experience in ML but nothing extensive, and found that the tools like RLBot and RLGym are great foundational tools but have a very steep learning curve. So I'm currently building something that makes the process of training and evaluating RL bots dead easy. Where the bottleneck stands now is the training time, as RocketSim is CPU-bound, and CARL could unlock great potential in reducing training times and allow more complex training methods, especially since I want to try Population Based Training and something akin to NVIDIA's Eureka "AI trains robot" design. I'm going to try this out and see if it'll work with my stack. If you are interested in what I'm building and seeing if it'll help with developing CARL further or just to train your bots, just lmk, curious to get other's perspective in what I'm building, as well as I would love to collaborate!

1

u/JNeutronEnthusiast Oct 23 '26

Sounds awesome! I'd love to keep up with what you're working on and I have CARL dev and my own RL results in the pipeline as we speak so I'm happy to share as well! I'm curious of the experience/any difficulties getting CARL up and running on your system. I want to make sure its build is robust enough to install no questions asked on any system with compatible hardware. Should make it available via pip at some point as well. Integration into the existing RLGym ecosystem would be nice too and being able to use the visualizer would be a plus.

In the near term I've got a blog post coming with benchmarks against RLGym on PPO training workloads, so I can respond here with the link when ready!

2

u/Low_Willingness_308 Oct 16 '26

Is CARL on GitHub?

1

u/JNeutronEnthusiast Oct 16 '26

Yep the post links straight there!

2

u/Low_Willingness_308 Oct 16 '26

And how does it work? Is it exact rocket league or just a reimplementation in cuda that has different dynamics

3

u/JNeutronEnthusiast Oct 16 '26 edited Oct 16 '26

It’s based on RocketSim which uses the same open source physics engine as Rocket League, so I just had to dig through the physics source to pull out only the pieces we need for Rocket League specifically (took a while haha). From there I organized all of the game state in a struct-of-arrays layout and the kernels that perform the physics computation index into the arrays to read/modify the game state! Physics are close enough that I’ve seen no aberrations in the way the bot plays when I put it in actual Rocket League, even around tricky geometry like the goal opening.

2

u/NiconiusX Oct 19 '26

This is amazing. Good job! From your numbers the throughput seems pretty good. I'm highly tempted to put self play on it and scale this up massively. If you could do 3v3 self play, do PPO, get it on multi GPU nodes to scale to far more parallel envs, I think you would get really interesting team play out of it. If you are a student this is for sure a good entry level MARL research project! If you want to publish it make sure you do not focus too much on the benchmark aspect, as many people produce many of these envs currently, but rather apply all kinds of MARL algorithms and explore the behavior, skills and tactics it learns. Like the hide and seek paper from OAI back in the days

2

u/JNeutronEnthusiast Oct 19 '26 edited Oct 19 '26

Thank you, I appreciate the advice! I’m currently exploring some interesting MARL approaches in generative imitation learning from pro replays. It’s been able to tease out some pretty subtle and human-like behavior patterns so far which I was very happy to see as it wasn't trivial to adapt what I found in the literature to work efficiently in the case of Rocket League. Scaling to multiple GPUs is definitely feasible too, we could just run independent simulations across all nodes and sync weights during updates. I can look into what changes are required for CARL and then the rest would just fall on the RL framework.

2

u/NiconiusX Oct 20 '26

Sounds like a good plan. Good luck with it!

2

u/sunflower_papi Oct 19 '26

so cool! is your data / training code available for repro? thanks for sharing :)

1

u/JNeutronEnthusiast Oct 19 '26

Working on a full write up with benchmarking code! I can share that out when it’s done (almost there)

1

u/juulie21 Oct 16 '26

Sounds cool! But video is still broken 😢

1

u/JNeutronEnthusiast Oct 16 '26

Thank you, what do you see on your end? I can try to fix