Strange Hitboxes Can Make Your Game Better
Let’s play a little game. Which of these following statements have you caught yourself saying when dying in an action game?
A Oh come on! That bullet was nowhere near me! This sucks!
B Oh come on! My attack phased right through him! This sucks!
C Oh come on! That bullet should have killed me! This sucks!
I’m willing to bet that you’ve never said C. And the reason for that is obvious: We play games to have fun, and losing isn’t fun. If we somehow survive by the skin of our teeth, even though we were sure we’d die that time, then we are glad. We laugh, say “oh crap, that was close!” and continue playing. We don’t start yelling about bad hit detection or complain that now we won’t have to start the level over from the beginning. We want to have fun, and are happy that the game seems to have turned a blind eye so that we can keep having fun.
As gamedevs we can make that happen. We can make the game more enjoyable for players by allowing the game to turn a blind eye. And having good hitboxes is a powerful way to do so.
Now when I say having good hitboxes I don’t really mean having precise hitboxes. That might sound strange and counter-intuitive at first, but let me explain. Apart from the fact that pixel-perfect collision is usually rather performance intensive, having collisions this precise can actually end up being less fun for players.
Because what is fun in games? Collecting things. What isn’t fun? Getting killed by enemies. With this in mind, there are two simple things that you can do to make your game more fun: a) Make the hitbox for positive objects bigger. b) Make the hitbox for negative objects smaller.
When you have collectibles or powerups in your game, make their hitbox a bit bigger than their sprite so that it’s easier for players to collect them. Think of a game like Sonic the Hedgehog, where you frequently have a bunch of rings suspended in midair. It feels good to collect them all with a single jump, doesn’t it? Then make it easier for players to do so! Even a few pixels can make a crucial difference and prevent cries of “oh come on, I totally touched that!”
Conversely, make it a bit harder for players to get hit by enemies and their projectiles. You shouldn’t overdo it of course, but just shaving off a few pixels of an enemy’s bullet hitbox can lead to some very intense but positive moments for players, as they barely dodge between two bullets while flying over a spike pit. And if you give the players' attack a more generous hitbox, maybe they can even kill the enemy in the process of doing so! They’ll feel like Neo in the Matrix, and that’s awesome. Neo when he’s jumping around and shooting I mean, not when he’s standing in a room and getting philosophized at.
I follow these principles in all my games, but Attraction Force is a good example. In case you don’t know, in Attraction Force you have to shoot enemies with your magnet gun, which will pull them toward you and then stun them when they stop moving. Once they’re stunned, you can kick them off the stage by touching them. Take a look at the enemy’s hitbox:
As you can see, it’s smaller than the sprite when the enemy is patrolling but it actually gets bigger once the enemy is stunned. This way it’s easier to dodge enemies while they’re dangerous, and easier to kick them when they’re not. And as a bonus, you can see that the player character’s hitbox doesn’t encompass his helmet to make the game a little fairer. Dying because something touched the edge of your helmet would be a classic “Oh come on, that barely touched me!” scenario.
Some Hardcore Gamer™ types might be offended by the idea of a game helping them out, but in the end it’s nothing more than good game design. And it’s not like these changes drastically impact the whole game or anything. They’ll only come into play during the most intense gameplay moments. And since these are the most memorable for players, you want them to remember these moments fondly.
Join my mailing list!
You'll get notified whenever cool stuff happens!
Take It to the Next Level!Become an excellent patron on Patreon and snatch yourself some kickass perks such as early builds, exclusive updates and more!
Want To Buy Me a Coffee?
Coffee rules, and it keeps me going! I'll take beer too, though.
Developing games is a huge - and some would rightly say insane - undertaking. Even small games can end up being a surprising amount of work, and the end result tends to not reflect the actual project scope during development. The fact that games get finished at all is something of a miracle, to be honest. There are just so many things to consider, so many elements that have to be worked on, so many thingamabobs that have to be kajiggered in order to get a game working right.
The long-awaited Sonic Mania Plus recently came out and I can easily remember the last time I had as much fun with a game—it was with the original Sonic Mania. Since I’ve beaten that game more than once I jumped straight into Encore mode on this one, anxious to try out the two new characters that were added in the update: Mighty the Armadillo and Ray the Squirrel. The gamer in me relished the entire trip through Angel Island zone, a sort of prologue stage of Encore Mode.