Why Slopes are Shockingly Difficult for Indie Game Devs

preview_player
Показать описание

What's up, Gamers?
I finally got rid of the slopes in my game. I'm a little hertbrokn, but what can you do, yknow? Sometimes you have to make hard choices for the sake of your game, and I'm happy to have made things easier on myself and all my artists!

The game that I'm developing as an indie game dev is called Isadora's Edge! A 2D Pixel Art platformer game, that I'm developing in the Godot Game Engine! If you're new to Godot or have any questions about Godot or game dev in general, feel free to ask me!

=== THE LOVELY AND TALENTED INSANDIO ===

=== ATTRIBUTIONS ===
Music used in the background is from the incredibly talented Low Frequency Music!

=== HASHTAGS ===
#GameDev #IndieGame #Godot #GodotEngine #IndieGameDev #Vimjam #8BitsToInfinity #Vimlark #VimJam2 #VimJam2021 #Vimjam2021 #Devlog #GameDevlog #GameJam #GameJamDevlog #Jam #GMTK #GMTKJam2021 #GMTKJAM2022 #Indie #Game #Dev #IndieDev
Рекомендации по теме
Комментарии
Автор

Just put them on a parallax layer in the background. I'm sure that the players will remember the game as having slopes, even though they never actually interacted with one.

Baekstrom
Автор

"You cant do that on a slope! The foot is off the ground!"

Meanwhile, all the classic platform games: *_(supports full weight on single toe)_*

mrwizard
Автор

One benefit to slopes is that if it's too obvious that a game world is built to a grid, that will make it feel a little too gamey. With more varied terrain, it can feel a lot more natural.

AZaqZaqProduction
Автор

Ok, as someone that has been working in a Sonic fangame that has lots of slopes, here's how I did it for anyone who wants to try, aswell as some opinion as to why you SHOULD implement them :)

1. Ground Sticking

Shoot a raycast from the players center of the body, not its feet/base. If it touches the ground then it's considered on ground, and we get it's normal.

Align the players collider with the ground normal, if you don't want to visually rotate your character, create it in a separate object (or detach it when it starts) and give it a script that manages it's own rotation, by either copying the collider rotation, or doing whatever you want.

Lerp the character rotation so it doesn't snap whenever there is a change in slope.

Set the players position in the raycast hit point + the ground normal times whatever height you want.

2. Fix velocity

If you're using rigidbody forces to move your collider, within the ground sticking process, project the velocity vector towards the ground plane. Unity has a function to easily do this, where you just give the velocity and ground normal as parameters (any other engine should have a similar function).

To maintain your speed during the projection, create a temporal variable to store your speed, project the velocity, normalize it, and multiply it by the store speed. Finally make the rigidbody velocity this new created velocity vector.

Convex edge cases can be solved by making the raycast long enough until there aren't any false negatives.
As for concave cases, I made it so we shoot a raycast in the velocity direction (or the players forward direction) to check if there is a slope in front of us, making sure it isn't a wall by checking its angle and if it is a slope we can be on, project the speed on the new normal that its ahead of us (this is only necessary in games were the player goes in a variable running speed, like sonic games, in most games with set speeds this step can be skipped).

3. Air movement

For jumping, we create a function that whenever we jump, we deactivate the ground sticking by 0.2 seconds or so.
Gravity can be applied whenever we're not grounded, there is no need to apply gravity otherwise.

3. Visuals

Personally, I haven't dealt with this myself, but here's my idea.
Create a few standing animations depending on the angle of the slope (as few as two or as many as you want), and when running (detecting the rigidbody speed more than 0 or any other method) align the character rotation to the ground. The snapping to the ground normal/ to the up vector could be well hidden with a settle animation or running start frames, if it's still to noticeable. (Important in case you're making a 3D game, there's a technique called inverse kinematics to make sure that the feet are always glued to the ground).

This should work pretty well with any type of floor perspective you use.

4. Enemy behavior

The same for the enemies, if anything with less steps to fix the velocity as they don't have to be this precise. Aligning the enemies to the floor normal should fix any "floating" animations, if you're still not convinced that a big enemy would be almost sideways, just make a limit to the slope angle they'll be willing to walk on.

More as an opinion piece now, I don't think that there has to be specific cases where slope are used for them to be important, I think it still adds value to having them for the sake of versatility at the time of creating levels, like creating a difficulty curve at the time of presenting challenges (slopes can make any challenge easier or harder to beat), creating variation on environmental gameplay (like more natural environments can have more slopes, and more mechanical/urban have less), and often times not implementing them it's just going to be more workload for the level designers. Not saying that every game should have them, the point of the video still stands.

That's all, sorry for the probably bad english, not a native speaker, lol.

lowsketchblue
Автор

"it's over Anikin I have the high ground"
"You underestimate the power of the slope"

Crits-Crafts
Автор

Laugh-cries in Sonic-type physics

But seriously, not only am i locked into using slopes, not only do i need to fight with the engine to get accurate collision angles, i need to also build LOOPS. Aka, slopes that go completely upside down, and also switch collision layer so you can phase thru a part that was previously solid.... AND build Rails, which are all of the above, and also semi-solid relative to player rotation


The problem with trying to be faster than light is that you can only live in darkness

spindash
Автор

Everyone talking about Sonic, forgetting that Mario Bros 3 had full-on slope physics on the NES :D

RoboBoddicker
Автор

It's probably too late for this advice, but I think a lot of your physics problems aren't actually to do with slopes. Instead, I think it's because you're using a physics-based player controller instead of a kinematic one. Issues like speed on slopes, snapping and slopes, and so on are a lot easier to handle when you're not fighting physics.

You wouldn't, for example, have to adjust player speed just to un-break running on slopes. You would simply move the player horizontally, then snap them to the slope. They get the vertical motion for free, and adjusting run speed on slopes becomes opt-in. Sure, you're handling gravity and momentum yourself, but that's often less work than fighting physics every time you fix a new edge case.


None of this is to mention features like coyote time, asymmetrical jump arcs, and input buffering, all of which are easier to implement when your controller is the only thing driving player motion.

theOtherMichael
Автор

I think the main problem for modern indie games here is an over-reliance on generic, built-in physics engines that weren't designed for 2D platforming, rather than having the gameplay programmer create bespoke physics suited to the game, similar to the development process for 16-bit titles. Mega Man X was mentioned in the video, as well as Sonic frequently in the comments, but also games like Super Mario World (or even SMB3 on the NES), Gunstar Heroes, Kirby Superstar and many other memorably used slopes to great effect without a perspective artstyle, while restricting larger or awkward enemies to areas without them.

Regarding metroidvanias specifically, I think slopes are very valuable for both enabling physically varied and distinctive level geometry as well as the ability to compress map layouts by supporting smooth bi-directional connections between rooms that aren't orthogonal to each other. In Super Metroid, the room to the left of where you get the Speed Booster, which serves as its only entrance and exit, is a good example: because the room slants diagonally upwards, the player is able to just barely escape the vertical rising lava that is triggered by obtaining the power-up merely by running directly left, immediately demonstrating the value of the new ability, something that wouldn't be possible if the transition was manged by a series of elevated ledges. On the other hand, looking at something like Hollow Knight, while that game's eventual monotonous nature is primarily due to the size of the world being too large and the low cadence of ability acquisition after the first few hours, lacking slopes is still a notable secondary issue, as their addition could have gone a considerable way to diversify level design on either a micro level or between biomes.

globalistgamer
Автор

If I recall correctly, Castlevania Symphony of the night only used slopes in...

A. Rooms where the enemies don't interact with terrain.

B. Rooms with enemies that are specifically made to interact with slopes in specific ways. (like the dragon skulls that roll down stairs.)

And if there are any normal enemies in the rooms, they just don't go on the stairs or don't stay grounded. Clearly, even the devs of that game struggled with slopes. In fact, the entire early Castlevania series made stairs something that only the player interacts with.

I've been brainstorming and making ideas for video games for years, and only ONCE have I ever thought about slopes, and it's a boss fight where the boss is stationary and uses attacks that don't interact with terrain XD

misk-ivus
Автор

Actually, it makes physical sense to move up a slope more slowly and down a slope more quickly. So that isn't really something you necessarily have to "fix". And that somewhat mitigates the edge guarding problem you were talking about.

timseguine
Автор

This video was coincidentally uploaded right when I was currently struggling with slope physics for my own game (specifically how they affect acceleration), too bad they‘re absolutely integral in mine. I have no clue what to take away from this.

Widdy
Автор

this reminds me of a video essay i watched about hollow knight by ceave perspective that has a segment discussing how one of the reasons such a small team was able to make a game that big was because the game doesn't have any slopes, and therefore doesn't have to worry about all these problems

WeavileGuy
Автор

The bottom line I feel is more "Always have a critical mindset about non-essential features that might cost a lot of work", than it is about slopes.
I genuinely wish I could be like that because if I have a clear idea in mind when it comes to user experience, I will work towards that goal, regardless of complications.

NavnikBHSilver
Автор

If i remember correctly, Metroid Fusion and Zero Mission handled slopes by just not allowing most enemy types to enter them. Slopes were strategically placed, so it never felt odd

Ferodra
Автор

lol, slopes

slopes basically turned my little prototype into a game actually worth developing.

i definitely have spent a lot of time getting it all tuned right, including an entire rewrite to swap from raycasts to boxcasts. i didn't have any enemies walking around for a good while (since they didn't really mesh with the game concept well), but when i did finally have to implement ground detection for non-player objects, i basically took all of my player ground detection code and put it into a new class. now all of the non-player objects easily snap to ground, account for checking walls vs slopes, etc.

also- one thing i found useful for determining if there's a slope below the player is to actually raycast under the front of the player, horizontally inward. that way you can check if there's a slope of any steepness below the player, without using a really long raycast.

as for art, i'm a pixel perfect kinda person so i decided to opt for rotating sprites into that crunchy pixel weirdness that you'd get on the GBA. the pixel art emphasizes shapes over outlines most of the time anyways, so it's not too bad. for the most part, we try to reserve rotation for either pure shapes or for sprites that are constantly in motion. it helps mask that weirdness a bit.

having a penguin sliding on a slope (~32x16px; a short / wide collider) did look weird even after rotating the sprite, so the sprite is offset towards the ground when the penguin is grounded.
the 16x32px (tall / skinny) grounded idle animation is also rotated and offset, but not as much- it turned out to be important for conveying the penguin's jump direction, since the jump force is always pointed perpendicularly from the ground.

with the level design side, slopes always became a way to go fast, preserve momentum, take cool shortcuts, and accentuate cool jumps. slopes aren't always useful when designing levels, but they help accentuate what makes my game unique.

if i were in your level designing situation, i'd probably ask myself if there were any unique interactions you could have with slopes. since slopes are difficult and thus less common in indie games, it'd probably be worth it to spend some time jusifying them mechanically. maybe there could be a mole that pops out of the ground, but always perpendicular to the surface- so the spot that the mole is buried in is important. especially if it were inside a wall!
of course, i'd also avoid using any enemies / mechanics that don't play well with slopes in a slopey area. ronktonk would be a no-go for example, but there'd be plenty of other areas where it could shine.

but aside from aesthetic / uniqueness, i'm not sure if, i were in your shoes, if i'd continue work on slopes. it takes a lot of discipline to say no to something you really want, after all. this is a good vid and you present your reasoning very well.

slopes aren't easy, and they're not beneficial for every game, but the different development needs and solutions for a genre as narrow as 2d pixel art platformers is interesting!

domoyoro
Автор

Sonic fangame developers sweating profusely

TheExFatal
Автор

You are spot on. Slopes are definitely a “feature” with extra costs that may not be worth it. 
You haven’t mentioned one possible art solution, provided you aren’t going for pixel art purism: tilting. The character can be angled so their up is perpendicular to the floor normal, so the wide ememy is simply rotated a bit. As you say, there are always more issues, e.g. smooth rotation on jumps and at slope beginnings and ends.

Anerisian
Автор

Alternative: make floors basically work like defined paths and link together. Players and enemies can move freely along paths, and then can break free by going aerial. Path segments are given properties that affect jumping, landing, acceleration, friction, and so on.

Nathouuuutheone
Автор

I love slopes, if you can build momentum of it as a player or as an enemy/obstacle. It also means that it always serves a purpose, the physics are temporary, enemies only use them if designed for them, and the rest is worth it if it is a real game essential mechanic.

mackthisarrowhearth