Slopes/Stairs
There are actually a crazy amount of
different ways to do stairs, and it really varies which way is
better for which type of game.
For example, in a first person shooter game
you want stairs to be realistic, but in reality the player isn't
really paying much attention to the physics of the stairs. They
are paying attention to not getting shot! You can't see the
character's feet in this case, and snapping to each stair would
prove to be a hindrance. It is far better in this case to treat
stairs as a slope, something the computer has less trouble
computing and is way faster for character movement.
0. Treat Stairs as slopes
This method is just like it sounds. It is actually
not a bad method in video games. Yes it might seem cheap, but in
reality it is used for really good reasons.
Just like the first person shooter game
mentioned above, this method is usually used in terms of speed
and smoothness.
Game Example: Nintendo calculates
slopes as stairs in at least two of their Zelda games. In
Windwaker I asked my brother to stand his character on the
stairs and give me a good side view angle.
(Picture of my brother playing Windwaker, taken by me)
As you can see, his leg goes through the
stairs as if he is walking up a slope instead. I asked him to do
the same for his new favorite game, Hyrule Warriors (also a
zelda game). He was surprised it did the same and it was just
released in September.
Something to note here, my brother has played
this part of the game numerous times and has NEVER noticed that
the stairs weren't actually stairs. Keep this in mind!!
Professional games do this with no penalty! They get player
satisfaction because of it's speed and smoothness. It doesn't
draw attention to itself and usually you only see the back of
the player, so it looks realistic enough.
It is especially important in games like
this, when villains can fight you on the stairs. You don't want
restricted movement!
1. Snapping
By snapping I mean having the character's
feet be realistically on the stairs.
Game Example: Mario Sunshine does
this. Mario runs up the stairs pretty quickly and you can see
the him shaking as he is snapping to each step appropriately.
(Picture of Mario Sunshine, again taken by me)
The only way I can think of doing this is
having a coordinate system on the stairs. As the player moves to
the next step up, they are snapped up by a certain height.
2. Ladder
There also are those stairs in
games where the player can move up or down, sort of like a
ladder. And the character has to run up every single stair. I
wouldn't recommend this because it is slow.
3. Animation
Another possibility is having an animation
only for the stairs. When the player hits the bottom the
animation plays then the player is able to move again, now at
the top of the stairs. By doing this, speed nor realism takes a
tole, however you did just strip away some game play. But it is
an option! The video game Animal Crossing uses this!
Further reading
Sum up of Stairs
There are many ways to implement stairs in
your game. The most widely used in a 3D world would probably
be to treat them as slopes, however other options exist,
such as snapping, animation, and ladder effects.