Harder Than You Think: Ladders

askagamedev:

Welcome to Harder Than You Think, a series about things that seem fairly easy to an outsider but can rapidly spiral into extremely complicated or expensive behaviors. Today, we’ll be talking about ladders and how they can cause all sorts of weird bugs in a game.

image

Ladders are another common game feature that tend to cause all sorts of animation and game state problems. Unlike elevators, ladders do not require a complex state machine to govern. Most ladders only have one top and one bottom, without needing the player to exit the ladder in the middle somewhere. Ladders are often variable in length but not totally variable in length - you can’t have a ladder that’s shorter than the characters climbing on it or the animations wouldn’t work, but you can have a ladder that can be as tall as you want. 

Ladder interactions generally consist of three game states:

  1. Mounting, when a character transitions from the standing state to the “On The Ladder” state. While in this state, player input is typically taken away from the player and a mounting transition animation occurs.
  2. On The Ladder, when a character can loop through climbing up or down animation cycle to move. While in this state, player input is typically limited - players can only navigate up and down the ladder and may have limited ability to engage in combat or take damage.
  3. Dismounting, when a character transitions from “On The Ladder” back to the standing state. Like the mounting state, player input is taken away here.
image

One of the big potential bug generators with any kind of game dev is when we take player control away from the player. In any edge case where that control is not restored to the player at some point, we have a soft lock. If the game state changes or there’s an unaccounted-for issue (e.g. the player is not flagged for invincibility while mounting or dismounting), an enemy that attacks and knocks the player out of the (dis)mounting animation or kills the player, player input must be explicitly returned or the player will probably soft lock. Further, all of these types of interruptions can cause animation issues as well - a character getting killed while on the ladder will likely require a specific “damaged or dying on a ladder” animation, which can start ballooning scope depending on additional factors like the direction of the damage source and type of damage. Some common solutions to these problems are making sure there is no combat near ladders or making the player immortal while on ladders. 

image

Ladders are also incredibly bug-prone if AI can use them. The ability to knock enemies off of ladders, for example, can make the AI look terrible and create invincible choke points in the level design. AI on ladders can cause weird interactions with other systems like if, for example, [the player starts a cinematic]. But the worst case scenario we see most often with AI on ladders is when a ladder traffic jam occurs and we have two entities who want to go in opposing directions on the ladder blocking each other. We could let them clip through each other, but that often looks hideous. If the player has more than one AI buddy, we often have to let the AI buddies teleport to the player in order to bypass these kind of potential traffic jam issues. 

image

As you may have surmised, ladders will also cause issues in a multiplayer environment. Many of the issues with AI also apply to other players. Further, there are potential griefing issues if players cannot clip through each other and decide to block off ladders physically. 

image

These are just a few of the potential issues that can show up due to the ingredients it takes to make a ladder. Each ladder is a blend of taking varying amounts of player control away and returning it, clipping and blocking issues, AI issues, level design issues, and potential bad interactions with many other game systems for a seemingly innocuous system. These are some reasons why making ladders work in a game is harder than you think.

[Join us on Discord] and/or [Support us on Patreon]

The FANTa Project is being rebooted. [What is the FANTa project?]

Got a burning question you want answered?