Why Stairs Suck in Games... and why they don't have to

1,542,693
0
Published 2023-02-01
Let’s talk about stairs, why they suck in games, and what can be done about that.
You wouldn’t think stairs are that hard for video games, until you see some of the bugs they can cause
Check out a live demo of the OpenKCC Project here - nickmaltbie.com/OpenKCC/

Chapters:
00:00 Getting High
01:18 What are Stairs?
02:33 Hiding the Problem with Ramps
03:48 What is a Step Again?
05:00 Snapping Down Steps
06:46 Oh Right, Going Up Steps Too
07:49 Can We Snap Up Steps Too?
09:36 Costs and Benefits of Solving Stairs
10:28 Don’t Settle for Less

#gamedev #unity #stairs

References:
[1] Toyful Games - Making A Physics Based Character Controller In Unity (for Very Very Valet) -    • Making A Physics Based Character Cont...  

All Comments (21)
  • Could the problem be that the stairs are also not made with the speed your character has to move in mind? I think that the only way we will get natural stair movement is when we lock characters to the stairs and use an IK and root motion setup that calculates where you can put your feet. Maybe faster characters could go up 2 or 3 steps at once.
  • @Yalden_
    Stairs used to be this thing I would not notice in games until GTA IV. I still remember when I first played and Niko started stepping on each step and jumping some if running, it was insane.
  • @UltraKirby123
    When I was a kid, I would be really impressed or fascinated with how in the original Wind Waker on gamecube, Link's feet would stand on and set up each stair individually. You could stand on the stairs and one foot will be on the next step and one on the lower step. It always looked so smooth.
  • For years all I've ever wanted was to have my player model in any game actually have their feet match on each step as they go up the stairs, rather than stand on one and slide up a few. A few games have done it but its made the stairs feel more likie a cutscene than being actually fluid with character movement, and I've always wondered that surely it wouldn't be that hard to do. After seeing how much work actually just goes into regular ol stairs I finally understand why it must be so hard for that kind of coding jesus. Thanks for making this vid, it was super informative I greatly appreciate you putting in the time to make it
  • @PixelDough
    Breath of the Wild also has some good examples of making step-ups feel even more natural. On really REALLY short steps it's just the typical smooth looking motion. But as the steps get higher Link begins to do an actual "stepping up" or "clambering" style animation, which influences his movement without interrupting the player's agency, and makes a high step-up look seamless
  • @NoshuHyena
    Something that's always weird to me is that stairs usually look proportional when you're playing, but your character always runs up them like 7-10 steps at a time. In real life, if you're running up stairs full speed you can get 3 at a time, maybe 4 if your legs are long. But VG characters just fly up a whole flight in 2 strides.
  • @mackxzs
    Harry Potter and the Order of the Phoenix was a videogame that dealt very well with stairs, whenever you were going up or down stair the character moved at a compatible pace, and physically actually stepped on each step like a person would in real life. Actually pretty advanced for a PS2 game, all things considered.
  • @judgementrizzy
    Have you seen the escalators in Lost Judgement? I was blown away when i saw the protagonist walking up and down FULLY FUNCTIONAL ESCALATORS, with each foot connecting perfectly with each step, adapting to the speed. Literally the best stairs I've ever seen in a game, and they move! Not sure of its something you have time for, but if you're ever able to figure out how they worked that magic, I'd love to hear about it. Your way of explaining things is great.
  • @ragnose1
    Snapping has a really bad problem that you seemed to ignore in this video. When you use the snapping method, many games don't include a decent enough compensation for the camera snapping in turn. This can cause motion sickness in some players, especially if the title is a first person game. This is why most first person games use clip brushes to handle stairs rather than snapping, especially highly competitive games such as counter strike or overwatch. Thus, as with most game design decisions, the correct answer rarely is one size fit all, but highly a "it depends". Also note that these aren't the only two options, another example are games such as the Yakuza titles that choose to (atleast most of the time) force you to walk up/down stairs normally, with pre-determined animations for each step. These fit better than either of the two previous solutions for games that are trying to stay more grounded in reality, and there are more options out there too.
  • @moth.monster
    A fun example of a game with no minimum step depth is Minecraft. You can stack up a bunch of random blocks to make very steep staircases
  • @degiguess
    I've made a fair amount of character controllers in my spare time and the floating character method is definitely my favorite solution. It's simple, reliable, and feels very smooth. I would highly recommend it to anybody making an indie game. The very very valet video he references at 3:38 is actually a full tutorial the devs of that game made and it's very helpful, I'd recommend anybody who wants to make a floating character take a look at it.
  • @Dremth
    AAA dev here. To get the best of both worlds between the consistency of step snapping versus the smoothness of ramps, you can use the snapping, but afterwards apply a dampened spring offset to the character model relative to the capsule. With the spring tuned properly, this makes it so you can author the stairs as normal, get the good behavior of the step snapping, but you don't have the visuals of popping up and down the steps. Paired with some good IK, this is pretty much the de-facto modern stair solution. The spring also helps if you have a very rough terrain.
  • @takaw.d8486
    one problem i always found with stairs is that they never lead up to anywhere good
  • On snaps: They can be EXTREMELY disorienting for VR. The sudden up and downs on climbing steps can feel horrible, even for somewhat experienced VR users. The "ramp" approach feels better in taht case. :P
  • @HelixSnake
    Back in my early days of programming I solved the "stair problem" on my kinematic controller with an absolutely overdesigned solution involving a whole bunch of casted sloped colliders and edge case handling. The colliders would cast forward at the character's feet and essentially act like there was a ramp there for them to walk up. It was fairly rigorous but it was absolutely unmaintainable and not performant and was not entirely free of weird edge cases. This was before I had learned that simple is usually better.
  • @Dave01Rhodes
    TF2 maps mostly cover stairs with ramps, but there’s a few maps (or a few sets of stairs) that don’t do this and instead you snap to each step. It’s noticeable when this happens. Your view snaps to each step with you and it can be jarring. The ramps are a good workable solution. I guess, the best stair solutions depend on the type of game. For FPS games, you probably just want a ramp to make it simple.
  • The absolute best solution for this problem for me was shortening the capsule collider up to the knees and adding a downward-facing raycast that checks how far the ground is. It then lerps you to the raycast position every frame. So far it hasn't failed me and I'd assume it costs less than checking contacts
  • @Lumps27
    Before stair motion can even be fully considered i feel that matching the characters moving speed and animations is really important, if it looks like your feet are sliding under you even on solid ground because the speeds don't match, stairs will never look natural even with a perfect all encompassing stair solution
  • @Tech-Kat
    I do not feel high enough, but I don't think my solution is climbing or stairs 0:10