DAY 59
Today I have finished scripting the ledge climbing mechanic. This has definitely been way more complex than I have anticipated and it was riddled with bugs. But it is functional, now. I have showed you the left and right movement, the jump on ledge, can’t remember right now if I showed you the climb up ledge, but now I’m showing you the corner ledge movement. Here’s how the last part looks:
There was a lot (and I mean a lot) of work to do on this, but once the hard part was done, parts of the script would get recycled.
What follows is a pseudo-breakdown of the mechanic. It’s not in the order I implemented it and it certainly doesn’t have all the nuts and bolts mentioned because I’m brain dead right now and can’t think straight:
TRACING THE WALLS AND LEDGES: I had to have the character detect a wall in front of him, how high the wall is, if there was a ledge that could be walk-able left or right, where the player can jump up the ledge and corners that the player can turn on (well, that sounded x-rated and grammatically wrong at the same time). This was fairly easily done with tracer channels. This was the repetitive task. Tracing forward, tracing up, tracing left/right, tracing the jump up and tracing the corners, all of then worked almost exactly the same.
LEDGE MOVEMENT I genuinely thought I could get away with the bare minimum of Set Movement Mode to “Flying” and the adjust the direction of the flight, but sadly that wasn’t the case. I tried to cheat my way out of this one, but of course the scripting gods would not allow it, so I had to do the work. And of course I only had a vague idea on how to do it. So after pouring through blogs, tutorials and some UE documentation, I made it work. Minus the animations, those do not work now. And the tracers don’t properly work either: they don’t detect the edge very well and the player remains stuck when reaching either end of the ledge. This was my first experience with the Animation side of Unreal Engine and there is a whole lot to learn here. This is where things got overwhelming to me and start making a ton of mistakes and lost motivation. But I ploughed through and I got through with it.
LEDGE CLIMB ENTER and DROP: This one was straight forward to do, especially the drop. This is where I used the Set Movement Mode to FLYING in a successful way, with a lot of booleans. The actual ledge climb was a ton of work and had to research extensively, because I had no prior know-how. The way I managed to get it to work is with a lot of vector nodes involving the Wall Normal, the Wall Height and the Wall Location.
CORNER LEDGE MOVE: This was surprisingly not a lot of work and involved a lot less movement nodes than I thought I will implement. Basically lots of boolean variables and if statements, with enabling and disabling the player controller and an anim montage. That particular anim montage did the gruntwork for me
There are some other elements, like the FOV change during the ledge climb and movement and the Camera Clamp, but I got these two working almost instantly. Some bugs regarding the camera clamp: the camera clamp works relative to the world, not to the player. If you want to grab a ledge facing north, the camera clamp works perfectly, but if you want to climb a ledge that is facing east, you would encounter the hilarious glitch of being able to look at the character’s face. I’ll get on it as soon as I get some proper rest.
All in all, 90% of the ledge climbing mechanic was new ground for me and got intimidating as hell the more I worked on it. What ended up was a monster of a blueprint script that I can barely fathom how I got it to work. But it works, at least partially.
To pick myself up from the rut that was the loss of motivation a few days ago, I also implemented the ground pound mechanic. This is an easy mechanic that is quite fun to play around with. Here’s how it looks:
Finally taking my scripting hat off and putting my designer hat on, the ledge climbing feels rather responsive, quite robust and smooth (most of the time, anyway). It’s still glitchy as all hell, but it lends itself to a good feel. It’s far from perfect (hell, it’s far from fully working, what am I talking about?) but it does give you a greater sense of exploration as is. At it’s best, it gives the feeling that you can go anywhere, the feeling that somehow (dare I say) you’ve outsmarted the environment.
The Ground Pound mechanic is a lot of fun and I feel that it can be used in a lot of creative ways. The problem with this is that the mechanic can get old really fast and I must keep this in the front of my head. It does run the risk of the player using the mechanic even when he is not supposed to and that is what might cause the problem of it getting old fast. Spacing it out is not necessarily a solution, because the player can still ground pound even without anything in front of him/her to get out of the way.
I think I’ll be taking a break from scripting mechanics for now. The ledge climbing really took a toll on my endurance and stretched my knowledge limits a whole lot. In retrospect, I shouldn’t have done it now, but I did. It would’ve been better if I’d either done it at the very beginning of the project and get the complex stuff out of the way fast or some time later down the line, maybe after I had done all the other mechanics. I’ll be focusing on some level design until after the holidays. Maybe I’ll add something light like a double jump mechanic, a dash mechanic, something very light script wise. But I certainly won’t do anything complex until after the new year. I’ll also do the bug fixing after the holidays as well for the ledge climbing mechanic.
Anyway, that’s all I’ve got for today. See ya in the next post, bye.