The secrets to gaming gravity

The secrets to gaming gravity

“Find the fun.” Game development’s common refrain can manifest as the creation of a new game mechanic, the refinement or combination of existing mechanics, or making something simple — like jumping, flying, and fighting — feel great. Even falling.

In games like Fortnite, Apex Legends, and The Legend of Zelda: Tears of the Kingdom, plummeting from the open skies to the hard ground below is an experience. Simulated gravity pulls players downward, and game mechanics let them float, spin, and flourish as they fall. Simulated air friction may slow their descent, while visual effects like motion lines and field-of-view trickery help convey a sense of speed. Rocketing back upward to the skies, whether by jump pads or simply the strength of a game character’s two legs, is defined by a separate force that needs to feel fun, too.

Gravity is part of the physics engine of every video game, says Chris Winder, leading gameplay engineer at Apex Legends developer Respawn Entertainment. “The gravity in Apex is about twice that of normal Earth gravity,” Winder said in an email to Polygon. “This, combined with similarly increased jump velocities, is one trick games use that can help to make the game feel faster while still feeling within the bounds of realism.”

Physics simulation is generally thought of as a function of simulation games like the Gran Turismo series or Kerbal Space Program, but Winder points out that “it’s present to some degree in nearly every game we play, from Super Mario Bros. to Rocket League to Apex Legends.”

Orange and blue cars zip into the sky to chase a ball in Rocket League
Rocket League
Image: Psyonix

Video games can not only manipulate the strength of gravity to meet their needs, they can simply ignore it when they want to — all in service of making it feel good, said Jeremy Russo, game director at Velan Studios. His studio’s sports title Knockout City uses a gravity effect inspired by fighting games to help the game feel better. (Interestingly, Knockout City’s gravitational constant takes a different approach to Apex; it’s about half of Earth’s gravity.)

“Something we do both for gameplay reasons and for improved game-feel is briefly override normal gravity and character velocity for certain abilities,” Russo explained. In Knockout City, the developer makes your character hover briefly while throwing the ball mid-jump. “The gameplay reason for this is because the throw animation takes a few frames before the ball is released, so if we continued the player’s full velocity up or down then the ball was often thrown into geometry. It also just felt wrong, so we took a cue from some brawler and fighting games that briefly hover players in the air when they melee attack.”

Russo says “the extra level of polish to make this feel right involved resetting the player’s velocity if they were on their way down, or setting a new slower velocity if they were on their way up, because actually hovering at a specific height for multiple frames also felt wrong.” His team applied this same methodology, with varying degrees of special-case adjustment, to lots of abilities, like catching, dashing, and balling up.

Two characters leap through the air, one with ball in hand, in a screenshot from Knockout City
Knockout City
Image: Velan Studios

“Gravity is a force that pulls stuff ‘down’ every single frame of the game,” said Chris Mercado, technical designer at Velan. “The fun comes from deciding where ‘down’ is! [We] can mess around with both magnitude and direction as much as we want. Some games work with a constant universal down (Super Mario 64), others have custom spherical gravity (Super Mario Galaxy); at the end of the day, gravity works the way the devs need to make the game they want to make.”

Those forces go beyond the expected up and down of jumping and falling, Winder said. In Apex Legends, players can use jump pads and gravity lifts to push themselves upward (then fall). The same physics-based approach also applies to things like grappling hooks.

“There’s a lot that goes into how these elements move players around to make each of them feel fun and useful,” Winder said. “This can mean accurately simulating the real physics of a player launching through the air or being pulled by a grappling cable while also enabling some less-than-realistic inputs to this simulation to give players the control they expect.”

Apex’s Legend Pathfinder has a grappling hook that pulls the player toward a grapple point, “but looking in a particular direction to the sides applies a small force so that players can ‘curl’ the grapple,” Winder explained.

Respawn similarly fudges another Legend’s ability. “Horizon’s gravity lift applies an upward force to players but also allows for directional input to move around in the lift and exit it,” Winder said. “There’s also a hidden force that sometimes acts to keep people in the lift so they don’t accidentally fall out.”

Apex Legends - Pathfinder uses its grapple
Apex Legends
Image: Respawn Entertainment/Electronic Arts

That kind of air control is innately familiar to players of many games. In Super Mario Bros. and Sonic the Hedgehog games, you can exert a force on a character who’s jumped to achieve better control of their jumps.

“As a developer, some of the things I find incredibly interesting are things that are invisible to most players that make platforming significantly more usable,” said Velan’s Jeremy Russo. “The most obvious one is air control… you can’t change your lateral direction mid-air after jumping in real life, but most games give you some amount of control.” Developers apply similar tricks for jumps, Russo said, by letting players jump a few frames after they’ve walked off a ledge.

“The amount of control the player has while they’re in the middle of a jump is one of the most fun aspects to mess with,” said Doug Applewhite, a programmer and designer. “It’s a surprisingly difficult situation to feel good and ‘right’, and there’s lots of options you have to play with.”

“I think it’s important to realize that the jump is often a player’s first connection to the physics of a game world,” said Hunter Bridges, game director at Penny’s Big Breakaway developer Evening Star. “The jump intuitively tells the player a lot about how the game works, often within the first few seconds of gameplay.”

Penny swings on a thread in Penny’s Big Breakaway
Penny’s Big Breakaway
Image: Evening Star/Private Division

Bridges explained his studio’s approach to jumping in its 3D platformer, explaining that Evening Star wanted to make sure its titular character’s “jump happened with no startup delay.”

“Penny leaves the ground on the first frame the jump input is detected,” he said. “Some other games may wish to have a few frames of startup delay to illustrate anticipation, or otherwise better match the jump animation.”

Bridges, who also worked on 2D platformer Sonic Mania, said that crafting jumping in Penny’s Big Breakaway’s 3D space presents a very different challenge from that of old-school side-scrolling Sonic the Hedgehog platforming.

“In 3D games, you are always wrestling with the fact that your 3D scene is projected onto a 2D screen,” Bridges said. When a game’s 3D camera pitches or rotates, “it becomes difficult to perceive distance along the camera direction due to foreshortening.” That’s something 2D platformers don’t have to worry about.

Developers work around that foreshortening problem, Bridges explained, by making enemies larger, making players’ jumps higher, and being more tolerant of near misses in 3D games by fudging collision detection and giving players recovery abilities. (“This is where Penny’s Ledge Pull move came from,” Bridges said.)

Outer Wilds guide for the Ember Twin Chert’s Camp, quantum caves, and Lakebed Cave
Outer Wilds
Image: Mobius Digital/Annapurna Interactive via Polygon

One of the most fascinating implementations of physics as it relates to jumping and gravity is how Mobius Digital’s space exploration game Outer Wilds handles the simple act of leaping. It has to consider more than just the player’s movement, but also the physics of a small solar system.

“With video games, you [have] to keep the camera near the center of the world’s coordinate space, or […] everything starts kind of jittering,” explained Outer Wilds co-creator Alex Beachum in a 2020 documentary about the creation of the game. “So we have to keep the player near the mathematical origin of the world. […] But because [in] ours, everything’s moving relative to each other, what I ended up doing is: Every time we apply a force to the player, we just apply an opposite force to every physics object in the world that’s currently simulating.

“So when you jump in Outer Wilds, technically every planet’s jumping out from under you, and you’re more or less not moving. It works,” Beachum said, “and we haven’t changed it.”

Beachum’s solution to solving a complicated math problem by simulating jumping in Outer Wilds was implemented out of necessity, but it also serves the higher purpose: finding the fun.

“[A] player’s intuition of how gravity should work is generally more important than reality,” Mercado said. “That’s why most space-combat games have air friction and terminal velocities! At the end of the day, we’re making fun interactive media, so our physics should facilitate that fun.”