x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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

Product Version: Not Selected
Tags:
more ▼

asked Jul 10 '14 at 10:46 AM in C++ Programming

DoctorPC gravatar image

DoctorPC
383 37 35 48

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

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.

more ▼

answered Jul 10 '14 at 11:31 AM

mindfane gravatar image

mindfane ♦
3.1k 152 38 263

DoctorPC gravatar image DoctorPC Jul 10 '14 at 01:22 PM

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

Jonathan Dorman gravatar image Jonathan Dorman STAFF Jul 10 '14 at 02:37 PM

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.

DoctorPC gravatar image DoctorPC Jul 10 '14 at 07:31 PM

PC master race, as they say ;) 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).

mindfane gravatar image mindfane ♦ Jul 10 '14 at 02:34 PM

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..)

DoctorPC gravatar image DoctorPC Jul 10 '14 at 07:36 PM

well, that is the answer I was looking for :) (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

Hullstrider gravatar image Hullstrider May 21 '15 at 04:56 AM

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?

pskpsk6 gravatar image pskpsk6 Aug 16 '14 at 06:19 AM

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

mindfane gravatar image mindfane ♦ Aug 18 '14 at 04:53 AM

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.

Thkaal gravatar image Thkaal Jun 01 '15 at 04:40 AM

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

Azarus gravatar image Azarus Jun 01 '15 at 05:13 AM

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

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question