Converting Blueprint into C++ code (and why you shouldn't neglect either)


So this problem was a long time coming.


Ever since I started trailblazing through learning and designing systems in Blueprint (BP), I knew that at some point I would convert at least some part of it back into C++. This is an issue when you deal with huge amounts of code that has a lot of branches and wires going all over the place and is much harder to remedy than other visual scripting programs and languages such as Max MSP. However coming to UE5 after spending months in Max MSP essentially fast-tracked my progress in UE as the concept is pretty much identical, and I had already programmed a basic game and control system into Max [Tony Hawk's Underground 2 in Max MSP].

So I decided last night I'd spend some time trying to get the code for the Wall Jumping system partially into C++ as I thought it would be a lot more robust and reliable, even more flexible to some extent.


I was right in trying this so early on because I cannot even imagine starting at ONE line trace function desparately trying to figure out how the engine names custom trace channels for over 3 hours. I took me that long mainly because I was having trouble with the fact that the way I'm checking if a surface can be jumped off of is:

1. Setting it's Collision to block a custom WallJump trace channel

2. Doing a trace from the forward and right vectors of the player to get whether or not to do a side jump or a front jump.

3. If the relevant trace returns true then the user can wall jump by pressing the Jump button


However this doesn't account for the trace going through walls as it ignores all the channels except for WallJump channel. Which means that you can WallJump even if the surface that the trace hits is behind an object or a wall.

To remedy this I spent a good amount of time coding a workaround:


1. I do another line trace for the Visibility channel at the same time, with the same start and end positions

2. If the original WallJump trace returns true then I get the Hit Actors from both traces and check if they're the same.

3. If they are then the player can WallJump, if false then the user must be behind another object.

(NOTE: This is an extremely reductive way to explain everything, especially since the 3rd point won't necessarily be correct all the time)


This worked perfectly (only after many hours of tweaking), however the current issue is that the StickerSlap goal objects currently block the WallJump trace and make it a lot more clunky to jump on walls when they're slapped. However that's a whole other story.


Long story short/TL;DR:

Don't just fully neglect code, or at least implement Blueprint correctly so that you won't have to consult the AWFUL UE5 documentation

Get AGILITY CONTROL [pre-alpha v9.6.2]

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.