Game hitboxes and how to use them

5 of votes

2478

Game hitboxes and how to use them properly

Every action game relies on hitboxes to properly calculate physics and collisions. A hitbox is an invisible area around an interactable model in game. Managing the hitboxes seems simple: just make them fit the model. But it may impact the gameplay experience.

For example, if the player hitbox is too big, the enemies will easily hit him and it makes him angry. If it’s too small, the player will feel his invulnerability and drop the game because it’s too easy.

hitboxes in killer instinct

In this article we will tell you why it’s so hard to make proper hitboxes and how developers use them to improve gaming experience.

There are two kinds of hitboxes

Hitbox is similar to a collision model. It repeats the geometry of an object and tells the game about interactions with other hitboxes. The developers use collision models to make the objects do not go through each other. Also these hitboxes are needed for physics purposes: to calculate whenever a box must fall from the edge of a table or when it can stay on.

But there is a second type of hitbox — a hurtbox. A hurtbox is the same hitbox, but it tells the game about interaction of a specific object, like your bullet and enemy head.

hitbox and hurtbox

The game designer’s job is to optimize the hitboxes for the better player experience. It’s a very difficult task because every game is unique at least by its graphics and character models. To give the best player experience the developers often trick players with weird hitboxes.

Hitboxes in Third Person Action games

As the player always sees his character from behind, every shot and slash which hits the character model must be registered as a hit. This will help the player to learn how to take cover, how to move and where to shoot.

Fun fact: most action games do not have a separate hitbox for a shield. For example, in Dark Souls you can shield yourself with a buckler shield the size of a dinner plate. If the enemy will hit you in the head with an arrow, it will still count as “blocked”. If you equip a giant tower shield and don’t raise it — the arrow which clearly hit the shield will be counted as a body hit.

dark souls hitboxes

The third-person games often use hurtboxes to make the sword fight mechanics more realistic. Every weapon and magic spell has its hurtbox around. To hit an enemy you need to touch it with a hurtbox — that’s all.

Game hitboxes in First Person Shooters

The problem with FPS is that the hitboxes do not correspond with actual character models. In a competitive shooter you have to notice, aim and fire at 20-pixels wide enemy head in less than 0,3 seconds. To make it easier to calculate, shooter games like Counter Strike and Call of Duty use bulky rectangular hitboxes. It doesn’t matter whenever you hit between the eyes or at the helmet edge — it will still count as a headshot.

But the biggest problem is with modern MOBA shooters where every character has a unique model, health points and animations. To make it easier to shoot developers use big capsules instead of combinations of rectangles. As a result, if you shoot a character between the knees or just above the head, it will count as hit.

counter strike hitboxes

And the last trick is to optimise calculations by using large secondary hitboxes. Explanation: in every multiplayer shooter there are moments where everybody is firing and bullets flying everywhere. In the perfect case the server calculates every bullet’s position and compares it to every hitbox in the game. Remember, that the character has 20-30 combined hitboxes to align to his model. In reality these calculations will cause server to lag. So the solution is to give every player an additional large and simple hitbox and start the complex calculations only when the bullet collides with it.

Hitbox optimization is very important since calculations are made on the CPU. The complexity of calculating colliding volumes is the reason why we don’t have games with thousands of enemies on the screen.

Hitboxes in racing games

Car’s hitbox is simple: it just repeats the main geometry. But racing games try to reward players by appreciating his driving skills. For example, by making a specific sound when a player passes cars in the opposite lane. This sound is calculated with a large hitbox with no collision.

Also racing uses separate hitboxes for the wheels. It is needed to simulate driving on different terrains (road, wet road, grain, mud, etc) and to calculate the suspension’s work. Sometimes hitboxes are working as a gasket to avoid the crash.

2D games and their game hitboxes

2D games are the most interesting by how their developers use the hitboxes. Majority of 3D games have relatively slow enemies and open locations. The player can see an enemy standing a mile away and has a plenty of time to dodge their attacks.

2D games are different: the enemies are on the same screen within 20-40 meters away. To make things intense there is rarely only one enemy or trap within a player’s range. Enemies attacks would hit the player faster and he has less space to maneuver. So to make things less difficult and more fun the developers play with hitboxes size.

fighting game hitboxes

Examples:

  • the player hitbox is always smaller than the player’s character model or sprite. Thanks to this it is easier to evade getting hit: the game forgives minor playstyle flaws;
  • the player’s model has a secondary hitbox for registering bonuses and useful items. It becomes easier to collect extra lives or powerups when running through the spiked maze;
  • the player’s model is always rectangular so he won’t fall from edge accidentally because of physics;
  • everything which can damage the player is smaller than it seems, so it’s easier to evade;
  • the enemy hitbox is always bigger than the enemy itself. Easier to land a hit in a rumble — funnier to play;
  • the player’s melee weapon, bullet or projectile hurtboxes are way bigger than their animations shows. This decreases the amount of situations where the player didn’t hit the enemy because he was standing one pixel too far;
  • sometimes developers delay the enemies hurtboxes movement for a split second (50–150 ms). By doing this they give to the player more time to dodge a hit.

These tricks are useful for every 2D game, from action platformer to isometric puzzles.

PLEASE, RATE MY ARTICLE :)

5 of votes

Post views:
2478

Our game development studio is based in London. With over 13 years of expertise in design, marketing, 3D animation, and programming, we are a cornerstone of the koloro.group of companies. We craft games tailored for clients and also passionately drive our in-house projects. Our commitment is clear – delivering premium content and deriving revenues from games, all while adhering to the highest moral standards and valuing people’s interests. If you’re looking to craft magnificence and reap monetary rewards, we’re your destination.

GET A TOUCH

Send us a message via messenger or email