(background: I’m a Gameplay Programmer i.e. I work with things like interface, controls and camera as opposed to engine code like loading, rendering, etc.)
Yep, I can confirm that the code for controls is hard to get right, and often features a lot of hacks and special cases—making controls that are easiest to learn for the player doesn’t result in simple code. Check this out for someone overanalyzing “simple” jump controls.
Some common reasons for making your controls non-simple
The game lags, so by the time the game gets the player’s input, some time may have passed, and a good game may want to “pretend” the player did his action in a past state (this is tricky to get right, and totally transparent to the player).
The graphics don’t match the simplest representation in the game engine—code for boxes colliding is much simpler than code that looks at pixels or casts ray etc. but the latter may be what the player expects.
Player’s intuitive representation of physics doesn’t really match Newtonian physics—if your character is on a moving train and you’re shooting cannonballs at fixed targets, you don’t expect the train’s momentum to apply to the cannonball (though it’s not clear whether this is because of natural human instincts, or because a cannon-shooting game that took proper account of Newton and Galileo would just be less fun, so players are willing to suspend disbelief). “Naively” applying the laws of physics in a game engine is a common pitfall.
One bit that’s particularly hard to get right in 3D third person games is the camera: if you give the player full control of it it may often end up pointing in an awkward direction and he’ll fall in a hole because he was looking at the sky; so you want it to reposition itself magically when the player is near a wall, or being attacked, or there’s a special plot-relevant thing going on; you may want the camera distance and angle to depend on what the player is doing (sometimes he needs to see his own character well, sometimes he needs to see the environment or where he’s going); you have different needs for say shooting and melee combat, which is a hassle for games that mix both.
(background: I’m a Gameplay Programmer i.e. I work with things like interface, controls and camera as opposed to engine code like loading, rendering, etc.)
Yep, I can confirm that the code for controls is hard to get right, and often features a lot of hacks and special cases—making controls that are easiest to learn for the player doesn’t result in simple code. Check this out for someone overanalyzing “simple” jump controls.
Some common reasons for making your controls non-simple
The game lags, so by the time the game gets the player’s input, some time may have passed, and a good game may want to “pretend” the player did his action in a past state (this is tricky to get right, and totally transparent to the player).
The graphics don’t match the simplest representation in the game engine—code for boxes colliding is much simpler than code that looks at pixels or casts ray etc. but the latter may be what the player expects.
Player’s intuitive representation of physics doesn’t really match Newtonian physics—if your character is on a moving train and you’re shooting cannonballs at fixed targets, you don’t expect the train’s momentum to apply to the cannonball (though it’s not clear whether this is because of natural human instincts, or because a cannon-shooting game that took proper account of Newton and Galileo would just be less fun, so players are willing to suspend disbelief). “Naively” applying the laws of physics in a game engine is a common pitfall.
One bit that’s particularly hard to get right in 3D third person games is the camera: if you give the player full control of it it may often end up pointing in an awkward direction and he’ll fall in a hole because he was looking at the sky; so you want it to reposition itself magically when the player is near a wall, or being attacked, or there’s a special plot-relevant thing going on; you may want the camera distance and angle to depend on what the player is doing (sometimes he needs to see his own character well, sometimes he needs to see the environment or where he’s going); you have different needs for say shooting and melee combat, which is a hassle for games that mix both.