JRC Update 2 - Blueprint vs C++
14 May 2016
Using blueprint in Unreal is actually pretty nice. Visual languages are usually looked down upon as they aren't very powerful but it's possible to do a lot with blueprint. It is possible to make entire games out of blueprint, which is great for someone who isn't quite ready to take a dive into a full fledged programming language. You can quickly put together a game while still learning about important programming concepts. In the end, blueprint just ends up being a crutch. It won't run as fast as actual C++ will and as my main point tonight, it doesn't look as nice.
Blueprint gets very ugly very fast. It's possible to line things up and make them look nice, but I don't really see the point. Except for a few cases, it seems like you'd be better off converting whatever you've just done into C++. For one thing, C++ just plain looks nicer. Below is an example of some blueprint I threw together to draw a box for my teleportation code.
While there already is a function that draws a debug shape at a location, I created the above because the aforementioned function doesn't allow me to change the thickness of the lines used to draw it. This isn't very good in VR as a 1pixel thick line far away is pretty much invisble. Doing this allowed me to create a box that I could actually see. Below is what it looks like after I converted it to C++.
I need to change the thickness parameter into a variable so I can easily change it later if need be but that's pretty much finished. I'm sure I could do something where each vector is a reference to the previous vector or something but this is good enough. Right away it looks a lot cleaner than the blueprint does. It is very easy to see what does what at a quick glance. Not only will this code run faster, it's also easier to look at and debug if anything goes wrong.
Some things are easier to do in blueprint though. For instance dealing with animating the controllers, which I'll show off in my next video, it is easier to just make it in blueprint. All it's doing is moving some variables around so there's nothing super complicated happening. As you can see below it's pretty simple and easy to follow.
All this does is take a controller event and send a value to the animation blueprint for the controllers. When dealing with accessing another blueprint, it's easier to just do it in blueprint in the first place. I'd have to do some finagling to get this working in C++ so it's probably not worth the hassle when it's very simple like this.
It's nice to be able to have the option of blueprint whenever I need it. Like I mentioned in a previous post, I use blueprint for prototyping. It's very easy to throw some modules onto the graph, compile and hit play to see if they work. Figuring things out in C++ first isn't always easy. Visual Studio does help with autocompletion but I still need to have an idea of what direction I need to be going in first. With blueprint I can just start typing what I think I need and put it on the graph. Once I have the module I can see exactly what goes in and what comes out and I know if it's useful for what I'm doing.
Whenever I'm trying to figure something out, I always end up on a question or a forum post where someone is working with blueprint. I don't know if most people do all of their game programming in Blueprint or not, it seems pretty common. I for one will always prefer being able to type out actual code. It's just easier for me to follow as everything just goes top to bottom. With blueprint, you have to find the first execution node and follow that, then you get some sort of variable or parameter and you have to go backwards along that tree to see where it's all coming from. It's very easy to create a complete mess that's totally unreadable.
I'm far from an expert on how to use the Unreal Engine. The only reason why I even started was because of a Udemy course I purchased. If I didn't have that, I probably never would have started or I probably would have just stuck with blueprint. I'm just making things up as I go along, throwing things against the wall and seeing what sticks. Unreal Engine is definitely frustrating to deal with at times. I feel like my brain doesn't work the same way as everyone else's so I want to do something but it turns out there's no easy way to do it. Or at least, I don't know how to put it into words to search for it.
I often spend hours banging away at something only to finally find the right search terms and find the right forum posts to understand the whole picture of what I'm trying to do. Just getting controller animations going involved banging my head against the desk trying to figure out animations, and then blendspaces. Then once I figured blendspaces out, it turns out they didn't work for what I wanted. Then I had to do more searches and ended up on something I had looked at previously but didn't understand. Now that I understood how the animation blueprinting worked, that solution finally made sense to me and I was able to implement it as what you see in the previous picture. It's a long winding path, but I'm making my way through it.