C++ VS BLUEPRINTS… A HANDY COMPARISON GUIDE
Hey there Dev Squad, Virtus here. Today we’re going to be taking a look at a comparison between C++ & Blueprints written by Dev staff Crabo.
A constant debate between Unreal Engine users is the “C++ vs Blueprints” debate. Both are viable options, but which one is better? To understand which one is better, it’s important you understand what each of them are. You don’t have to be a master in both but some background information will help.
Blueprints are probably the best known what to program in Unreal Engine, most users will have used them at some point in their game development careers. It is, after all, the best way to start out. What what exactly are “Blueprints”? Blueprints are little nodes that connect to other nodes which forms code. They are written in the engine, using the blueprint integrated development environment. An integrated development environment, also known as an IDE, is just the software used to write code. Examples of outside of the Blueprint IDE include Visual Studio, Pycharm or Code Blocks to name a few.
The above example is a really simplified example, this isn’t a blueprint tutorial by any means, if you do want a blueprint tutorial, you can check out our blueprint series from our website here.
Within this course we go into a lot more detail about blueprints, giving you proper usage example and ensuring that you understand the fundamental logic behind it. We also have a variety of ‘create a game’ series which can be found here showing you how to develop an entire game using blueprints code.
C++ is a high level programming language which Unreal Engine was built upon. It’s not something to be attempted if you’re an absolute beginner but it’s worth learning if you want to enhance your development experience. The main distinguishing feature between Blueprints and C++ is the face that C++ doesn’t use nodes. It’s hand written code written in a text editor or IDE. By default Unreal uses the Microsoft Visual Studio IDE when writing C++ code.
Pictured is a very simple C++ program that prints “Hello world!”. I’s unlikely it’ll ever be this simple however as Unreal Engine 4 comes with a C++ API that adds a lot more syntax and can be complicated for beginners to learn. If you do want to learn C++ be sure to check out our FREE C++ fundamentals course which can be found on our website here.
The course will teach you everything you need from basic syntax & variables to using functions and loops along with plenty of C++ best practices along the way!
WHICH IS BETTER?
The main point to consider when working out which is better is the speed in which it compiles and run. When making a game, you want to make everything run as fast and smooth as possible. In order to do this, you’ll need to get the lowest compile times possible. To understand which one compiles the fastest, let’s look at how they compile. Before we dive into looking at compiling, keep this fact in mind: Code will always compile into machine code.. let’s start with Blueprints.
Blueprints are a pseudo language and aren’t really based from any language, although they do share some commonalities with C++. Unreal Engine needs C++ code to run and as such, blueprints needs to compile into C++. Remember that all code has to compile into machine code for the computer to run it. This mean that in order to compile blueprints the following happens:
Blueprints > C++ > Machine Code
As for C++, it get compiled into machine code straight away with no other steps in between. That means when you come a C++ project, the following happens:
C++ > Machine Code
Whilst missing out a single step doesn’t look that big, it matters a lot. That step of converting blueprints to C++ takes a pretty long time, whether it’s a few milliseconds or a few seconds, that time difference still matters. When making a game, you want it to run as fast a possible, it’s all about optimising it and in that regard, C++ is much better.
SO… WHAT SHOULD YOU USE?
With all of that in mind, what’s best for making games inside Unreal Engine? You may be thinking C++ and you’d be right. Or, at least half right. The best way to make games inside Unreal Engine is to use a mixture of C++ and Blueprints. It’ll make everything much easier. There are some situations that blueprints are better for, such as prototyping or simple programs (like making a door open, for instance) and some stuff that C++ is better for, such as scripting a player. So the ideal approach is to use both.
I hope you have all enjoyed this article and are now better informed on the programming choices and options you have within Unreal Engine.
Don’t forget, if you want to learn about either of these two programming languages, you can checkout our FREE courses using the links below.
As always guys, stay awesome… keep creating!
Your boy Virtus, signing out.