Sponsored By

How Naughty Dog defined melee attacks and behaviors in The Last of Us Part II

"A melee attack contains animations to be played by the attacker and the defender, or the target. Then we have starting and ending conditions for each melee attack."

Game Developer, Staff

July 21, 2021

3 Min Read
Game Developer logo in a gray background | Game Developer

Melee combat in The Last of Us Part II is brilliant, brutal, and nail-bitingly tense, and, according to Naughty Dog game programmer Ming-Lun "Allen" Chou, speaking at GDC 2021, that's exactly how the studio wanted it.

Outlining how Naughty Dog approached melee AI in the long-awaited sequel, Chou said the dev team wanted to build on melee combat in earlier projects like Uncharted 4 and The Last of Us by turning it into an altogether more tactical and considered affair. 

Highlighting how melee combat functioned in those older titles, Chou said that enemies had shorter melee attack tells, meaning there wasn't much time between the start of an attack and the resulting impact. There was no way for players to dodge, either, which meant that when an enemy began a melee move it almost always landed -- unless the player quickly started swinging and managed to hit their attacker first. 

To improve on that in The Last of Us Part II, Naughty Dog implemented longer attack tells to give players more time to spot incoming hits. The studio also made enemy tells more obvious and gave players the ability to dodge attacks, bolstering the system with more skill-based elements. 

Broadly speaking, Chou says Naughty Dog wanted melee combat in Part II to "bear equal weight and complexity to gun combat" so players would feel drawn towards the systems in play. "We wanted players to engage more in melee encounters, and make sure skilled players could survive those encounters unscathed," he explains. 

When it came to actually building that revamped melee system, Naughty Dog started by defining the data behind its melee attacks and melee moves (as shown below). 

"A melee attack contains animations to be played by the attacker and the defender, or the target. Then we have starting and ending conditions for each melee attack, such as whether or not the character is in range or facing the characters and whether or not there's a line of motion. If the starting conditions aren't met, we don't allow the melee to start," explains Chou.

"We also have events in the melee attack. Those are like tags on the timeline of the animation such as hit frames, target tracking, and when certain characters in the middle of a melee move are invincible."

After laying that groundwork, the studio began defining melee behaviors (shown below), which essentially dictate how NPCs actually engage with the player once they've committed to a melee attack.

"One level up from melee attacks are melee behaviors. Each NPC can be in one melee behavior at a specific time, and a behavior contains an attack list -- a list of attacks the NPC can start from -- and also a destination, such as if an NPC wants to run up to the target or stay a certain distance away from the target," continues Chou.

"Then we have motion types that define whether or not the NPC can run, walk, or sprint inside this behavior, along with enter and exit conditions for the behavior."

Those are just some of the essential building blocks that helped Naughty Dog polish melee gameplay in The Last of Us Part II. Want more game dev lessons from GDC 2021? Click here to catch up on even more tips, pointers, and tidbits from this year's conference.

Read more about:

event-gdc
Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like