Super Collider
A good hitbox is hard to make.
Most games are about one thing hitting another. A bullet and a soldier’s head; a platform and your foot; a sword and a demon’s arm; a jaw and a Shoryuken. And that means a lot of games are all about hitboxes, the invisible geometry which tells them when things collide.
But while they’re ubiquitous, hitboxes also exist in a thorny tangle of hard math and soft player perception. There’s a real art to making them feel great to play with, and there’s real genius in getting them to work right, since computers are surprisingly bad at dealing with collision. The result is that different games take completely different approaches to the ways hitboxes work.
In games like Monster Hunter World, your character’s hitbox pretty much matches what you see, so you can avoid getting hit by some attacks by simply changing your stance so it passes through your legs. “Ninety-five percent of the time I’m thinking about hitboxes!” says Monster Hunter champion speedrunner SD Shepard. “When I try to tell people how to get better, I tell them not to hit the monster but to stand there and watch how it moves. When it attacks, see where you have to be so it can’t hit you.”
That’s what you’d expect, right? WYSIWYG physical violence lends a visual consistency which helps you understand what’s happening and how to play well. But hitboxes in other genres don’t work like that at all. Look at shmups, for example, in which the hitbox for your ship is traditionally far smaller than what you see.
“This allows the player to dodge things they would have hit, resulting in many impressive near-misses that make the player feel great,” says Jim McGinley, developer of Endlight, an upcoming indie game which melds shmup action with music as you fly through abstract spaces.
SMASH HIT
Your ship in Endlight actually consists of three hitboxes. The smallest collides with walls and obstacles, encouraging you to take risks. The second is larger than your ship and collides with the hoops you’re attempting to fly through, turning near-misses into successes and making you feel skilful. The third is three times the size of your ship. This one triggers a ‘whoosh’ sound when you pass near walls and obstacles.
Hitboxes, after all, aren’t only for physical collisions. They also govern the way the world behaves, triggering events and effects. Instant-death dodge-’em-up Disc Room also features whooshes as your hitbox grazes its blades, as well as applying a dose of screenshake (one of its developers is Jan Willem Nijman, who uses screenshake liberally in Nuclear Throne), and it slows down time.
“It notifies you of the danger and gives you more time to react,” Nijman explains. “Basically, we want exciting moments to happen as often as possible. It feels much better to make an impossible escape than to die from something that looked easy.”
Disc Room’s blades have two different hitboxes – faster blades have smaller boxes – a tactic shared with N, Metanet’s platformer. “The gold collision shape became a little bigger and the mines a little smaller, so it’s less frustrating, less clunky to get around,” says co-designer Mare Sheppard. “You figure out your plan for how you want things to go, and these tiny changes help that plan become more likely to be successful, without making you feel the game is unfair or too generous.”
That’s because hitboxes aren’t really meant to be about technical truth. They’re about making a game feel like it’s reflecting your actions in the way you expect. When hitboxes are too accurate, they can make a game play badly, as Julian Spillane, co-creator of Early Access brawler Mighty Fight Federation discovered with the fighter Heckbane.
“We call him a rushdown character, which means he needs to be up-close and personal, so we gave him dash moves to let him close the gap. But we found in our first week that people thought he was very weak and that he didn’t have many tools to close distance.”
It turned out that the problem wasn’t closing distance. It was the hitbox on his jab attack. “It just wasn’t exaggerated enough to allow him to land a blow and start a combo. Yeah, it’s unrealistic for a jab to have a big hitbox, but it’s worth exaggerating so it’s rewarding when you’ve dodged and evaded everything to get in.”
So hitboxes don’t behave as you expect. They also don’t work like it either. In fact, collision is a notoriously difficult field within computer science. “This has been the thing I’ve been obsessed with for 20 years,” says Raigan Burns, the other half of N developer Metanet. “It’s an open problem. No one has solved it. I feel like I finally understand what it makes it complicated, but I don’t know if I can explain it.”
Reader, he can’t. Suffice it to say, while it’s simple for us humans to work out if one thing is overlapping another, describing that in maths is very difficult, and to run the thousands of collision tests per second it needs, a modern game has to fudge the numbers, using hacks and tricks to reduce the load. Sometimes this causes the weird jank we’re all familiar with – clipping through walls; the object launching into infinity; the eternally twitching ragdoll.
Hitboxes are a fascinatingly fluid part of game design, there to fool us into believing we’re playing in a world. “Everything in games is about perception, and we’re using sleight of hand with our games, every single frame,” says Spillane. And when hitboxes are done badly, a game breaks with our expectations. “But when hitboxes are done well, you won’t even have to think about them,” says Nijman. “It will feel exactly as you predict.”
“WHEN HITBOXES ARE DONE WELL, YOU WON’T EVEN HAVE TO THINK ABOUT THEM.”