Obviously learning C++ is more difficult than blueprint. I was wondering why it would be worth learning? Could you tell me some examples of things that you can do, that you cannot do with out C++? thanks
Protip: Scale your learning requirements to meet your needs.
Also: you don’t know what you don’t know if you are ignorant to what needs to be known. It’s better to know that you don’t know something than to not know that you don’t know something.
That’s a good pro tip! The second thing you wrote should go on a fortune cookie.
There are lots of reasons why you would want to learn C++.
I would like to start by saying that you absolutely don’t have to learn it to make a game in UE4 though, and I would say that in all cases, deciding whether to learn C++ or to stick with blueprint should be governed mostly by what kind of game you would like to make, barring personal interest of course. Now on to some concrete examples:
First off, there is a lot of functionality that is currently available in the engine, but that is not yet exposed through blueprint. Some simple examples of this would be some of the newer features that are coming out, but haven’t had the time to mature in the codebase yet, such as the recast navigation system, or things that are too low level to be hard to expose through blueprint in a maintainable fashion, such as custom shaders. In fact any communication with threads other than the game thread, for example the render thread, can only be done in C++ using macro dispatch functions.
The biggest point I think any C++ programmer would make though, would be that blueprint is a very simple, and therefore limited language. Both in expressability, terseness and available libraries. On the other hand when you move over to C++ that means that you get all the features that C++ offers, and since most other languages can interop with C/C++, that basically means that you can basically use any library out there for anything. It is worth mentioning though, that by extension this also of course becomes true for blueprint, provided you write the glue yourself, which of course has to be done in C++
Some of these features, just to name a few; Templates, custom memory management and a powerful inheritance system!
There are some general things that most programmers would find almost indispensable, that is currently not available in blueprint, but will probably come eventually. An example of this is creating arbitrary threads. This is crucial for writing certain algorithms if you want to get good performance, or to batch jobs, but this is still not available in blueprint. There are probably design reasons as well as time constraint reasons for this not being available though, as multi-thread programming is one of the most difficult things in software development to get right.
Most of the things that are currently exposed through blueprint have even more functionality when manipulated through C++. This is the case for almost all classes that are exposed to blueprint. It should be noted that the most important functions and variables are almost always exposed, so unless you are not trying to do something very specific, it might not affect you. Some examples of this are multicast delegates and events that are only available from C++.
Performance - Blueprint code ends up generating c++ code before it is executed in your game, but just because it turns into C++ doesn’t mean it will automatically perform well. Blueprint generated code runs significantly slower than a pure C++ counterpart, this is mostly because making a visual scripting language requires you to make design choices that generate a lot more general code than you would end up with if you just implemented it directly. This usually means both less optimized code, and also just more code, and both those things will lead to slower execution.
Mergability - There has been improvements on the tools in the engine to help with merging blueprints, but it still doesn’t even come close to something like P4Merge, Windiff, kdiff or any other modern text diffing tool. This only really matters for larger teams with a lot of collaboration. But even teams of 3-4 people can run into serious problems when merging unless you are really good at making sure multiple developers don’t touch the same files.
Maintainability - This also mostly comes down to tools, but it is also a result of blueprint taking up a lot more screen real estate than C++ code. I find it a lot easier to navigate and make changes to well organized C++ code compared to blueprint. This is more the fault of the visual script language paradigm more than blueprint in itself though, and it is definitely something that is affected by personal bias. I have coded c-style languages for almost 20 years, but I’ve only done blueprint for about one year.
Debugging - The visual debugger in blueprint is very cool to look at, but it suffers from a lot of problems. The most glaring one is not being able to inspect variable accessor chains, you can only really see the result of an input when it touches an execution node. Another problem is that you don’t have a proper callstack so tracking down bugs almost always has to be done using prints and debugger stepping, which is not always the best way to do it.
There are other advantages to C++, but I would say these are the biggest ones.
In the end though, the big advantage of Blueprint is that it is much easier to understand (the errors you sometimes see in C++ can be puzzles in and of themselves, especially template errors), arguably easier to learn, and provides a good starting point in the engine. This is especially true if you have not programmed before.
If you have programmed higher level languages before, like C# or python, there actually is a few efforts being made to bring C# support for UE4:
I personally would not recommend this though until it has had some more time, but who knows, it might already work decently well
I hope this helped in some way!
Thanks tameran! i think i will learn C++ so I can create more with my game, and learn other languages later on. I have never programmed before though.
I know i dont know. thats why i asked…
I would also like to add alongside what Temaran mentioned that a blueprint like this is slow as molasses to open and compile. So at some point blueprints can become too large.
Constructing games is like constructing buildings.
When you first get started, all you know how to do is nail boards together with a hammer and nails. Your available tools are very limited and that limits what kinds of things you can build.
If you go on to build houses only knowing how to hammer in nails, and run into a problem which requires a tool you don’t know about, such as a saw, you’re going to struggle to find work arounds to compensate for it.
If you learn how to use a saw, then you now know how to cut boards into smaller pieces, which in turn, helps you build better buildings.
When it comes to games, I ran into this problem a long time ago.
I was making a simple space ship game which required my ships to fly in the direction they’re facing. I was completely ignorant to trigonometry. Instead, I banged my head against the wall, trying to figure out how to get my ships to fly in a certain direction given their angle. I coded up a really dirty hack which looked bad, but worked. Later on, I learned about trigonometry and that I could have solved my problem in 2 lines of code. It was a tool I just simply didn’t have at my disposal, and thus, I struggled.
Is it worth learning C++? Yes, it’s another tool in your tool belt to help you build games better and faster. It would be silly to turn it down as an option. If you know nothing about C++, then you are like me when I knew nothing about trigonometry.
Slayemin, your advice is worth gold. It goes hand in hand with your first advice : Scale your learning requirements to meet your needs. Also, what you don’t know is going to require the ‘other guy’ to know and do for you. C++ is a need. Just like animation, rendering, game design and every single element that is involved in creating a game. You have to identify who you are as a developer. Are you the guy who is getting the job done or are you the guy getting others to do the job for you?
For game logic i use only C++.
I can use blueprints only for actor’s local logic. Mostly for animation, special effects, selfcontained actor actions (jump, walk etc).
C++ code is much easier to write/edit/maintain, than creating blueprints visually with tons of tangled branches.
C++ visual studio has many helper functions -> VAssist, FindReferences, Find-Replace, Rename etc.
C++ code do not become corrupted from version to version, like blueprints.
Conclusion: text editing is better than visual editing, yes yes do not be surprised, but visual editing is good for small tasks.
I wish you much luck in your studies Aiden!
I would recommend doing some simple introductory internet course first since you mentioned you have no programming experience, and then moving on directly to making something very simple happen in UE4.
The hardest part about getting better at programming is making sure that you are improving at the type of programming you want to do.
Basics are of course very important, especially in C++, and the best way to learn the absolute basics is by writing simple console applications to learn fundamental syntax, using your IDE and even slightly more advanced skills like memory management practices and data structure usage etc.
But after those first steps, the best way to learn is still by doing, and if you are to learn by doing, you might as well do it in the environment you want the skills for, with the associated libraries.
I see far too many new programmers aiming to learn C++ for programming games practicing with user32 programming, some STL course material or Qt and the like, and not only is it not as fun and motivating, but you will also not be able to use the library specific skills when you start looking at your domain.
As a C++ programmer, I absolutly agree with you.
I will vote yes to C++.
To me, it easier to write/edit/maintain codes in C++ than Blueprints.
To say truth, I found I used more time to Drag Blueprints than write codes in C++.