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 discuss swimming - that thing you do when you get into water that isn’t dying. Swimming is something most of us are familiar with to some extent - humans can navigate water and don’t instantaneously die when we get wet. So why do so few games support swimming?
Transitions Are Hard
If you remember my post about [why ladders are hard], transitioning into and out of the swimming state is hard for the same reasons. Swimming isn’t just a single state though, it’s actually usually two states - swimming on the surface (swimming in 2 dimensions), and swimming completely submerged (swimming in 3 dimensions). This means that we would need to potentially handle several transitions from expected player states:
- Walking to swimming on the surface
- Falling to swimming on the surface
- Falling to submerged
- Swimming on the surface to submerged
- Submerged to swimming on the surface
The problem here is that a missing transition from one state to another could result in the player getting stuck in that state in a place she should not (e.g. swimming while on land). The nightmare scenario is the submerged swimming on land, because movement in 3 dimensions that isn’t constrained to water means the player can fly, which breaks most game environments that aren’t designed for flight.
Animation Scope Explosion
Two different swimming states by default already greatly expands the necessity of animations within the game. Swimming in each direction, idling, drowning, dying, and transitioning from state to state (e.g. diving, surfacing, climbing out of water, etc.) are the minimum, and this is only for locomotion. If players can swim, what else will they expect to do while swimming? The two most common I would expect are looting items and combat. Would we need additional looting animations while swimming? Would we need a whole suite of different animations depending on the weapon while swimming?
Tradeoffs
There’s a lot of ways to interact with water, especially because it can be at variable depths. Swimming is often only one possible option - we can also wade through it or duck under the surface to hide. Projectiles and explosions behave differently underwater. How would magic work underwater? How would super powers work? Would your normal suite of abilities change? Would equipment change? How would AI deal with navigation into, out of, and under water? How would AI deal with water in combat? Think of how much work would have to go into building all of these interactions. Think about the test plan for QA to test and validate all of these different interactions. Unless a significant portion of the game would take place in or under water, it’s a huge amount of work for very little gain. These are just a few reasons why making swimming work in games is harder than you think.
[Join us on Discord] and/or [Support us on Patreon]
Got a burning question you want answered?
- Short questions: Ask a Game Dev on Twitter
- Long questions: Ask a Game Dev on Tumblr
- Frequent Questions: The FAQ