C++ VS blueprints

Hello!

I have been wondering should I go for C++ instead of my current pure-blueprints.
I have reasonable history from C# scripting, and apparently C++ isn’t all that different
I have ended the streak of sentences which start “I have”.

What are the advantaces of using C++ instead of blueprint, apart from visual studio demanding less from your computer (=less noise)?

I have heard C++ is “ten times faster”, but what does that really mean? By that I mean, how much do scripts affect the performance anyway?.

Hoping for answers, -DoctorPC

C++ will be faster for obvious reasons. One of the devs said Blueprints are almost 10 times slower. But we do not have any details about where the hit occurs.

I start with Blueprints for prototyping. Once I get most of the stuff right and feel like I need more performance there, I convert it into a C++ class while exposing many variables into Blueprints for experenting with different permutations.

The devs also said that any other scripting language would be just as slow, and the performance of C++ is what it is because the engine is written on it.
What I’m asking, is the performance really a factor? I did quite a lot of testing on Unity, and no matter how many lines of script I wrote, the performance took seemingly no hit. Of course, one reason to C++ would be the “if” statements, and ability to have “&&” in them (saves so much time and thinking). BUt yeah, if performance impact is noticable, or even clearly measurable, then C++ is easy choice :3

The perforamce of C++ is because it is compiled to native machine code. On the other-hand source in most scripting languages are compiled into an intermediate form, However this code cannot be executed by the CPU directly. So a runtime component must translate the intermediate code into the machine code for the target machine at runtime. This two-step translation is the major reason why scripting languages are slower, but this is what makes them platform independent. Addionally when a C++ source is compiled, it needs minimal runtime overhead for its execution as everything need for its execution is part of the object code. But for a scripting language, the runtime component (in this case the UnrealEngine) is responsible for allocating and accessing resources (memory, file, hardware…). This is an additional overhead.

Still, with todays high performance CPUs, this difference is usually negligible, because the code has other bottlenecks like slower hardware such as Hard-disk, Network, and Display device. For example, most Display devices run at 60 FPS, which gives you 1/60 seconds for your code to execute each frame. Most of the time, C++ code and Script both will find this interval pretty enough for execution. Ofcourse C++ will have some free-time left after each iteration, but it cannot use it because the display device is not fast enough for that. So C++/Script makes no noticeable difference.

However if your code has some very complex algorithm, that involves a ton of floating point calculation, you might find the Scripting engine run out of time. In such cases you have no other option but to go with C++. Essentially it all comes to 'Do you really need that additional bit of performance?". If your game is working and you are happy with its performance with blueprints, stick with it. But you need some additional performance?, try porting some of your CPU intensive logic to C++ (eg games with populated areas with complex crowd simulation… GTA, AssassinsCreed…)

For a small-scale project, performance is unlikely to take a significant hit by using blueprints rather than C++. If you’re designing a mobile application, I would favor C++ for performance reasons. For a game designed for PC usage, however, I doubt the performance hit from blueprints is going to be detectable, much less problematic.

PC master race, as they say :wink: To me I find it better to develop to PC, as there are far less variables that have to be taken into consideration (ie. performance is a really small factor, at least as long as you do the things even somewhat smart, but on mobile: different story).

well, that is the answer I was looking for :slight_smile: (not by it’s content, I wasn’t specifically hoping for some kind of answer, but by it’s way of more technically presenting the difference). I guess I could have far worse background, as for someone who wouldn’t have had any programming experience whatsoever (even be it scripting) having to port the more advanced logic to such a different territory would be far harder. I might need it for the more advanced AI systems (not too sure how adaptable the AI system in UE4 is, haven’t really taken a look into it), as AI is certainly a core part of the game (the hostiles have a lot of artificial senses, and need to adapt for losing some of them during the battle, which in turn could become a whole bunch of calculation).

Thanks, I downloaded the express -version of the Visual studio 2013, just in case :3

Same Situation, Assuming the game is for PC, PS4, Xbox One which is better it not an open world game.

First give Blueprints a try. If it meets your expectations, stick with it. Other-wise convert some of the base blue print classes to C++ classes.

So just for clarity, if you wanted to develop an organic open world with AI that causes the world to operate realistically without any player driven action, C++ would be a better endgame?

+1
They are good for small scripts but you really don’t want to make complex games with them.

Blueprints can’t do everything. Like resetting mouse positions, that requires C++.