NeuralNextG v0.1.0: Analyzing Rocket League Games automatically with Machine Learning
I fed 200,000 Rocket League games into a neural network and all it said was "What a Save!"
This project has been sitting in my brain now for close to seven years, so this post has the potential of becoming long and unwieldy. I’ll start off with a very brief rundown of what I’ve done and save the details for later.
The short of it
I have downloaded 200,000 Rocket League games and fed them into a neural network, and created a website where you can analyze games frame-by-frame. The neural network has learned how to predict the probability of each team scoring at any point in play. Given the position and velocity of the ball and all of the cars in the game, the algorithm NeuralNextG (short for Neural Next Goal, a riff off of xG in soccer, and Neural Networks, the technology used to make this prediction) will give an accurate probability of who will be next to score. The algorithm works frame by frame and can analyze a game in just a few seconds. For now I am taking every pro game and hosting the NeuralNextG results on top of a (admittedly janky) 3-D visualization of the game that I have created. I will be updating this with every new Rocket League pro game and it will be free for the foreseeable future. For now it can be used as analysis of games that have happened, but further extensions could cover a range of topics, from automated coaching/scouting of players, in-game win probabilities, reliable automated detection of smurfs/bots from replay files (I will discuss this later). It could also simply exist as an oddity. Currently, I will be working on a few tricks to improve the predictions, though I am quite happy with where they are at the moment.
Here I have created a video showing how to use this tool.
I am always open to feedback so email me at NeuralNextG@joey.computer if you have any cool ideas or want to collaborate/talk business! I am also super interested in applying this to other games, and working with matchmaking algorithms in general. So if you feel like we could work together, do not hesitate to email. Also, whenever I get a free moment I will be streaming the analysis of games on my twitch channel https://www.twitch.tv/joeydotcomputer, and if you’re interested in new releases to this or other projects I do, please follow this substack!
The site itself is https://scrumps.dev, a fun game to look at (that I look at a part of in-depth in the video) is this one https://www.scrumps.dev/games/12d7907e-4135-48d9-9268-e316644731e3. I’ve added all the replay files available from this weekend’s US tournament and the previous weekend’s EU tournament. Have fun!
Anyway, there it is in brief, feel free to close this browser and play around on the site. For anyone interested, here is the rest.
The long of it
First up I’ll give you a bit of background on how I came up with NeuralNextG, why I decided to start developing it, and how it works. I’ll talk about how Epic/Psyonix/any other f2p developer could use something like NeuralNextG, before discussing next steps, and then go over possible questions.
A love letter to Rocket League / What is NeuralNextG?
In July 2015, I logged onto PSPlus which had just started releasing free games monthly and downloaded Rocket League. I instantly fell in love.
In my eyes what sets Rocket League apart from other games and what provides its longevity is the emergent complexity: you’re driving a car, there is a ball, you want that ball to go in the other person’s goal and they want the ball to go in yours. Despite such a simple premise, Rocket League has managed to be so captivating that it has been my most played game ever since. Even now, seven years into it, I log on for at least a few hours a week genuinely grinning from ear to ear: when I’m winning, I feel accomplished, when I’m losing, I’m in awe: I have no one to blame but myself - me and my opponent are both driving the same car, but they can do something that I can’t and it looks great. I don’t have to keep up with patch notes to see what gun is more impactful, I don’t have to look out for a cheap trick or bug that people are using to win – all we have is physics, and all I have to do is to hit the ball, hit another car, or move to a certain space to give my team the best chance of winning. And that’s what led me to NeuralNextG
I am not a particularly outstanding Rocket League player. I was Champion 1 at my peak and I am currently fighting to stay in Diamond 2, but all 3v3 ranked games I’ve ever played in my life have been solo queueing. When you don’t have a voice chat with your teammates (and probably often when you do) all you can do is perform actions yourself which maximize your team’s chance of scoring. The way I started to think about Rocket League is like that: what action could I do which would increase my team’s chance of being the next to score?
Look at this state of the game: if you had to bet, what odds would you put on orange scoring here? (This is my janky visualization, the orange cuboids are orange cars, the blue cuboids are blue cars, the blue mesh is the blue goal and the white mesh is the ground).
How about here?
Situation 2 is more likely to result in a goal. You have two opposing players right next to the ball and no one to stop them. In the first case you have one orange player on the ball, but two blue players in goal ready to try and save. Therefore the decisions made by the cars (such as to go back and defend the goal or not) have a direct impact on the likelihood of a goal being scored.
The way I tried to teach myself to think about Rocket League was like this: What are the range of outcomes if I take this action and what is their combined probability of helping us score? When I am not communicating with my team, all the primary information I have is this:
Where are all the cars and the ball on the field?
How fast are they moving?
Which way are they pointing?
This doesn’t seem like much, but there’s actually a lot of intent hidden in just those variables. If my teammate is moving away from the ball to the opposite corner, they’re probably going to go to get some boost, and are likely available to defend. If my opponent has jumped and they’re pointing towards the ball in my possession, they’re probably going to try to tackle me. If an off-ball opponent is driving straight at me at full-speed while I’m sitting in the middle of the goal, I’m about to get demolished.
At the time when I started thinking of Rocket League I was in the middle of doing my PhD. My PhD was applying machine learning methods to cosmological simulations. In cosmological simulations typically what you have are massive blobs of dark matter, and they all impart their gravity onto one another. All that matters in these cosmological simulations is the position and the speed of the particles and you can predict the future based on that. In my PhD, I demonstrated that neural networks (machine learning algorithms designed to look like the human brain) were really effective at taking these position-velocity simulations and making inferences on them. So sitting at home, solo-ranking standard and subconsciously trying to calculate our chance of scoring at any point using the position-velocities of these cars, it was obvious to think “couldn’t a computer do this?”. The computer can have access to exactly the same data I do.
That was probably 2016. I finished my PhD in the meantime, I had a few jobs applying machine learning to a range of different domains. Whenever I got a chance, I would bore anyone I could about this Machine Learning idea for Rocket League. All I needed was a lot of Rocket League data and the motivation to actually make it. For a long time, the Rocket League data wasn’t there. I remember messaging someone very helpful on reddit about trying to get this data and being linked to a 500GB torrent of .replay files, however after 2-300 GB it became clear that the full file wasn’t being seeded (a familiar feeling to anyone who was on the internet in the early noughties). I also was deep in work and the idea of working on something in my spare time seemed impossible. After leaving a job last year, and finding out that ballchasing.com had created a really easy way to download a bunch of Rocket League games, I got to work.
Now here I am, 7 years since the original idea with 1.1TB of Rocket League data and a trained model showing that my idea did actually work. My computer went through every frame of this data and gave it labels saying who was next to score, and using a large neural network (and a bunch of tricks to make it work) I trained NeuralNextG. Each frame, the network takes only the position, velocity, orientation etc., of the ball and the cars and it can give an accurate probability of who is next to score.
My pitch to Epic Games/Psyonix and other f2p game developers
If there are users like me out there, Rocket League has a dedicated user base who struggles to spend money in the game. As someone relatively uninterested in cars and who got the dabbing ghoul goal explosion early on, my lifetime spend on Rocket League is lower than the monthly cloud cost for this project.
Free to play games have generally been a positive thing but (from an external, uninformed view), there is work to be done to make it a sustainable model for financing an online game. How can you provide a service to a longtime user that they’re willing to pay for, to cover server and development costs?
Games such as Overwatch or MOBAs do so by restricting non-paying players to certain characters, which is not possible in Rocket League’s case and also generally unpalatable to the fanbase. If combined with balance issues it can feel a bit like pay-to-win, which is something to be avoided.
For software companies, the general rule is that users feel more amenable to paying for a service when the price of it is correlated to the cost to provide it. I think it would be possible to attach something like NeuralNextG, combined with automated highlight reel generation and coaching to the Rocket League season pass, and attract seasoned players into paying for it. In general charging users for this makes sense and is explainable to them, as storing this data and analyzing it is not free.
A good model to compare this to is chess.com. Any user can make an account and play as many games as they wish, free of charge. This allows there to be no barrier to onboarding new players, which keeps server populations high. However, stockfish, the chess NeuralNextG equivalent (and part of my inspiration), is a high compute-intensive method of analyzing and coaching players on how to get better at chess. Unlimited use of stockfish is restricted to subscribers of chess.com, and there are many subscribers who use this analysis tool to look over their previous games and work out what they should do better. This would be possible to do in Rocket League and many other f2p games.
I suppose you could then call this a pay-to-learn model. This is better than the pay-to-win model because although it still gives the paying users an advantage, this advantage is much more fair: the rules of the game remain the same, and any increase in skill due to learning will simply end up as an increase in rank, and more difficult opponents. A player beating you because they were taught by an algorithm how to do an aerial seems much fairer than a player paying for 100 boost on kickoff.
There is an appetite for personalized data products. With Spotify Wrapped, Spotify has demonstrated that users see value in these data products, and chess.com has built a lucrative business from an ancient board game purely off of the back of it. I believe it's possible that the next step for f2p games is to implement something similar.
(And I would like to help you do it: NeuralNextG@joey.computer)
Next Steps
I have absolutely loved doing this project and if possible I would love to continue. There are a range of things that can be done with this that I would like to explore further, especially with a bit more time (and, to be honest, money). I’ll provide an overview of these down below. In its current form, I intend to continue to show NeuralNextG calculations for pro matches as they happen, and I would be thrilled if these were used by viewers of games or presenters, similar to the way something like AWS Next Gen Stats are used in sports like the NFL. If you are interested, let me know! Financially, there are two major concerns: one is that extensions of this project takes time currently dominated by my job (and my weekend/life/etc.,). Secondly, the amount of data and cloud computation that has gone into this project is not insignificant (right now it's costing me about as much as my gym per month, and I expect this to increase). If these extensions are of interest, I’m open to taking this further: acquisition, Patreon, a SAAS api as an integration to other sites. Send me an email. But as it stands it’s free for anyone to use, without ads.
Coaching/personalized highlight reels
I think that there is a bright future ahead for in-game automated analytics like this. Why couldn’t a game provide every player with a Spotify-style Wrapped, showing you your best plays in the week/month/year? Further, it would be possible to identify the worst plays in that time: developing a system that could identify errors you made that could have been avoided. These could be stitched together to make a training pack of shots/saves that are specific for each player.
Automated Scouting of pro players
The Rocket League E-sports world is a huge industry, and there are many extremely talented people trying to become professional players. With access to .replay files, either through ballchasing.com or elsewhere, it would be possible to automatically score players’ contributions and highlight the best players before they make it to pro tournaments or opens.
In-match win probability
NeuralNextG is an automated way of evaluating what the story of the game is. Anyone who watches sport can tell you that the end score of a game doesn't tell you the whole story. If you have a five game series and the first game is won by Team A 2-0, it could either be a complete domination where Team B never had a look on goal and Team A just waited the game out after two easy goals, or it could be that Team B had a multitude of chances that it failed to utilize. The probability of winning in case 1 for team A is much better than in case 2, and NeuralNextG would be a great way of representing that.
Detecting Smurfs/Bots automatically
Matchmaking models are typically dependent on TrueSkill, which examines the player’s wins and losses and evaluates their skill based on that. This has worked fantastically and I would not advise it to change, however, it enables bad actors to exploit the matchmaking. Smurfs are users who either create new accounts or deliberately lose to reduce their ranking so they are matched against lower skill opponents. Research has shown that the best player experience comes when evenly matched with your opponent, and so removing or reranking these players would improve user experience greatly. An extension of NeuralNextG would look at a user’s games and see if the way they play is significantly better than their rank would suggest, and flag them as potential smurfs. In the same way this type of analysis could identify Bots (such as the ones forked from the RLGym project) as they are playing. (As an aside, big shout out to the RLGym people, that is an extremely cool project and I wish I had the patience to deal with Reinforcement Learning.)
Email me: NeuralNextG@joey.computer.
Potential Questions with answers
How is NeuralNextG related to Nexto/RLGym? Isn’t that Rocket League & Machine Learning?
Yes and no! The difference between the two projects is in method and aim. The aim of RLGym is to create a theoretically perfect Rocket League bot, and it does that by making a bot play against itself and teach itself to win. This is known as reinforcement learning: the algorithm learns by doing, and successes/failures reinforce the algorithm’s decisions.
NeuralNextG’s aim is to understand how humans play Rocket League, by using supervised learning: the algorithm is given data and labels, and learns that situation X leads to a goal for orange, and situation Y leads to a goal for blue, and uses these various observations to understand all situations.
A telling difference between NeuralNextG and RLGym is that a bot trained in RLGym would say that the best kickoff strategy is to not go for the ball but delay slightly; see this video at 2.10:
This is a great strategy for a bot as you have perfect reaction time. No matter your opponent’s play, you can instantly react to it. However NeuralNextG would say this was a bad strategy, by taking a human’s reaction time into account.
To put it simply, a bot trained in RLGym plays how God would play, whereas NeuralNextG is for the rest of us.
What does the percentage mean in NeuralNextG?
Currently (though I am looking at a change for v0.2.0), NeuralNextG is trained to predict which team will score next. Therefore it predicts just one percentage probability, and what that percentage probability says is “what chance would you give of orange scoring next?” So to give some examples:
NeuralNextG: 50% → 50% blue will score next, 50% orange will score next
NeuralNextG: 30% → 30% blue will score next, 70% orange will score next
NeuralNextG: 90% → 90% blue will score next, 10% orange will score
I am currently testing a change to this.
Is this the best the model can do?
I made sure to put v0.1.0 in the title because I think that this model can definitely improve! I’m following the Minimum Viable Product concept partially because it would be great to get feedback from users (particularly if the feedback is “no-one cares, who asked”), and partially because working on this any more without releasing it would be untenable. I’m already working on changes to the way the neural network is changed to try to improve predictions.
Thanks!
Thanks for taking the time to read this post! I’m having a lot of fun doing this project and am really excited to hear from people about it. As a reminder, feel free to:
try out NeuralNextG at https://scrumps.dev
email me at NeuralNextG@joey.computer
follow me on twitch at twitch.tv/joeydotcomputer for occasional RLCS analysis with NeuralNextG
follow this substack to hear about new NeuralNextG releases or other projects that I’m working on.