In the world of Alita: Battle Angel, the newest sci-fi movie from Robert Rodriguez based on the manga by Yukito Kishiro, the last remnants of humanity are obsessed with one thing: motorball. In this unholy spectacle (imagine basketball, NASCAR, and the X-Games rolled into one), athletes strap on rocket skates and race to steal possession of a ball and “dunk” it for points.

On the big screen, it looks awesome, but filming it for Alita was anything but easy. Production took almost four years from conception to final cut, in addition to the months of training, choreography, and visual effects work in between.

“You had to make sure the game made sense,” Rodriguez tells Inverse about directing the fictional sport. “That was my main focus, and the sequence I worked on the longest. From the end of 2015 to just a few weeks ago when I saw the finished version.”

"We just needed the feel of an actual sport that placated the masses.” — Robert Rodriguez

Audiences see two versions of motorball in Alita: Battle Angel. The first is a “pick-up” game played by teenagers in an Iron City alley. That’s where Alita, a 300-year-old amnesiac cyborg played by Rosa Salazar, learns to play. The second is a tryout for the pro league. Set inside Iron City’s humungous arena, Alita races against fearsome, cybernetically enhanced competitors in futuristic killer gear.

Producer and co-writer James Cameron (left) and director Robert Rodriguez (right) on the set of 'Alita: Battle Angel.' Rodriguez says Cameron's scripting of the film's motorball scenes were so clear, it was like reading what Cameron simply wrote in his head. 20th Century Fox

Each presented their own challenge. While the arena sequence took years to complete, the pick-up game was shot in just two days, with real professional rollerbladers performing stunts on set.

“You couldn’t make it a CG sequence, you had to shoot it live,” Rodriguez says. “And because there are no powered skates, it was a lot of trick photography, pulling people on cables and real skaters who could do flips and tricks from all angles. We had years to do the second motorball [scene] on computer. That one we only had two days that I had to break down, shot by shot.”

And because there is “so much action” and “so many characters” in both sequences, it’s very easy to lose the audience. So, like in any sport, Rodriguez devised a strategy with one goal.

“It was clarity that I focused on,” he says, “because it’s easy to get lost in a big action sequence. You don’t want to lose a sense of [Alita] and her emotions.”

To achieve clarity, Rodriguez studied the filming style of NASCAR, perhaps the most obvious real world point of reference.

“I don’t want the cameras flying around the place, doing things impossible to shoot,” he says. “I wanted the physics of real cameras, placement you would see in NASCAR. Long lenses, capturing things whizzing by, as well as cameras on the track with the players to keep it as real world as possible.”

Throughout the process of directing motorball, Rodriguez had a few aces up his sleeve. The first one was the script, co-written by producer James Cameron and Laeta Kalogridis. Rodriguez says it laid out the action so clearly it was as if Cameron “wrote what he was watching in his head.”

“It was really Jim’s [James Cameron] script,” he says. “It was so refreshing to read something by a director; he was gonna direct this. You could follow it shot by shot with such clarity, that I just tried to capture that. I just thought, ‘Man, we’d have a great sequence if I could capture it.’”

Another advantage was the fact motorball wasn’t over-explained in Kishiro’s manga — unlike J.K. Rowling’s exhaustive detailing of Quidditch in the Harry Potter novels.

“Because it wasn’t really explained how it worked in the manga, we can kind of throw rules out the window,” the director says. “We just needed the feel of an actual sport that placated the masses.”

When motorball goes wrong, in the original 'Battle Angel Alita' manga. Illustrated by Yukito Kishiro. Kodansha Comics

The final advantage Rodriguez had was his lead star, Rosa Salazar, who tells Inverse she didn’t even know how to rollerblade before shooting Alita.

“It’s extremely dangerous!” she says.

Though Salazar went through months of martial arts training, including Muay Thai, kung fu, and “staff work,” she found learning to rollerblade just as intimidating.

“It was honestly really challenging,” Salazar says. “It’s incredibly fast and you need to be very strong in your legs to accomplish those moves.”

The motorball scenes in Alita: Battle Angel feature stunts performed on camera by some of the world’s top in-line skaters, including Chris Haffey, Franky Morales, Dave Lang, and 2003 X-Games competitor Katie Ketchum, who performed the motion capture for Alita.

While Ketchum skated on the alley set, Salazar was “off to the side” skating in front of reference cameras that recorded her facial expressions. The two performances were combined in post-production.

“Those guys are fearless,” Salazar says of the skaters. “Those guys you’re seeing in the pick-up game, they’re really doing that stuff.”

Right from the start, Rodriguez knew motorball could be something special. “It was just something I’ve never seen before,” he says, “That kind of danger, that kind of speed and fluidity in the action.”

But the ultimate payoff came when Kishiro, who created the manga Battle Angel Alita (titled Gunnm in Japan), saw Rodriguez’s vision for motorball and was blown away.

“That was the biggest thrill,” the director says, “Showing him the movie and having him respond beyond our dreams. That it went into the streets, he never thought of that. He thought that was the coolest thing in the world.”

Alita: Battle Angel hits theaters on February 14.