Blueprints vs. C++: How They Fit Together and Why You Should Use Both
Vložit
- čas přidán 5. 06. 2024
- It's not an either/or decision. Learn what makes C++ and Blueprints different, what they have in common, and how to use them together effectively. We'll also learn a thing or two about performance optimization and some basic software design concepts.
Read the article version: awforsythe.com/unreal/blueprin...
00:00 - Introduction
01:29 - Common Ground
02:18 - Design Concepts: High-Level vs. Low-Level
03:10 - Design Example: Weapon System
04:44 - Design Concepts: Scripting vs. Programming
06:44 - C++ and BP as Programming and Scripting Languages
08:54 - Video Scope: Where C++ and BP Overlap
09:52 - Performance: How C++ and BP Are Compiled
10:48 - Performance: Comparing Compiled C++ and BP
15:23 - Performance: Conclusions and Profiling
17:35 - Project Organization: Class Design
18:54 - Design Concepts: Types and Dependencies
20:33 - Project Organization: C++ Modules
23:05 - Project Organization: BP-to-C++ Dependencies
24:36 - Design Example: Refactoring from BP to C++
28:31 - Design Example: Doing Everything in C++
31:03 - Design Example: Basic C++ / BP Interop
33:11 - The Traditional Programming / Scripting Split
33:47 - Design Example: Blueprint Function Libraries in C++
34:13 - The Main Event: C++ vs. Blueprints (it only took 35 minutes)
34:52 - BP Advantages: Assets, Visuals, Scripted Events
36:54 - BP Advantages: Ease of Use
38:34 - C++ Advantages: Performance, Fundamental Code
39:56 - C++ Advantages: Engine Functionality Not Exposed to BP
41:45 - C++ Advantages: External Libraries
42:18 - C++ Advantages: Diffing and Merging
45:05 - Personal Preferences
46:39 - Outro and Thanks
Patreon: / alexforsythe
Twitter: / alexforsythe
#UnrealEngine #UE4 #programming
I tried a hybrid approach where I implement low level stuff on CPP and high level on Blueprints. However, Blueprints are really not stable. For one they break if you make any refactoring in CPP code while other CPP code gets automatically refactored. Second, even for simple stuff CPP code seems to be better organized than blueprints. Third you can get various problems with blueprints when making version upgrades but CPP is almost always flawless. I once spend 2 days fixing a blueprint related problem that occurred on version upgrade, and fix was appearantly "renaming variable to something, compiling it and renaming it back to its original name"
So yeah, now I'm just slapping CPP at everything I can wtih minimal blueprint interactions. Not because i'm "real programmer that does everything on CPP" but because I had much more stable experience working with CPP than blueprints.
I still setup paths and references by extending classes via blueprint. I just try to keep blueprint "code" to minimal.
I wish there was a way to "code" blueprints. Blueprints are in background just code organized in graphical manner, It shouldn't be too difficult to expose underlying code in a nice manner in text form for us to write blueprint scripts.
I really like the concept of having high level scripting language and low level C++ for performance but I don't think blueprints - from programming perspective - work that well. Stuff that I can code in 20 lines of CPP end up taking massive visual area and turn into spaghetti with blueprints. Yes my lack of visual organization has role to play on that as well but still. I really wish we had Python instead of blueprint
This is a well-thought-out, reasonable comment. I held pretty much this exact opinion earlier in my career, and I still agree with a lot of your points today, so my response is "here's some additional food for thought" rather than "go to hell you're wrong."
First, just to get the obligatory cranky-old-man, you-don't-know-how-bad-we-had-it talk out of my system: Blueprints have come a long way since their initial launch, and they're remarkably stable these days. Don't believe me? Go back to Unreal 4.1 and try working with Blueprint interop! Back then, the editor crashed if you looked at it sideways! You don't know how bad we had it!
...OK, sorry about that. On to some real points.
Anyone who's ever made C++ changes only to have the editor crash when loading a Blueprint can understand what you're talking about re: Blueprints feeling unstable. If you're one of those people, and you only take one thing away from this comment, make it this: Core Redirects. docs.unrealengine.com/en-US/ProgrammingAndScripting/ProgrammingWithCPP/Assets/CoreRedirects/index.html
If you refactor something in C++ that has downstream dependencies in Blueprints, then you just slap a line or two into the [CoreRedirects] section of DefaultEngine.ini to record the old and new paths/names for the classes/properties/functions/etc. that you've renamed or moved. The Engine takes care of the rest: all references (including references from Blueprints to native types) go through this automatic translation process and will be seamlessly fixed up.
That's a very simple, straightforward fix that applies to the majority of cases where you need to preserve Blueprint compatibility in response to C++ changes. If you find working in C++ to be fun and carefree and light-as-a-feather, only to be crushed by the sudden thought of "oh god, but what's going to break in Blueprints if I make this change," then you need CoreRedirects in your life.
There *are* other cases besides simple renaming/moving, where you might have to do something slightly more involved, like deprecating old properties and patching their values into new properties on PostLoad, or, in rare cases, attaching a debugger to figure out why something's crashing on load. These are costs of a workflow that supports Blueprints. These are also important skills to have.
You just have to weigh those costs honestly, and you have to appreciate and learn those skills. After that, the decisions are yours to make.
I've seen people who are weirdly, counterproductively resistant to Blueprints because they got frustrated with these sorts of issues and just decided "I know C++; I don't need to bother with Blueprints ever again." I nearly fell into that trap earlier in my career. The problem with that line of thinking is that it stops you from learning *why* those issues are happening and learning *how* to anticipate and avoid them, and it biases what should be an objective decisionmaking process.
You're not doing anything wrong by choosing to use C++ for most things, as long as you're not insisting on using C++ for things that it's objectively ill-suited for (direct asset references, scripted sequences, etc.), and as long as you're not hamstringing Blueprint-savvy people on your team by yanking tools out of their hands. The workflow you're describing (i.e. a thin layer of Blueprints on top of mostly C++, where Blueprints handle asset references and visual details but have minimal gameplay-relevant logic) sounds pretty much like the workflow that traditionally-organized gamedev studios tend to use. There are plenty of good reasons why that's a common approach.
Based on your comment, it sounds like your reasoning isn't "Blueprints are terrible," it's just "I have weighed the costs and this is the workflow that makes the most sense for what I'm doing." More power to you - my only advice is to make sure you're keeping an open mind and reevaluating based on your continually evolving understanding of how things work *now*, not based purely on past experiences.
@@AlexForsythe I truly appreciate the information and thanks for the answer! Going into the future, I will keep your valuable advices in mind and I agree that I shouldn't just ditch blueprints because I had bad experience with them but instead try to learn and understand root of these issues so that I can become a better engineer.
@@SomeKindOfMattias As of C++17/20, how much easier is it to write higher-level expressive code in C++?
@@DefinitelyNotAMachineCultist I'm far from an expert in C++, coming from C# fairly recently. That being said, you can use things like templates, but not expose to blueprints (I think they're working on better template support). Subsystems are great for abstraction out aspects of a system. Gameplay Tags are awesome for a host of things.
n general though it's more about knowing a and implementing design patterns, and that doesn't requite much from the actual language
@@AlexForsythe I'd have to back up OP here. Extending Blueprints in C++ seems really interesting, and is something I plan to support in my own engine. Well, something like it, not Unreal's Blueprints, but a visual scripting compiler that you can hack at in C. Something for UI specifically. It would be nice to have a more powerful scripting language to handle asset references and gameplay code like you mention. The only problem I've heard of wrt Blueprints is performance at scale. Doing *everything* in Blueprints has a performance cost, but most may not see it AFAIK.
This is like watching the Bob Ross of unreal engine.
second that
Everything about this video is a masterpiece! The voice, the video animations, and obviously this immense knowledge about Unreal Engine. Thank you.
Couldn't have put it any better... Well besides for him not saying, 'Happy lil rockets' or whatever
@@-abs- it feels like Bruce Wayne is giving you a lesson on business.
nailed it
I pray you're at LEAST the head of engineering at your company. So few people have the capacity to delivery complex topics this coherently.
The quality of this video is exceptional, the pacing is incredible, the information is invaluable, and your explanations and included examples are extremely helpful. I am so glad I found this video, and I still can't believe that this quality of video is available for free. Thanks for making this.
I'm really glad you humored the "real programmer" because I never saw the real value of blueprints until this video.
totally agree
Have you tried using c++ with UI vs the UMG editor?
@@chancylvania UI with UMG seems waaaay bad-optimized, but I don't care too much about the overall performance impact.
In fact, I prefer to use both C++ and BP when I'm working with UI.
@@morderus0033 why does it seem badly optimized? I’m talking about the widget UI bp object you can create. Maybe the UMG editor is something different
@@chancylvania maybe I am not the best programmer, neither have the best practices, but doing a Main Menu using only blueprints causes the game to crash or just bug, if I try to do something more complex
I learned more from this 45 minute video than Ive learned from hours of other tutorials. thank you
You make the best content by an extremely large margin, and this includes the official UE4 stuff imo :D
As a beginner in Unreal Engine . I needed this today . Vielen Dank !
I was under the assumption that all functionality was better in c++. I’m glad you explained use cases of blueprints that are more than FX. This was amazing.
I would prefer C++ a lot more if not super long compile times. Until I buy better CPU at least even then still blueprints would be faster to compile.
But lot of node spaghetti can be fixed with C++ too. So best is use both.
This video is so high quality, I've never seen such a high quality video before explaining UE topics.
Please guys, give him at least one month of patreon support! I'll be doing it now too. (edit it's actually per release of video, not per month)
Uhhh. This is the best unreal engine video on the internet. You are amazing, dude.
At exactly :29 into this video I saw a Cursor duplicate and someone started writing two functions at once and knew I had stumbled onto something special here. How does this have so few views?! This is the single best unreal video I've seen (and yes I'm including their official videos in that comparison). The production quality, pacing, everything is A+ top tier. For the love of God I hope you keep making these--this channel deserves way more credit than it's getting currently.
This is amazing
Your content is unbelievably unique. There is quite literally nothing like it. Nor the quality you produce.
You're the Bob Ross of unreal engine. Losing you is the day we all lose a part of unreal engine.
Best Unreal Engine teacher! Can’t explain how good this videos are. Best mix of “How’s made” tv show and game development 😆
This video is incredible! It answers a vast array of questions about game development in UE4, all in a compact packaging. The voice of the narrator is pleasant, the animations are extremely good and fit the content perfectly and the subjects that are covered are exactly what I was looking for. Look no further! All the answers to your questions as a beginner game developer in Unreal are here!
This video is so well written that even though I have no experience in game development and Unreal, I left the video with a general superficial understanding of game architecture, C++ and Unreal in less than an hour, even if that wasn't the focus of the video. Literally one of the best educational videos I've ever watched on CZcams, in general.
Am I the only one who felt like standing up and clapping at the end of this video? Amazing work alex, thank you for your time and effort 🙌
I came here to learn about the differences and benefits, specific to unreal. I ended up learning things that change the way I think and create as a programmer in general. Thanks!
Another advantage of C++ vs Blueprints: game debuggability outside of Editor. This is a major one for me, importance of this grows with the scale of the project and the number of supported platforms. You won't be able to debug blueprints directly anywhere outside of Editor.
I wish I would have seen this video years ago. I learned more with this one video than I did in the last year of tutorials. Thanks
I'm trying to learn UE and am a nine-to-five developer (on the java platform). Your quote on being a [hardcore] programmer which don't want to resort to silly point and click blueprint; called me out. I wanted to do achieve everthing in C++. Until I watched this video. Thanks for calling me out with my narrow minded attitide and helping me adjust to a proper learning approach from here on.
Hello Alex, I am a Unity dev' learning Unreal and I wanted to let you know that you did a wonderful job teaching how C++ and Blueprints should/can be used in a project.
I thank you very much for sharing your knowledge on this, and doing it in the cleanest and most understandable way I could imagine !
Have a great day and thank you again !
Best dang UE channel on CZcams. Thank you for everything you do!
I hope Alex Forsythe is doing ok as I haven't been able to find any follow up content. But as a software engineer with 20+ years experience just playing around with UE - I found this to be a masterclass. Great work, wish there was more, hope you're OK and just busy working on some awesome stuff and don't have time for social media.
Thanks! I'm glad you found it useful, and I appreciate everybody's comments.
Indeed, I'm just busy with work and life - these videos took a ton of effort to produce, and I made most of them during a hiatus when I could devote the majority of my time to them. These days I'm more concentrated on paying the bills, which Unreal tutorial videos sadly don't do as well as a full-time software engineering job :)
@@AlexForsythe Good to hear! Seriously you packed in so much general wisdom in this video about software engineering I was compelled to watch it to the end :) The extra UE C++ vs Blueprints was just a bonus.
@@AlexForsythe Hi, I just stumbled on this video and I loved it. Glad you're well.
Have you considered making shorter unreal c++ videos (5-10 mins) and instead of making these beautiful graphics and animations, you just sketch diagrams on a piece of paper for example? Maybe it would be easier to produce videos that way until you grow your channel and Patreon to the point where you could sustain yourself with this content.
Anyway, I just watched a couple of your videos, and as Alex said, they are a masterclass. Great job, thanks for these videos and I wish you all the best! :)
I am forever grateful for sharing these videos about the architecture of a video game and about how UE works in general. Every time I decided to start a project, I had exactly these questions:
- How can I make sure that my code is clean, maintainable and scalable?
- When should I use blueprints?
- What design patterns are commonly used in a video game?
- How do I organize my project?
- How do I refactor a Blueprint to C++?
- How do large companies handle huge and complex projects?
All that and more has been explained in your videos, facing all the problems and with examples. I believe that any programmer has his mentor, for me, it's you.
I'm speechless, thank you...
I got my first AAA job back then thanks to you and your MOBU tutorials. Now history repeats with Unreal engine. Thank you a lot!
How someone can watch this and not feel obliged to subscribe is beyond me, great work and very useful information.
OMG, this is the best visual lecture on c++& UE4 I ever seen in my life. A truly masterpiece.
linking your explanation with visual animation of "what it mean and how it work" make your point more clear than reading thousand & watching 100 hours of udemy ,I'm god damn serious.
YOU ARE THE BEST . I can't wait for future uploads
I have no idea how I got here, but I wish it happened earlier. Thank you so much for this video!
I really appreciate the effort into the video editing quality as well as the structure of the content.
Please continue creating more content, you're doing great work!
This entire playlist is pure gold, thank you!
This was easily the most informative video that I've ever watched. Not only did you explain blueprints and cpp well (where I literally don't do game design and only web apps with JS), but you introduced and explained game development philosophies that I've inferred or heard about, but in a way I can tangibly understand how to apply to my projects.
You have provided me with invaluable information that I literally could never even get a glimpse of with Unity because of their tutorials. I am very excited to start playing with Unreal and this only helped. Thank you.
By far one of the best explanations I've seen. I'd love to see a production quality build along series. It's rare to see these types of videos with proper code architecture using modules etc.
Good grief this is one of the most beautiful explanations of anything ever. Such great helpful visual aids. You've taken a topic that is a really tricky one for beginner/intermediate unreal users to understand and spelled it out in elegant simplicity. Thank you so much. Please do more tutorials. I hope you can monetize in some way. Would love to support you creating content like this!
Alex you cannot just make such a awesome video and then disappear from CZcams
Exceptionally good video! I'm so glad to see someone talking about a game engine who has both comprehension of software engineering concepts and the ability to explain them in a relatable manner. I'd certainly love to see more content with this tone.
i have been waiting for years for something like this. Bravo
One of the best videos on Unreal I have ever watched, extremely well done
Best video ending the debate on C++ vs Blueprints I have ever seen, thanks for all the effort put in this video.
This is exactly what I was looking for, I am new to unreal and got some basic clarification about Blueprint VS C++ but now it's all clear! great work thank you!
I've never seen anything so well presented in my life. It baffles me that this guy has only 25k subs for this high-quality content.
You're the first person who has explained C++ in a simple manner and demonstrated the code alongside its equivalent in Blueprint. Thank you!
This channel is a gold mine. 10/10. I hope you continue to create content for the community. It's not easy to find decent tutorials like this on the internet
This is the most informative, educational video I have ever experienced on CZcams, by FAR. Thank you for your time and work put into this content. I have learned a TON!
Awesome video as always! Very detailed and in-depth. This is the quality that only few people achieve with their tutorials. Keep up good work! :)
Alex, I am just starting my journey into Unreal, and I am so grateful for this specific video. Trying to wrap my head around not only learning a new language, a new FRAMEWORK with that language (Unreal C++), and then also trying to figure out how to split between C++ and BP in my project... it was pretty overwhelming and I almost gave up a few times after some unproductive nights. This video (and lots of answered questions on the forums) help me get me past my hump. I've rewatched this multiple times and found something that I had missed the first time and had a better understanding of it.
I don't have anything new to add to the conversation, just a massive THANK YOU for sharing your knowledge. :)
Just had to leave a comment about how well this video is edited and presented. Incredible visuals, flow, visibility, explanation....This must have taken days to edit. Thank you so much!
A very articulate video about a topic difficult to summarize, with production quality off the charts. Good job :)
Now, this is some actual good content. Advanced tutorials with this amazing production value are kind of rare.
true
I never subscribe to any channel, I just subscribed to this channel very well done I needed this years ago, Thank you!
This video was super useful for me!! I'm a hobbyist who's learning C++ after already understanding blueprints, this video actually gives me a great base of understanding for what each is used for and where to start. The direct comparisons were especially helpful. Subbed.
All the reference material included in this is amazing...thanks for all the effort.
For somebody like me who has been using blueprints for years and started to learn C++ afterward, this video is a gem! a lot of the things mentioned seemed common sense to me while learning C++. I love still love quickly designing or testing codes in blueprints then writing them in C++. The time it takes to compile, close editor, recompile, crash and restart due to missed pointer check, its just crazy. Needless to say that a lot of the time, you write the code and you're sure its right, but it still doesn't work just because the live coding sucks at times or its that nullptr check you missed that ends up crashing the engine and there you miss all your unsaved work! for all that headache, its easier to quickly iterate in blueprint, tweaking..etc then transcribe the code. Blueprints are simply one UE best features!
I can't believe this video exists. Never in my life have I found a more clear, concise, well laid out and enjoyable explanation than in this video. Thank you Alex!
The best course about UE blueprint & C++ I have ever watched! Without "one of".
This may be the highest quality educational video I have ever seen on CZcams. It is extremely well researched, edited, and illustrated. This is not your typical CZcams fare. Thank you.
That's the kind of explanation I have been looking for years! Thank you!
Man, you nailed this breakdown/comparison perfectly! I was a little hazy on the details up until now, but your video really cleared things for me, so thank you!
I've worked with Blueprints for a few years and have been searching for videos providing a jumping off point into learning C++ for Unreal and how to combine knowledge of the two. This video popped up in my recommended and I was immediately hooked by the clarity of the production and explanations, but after a few minutes something about your voice was standing out as familiar. Finally I realized that I'm indeed quite used to hearing your voice already, as a longtime sub to StephenVlog and StephenPlays. That was an unexpected surprise. Thanks for the video Alex!
UNBELIEVABLE. Just an incredible master class on what a masterclass should look like.
This is such a well-researched, well-organized video that covers everything I wanted to know (and more) coming from Unity. Thank you for all the hard work you clearly put into this.
Thank you so much for making these. I've been watching a lot of Unreal tutorials on Blueprints, but so far I'm having a REALLY hard time following them, as most of them are REALLY FAST and in a THICK russian accent. You take your time, you're very well-spoken, and you actually know how to communicate and have a lot of depth to convey. I hope youve done a lot more Blueprint tutorials, because I really want to watch them.
This dude is the Saint of UE4
Although I use Unity instead of Unreal Engine, I still gain a lot of insight on visual scripting versus coding.
This video is so great that it should be recorded in the Guinness World Records.
Applaud();
Salutations();
Cheers();
Been at this for a long time and this is genuinely the clearest and most informative video i've seen pertaining to coding in Unreal
Incredible video Alex, thanks for creating and sharing this!
I feel like I am watching educational TV here. And I mean this is the most postive way possible. There is quality control, things are layed out clearly and with specific intent. It feels like it has professional producers behind it. Well done.
The best video that I've seen so far about the c++/blueprint topic, thank you so much, I learned really a lot!
Underrated, this is one of the best general game design videos I’ve ever watched and teaches fundamentals that are never normally taught but are extremely important.
Mate, I'm 2 months into my Unreal journey after graduating from uni in computer science. This shines so bright for me compared to a lot of the tutorial videos on CZcams. The production and presentation is amazingly on point too. Great speaking voice, great visuals. Well done!
This video was so freaking good. Thanks for taking the time to make this!
The sheer amount of effort taken to make this video is astounding! I chanced upon this video with no intention to watch beyond the first few minutes, I ended watching to the end and ended becoming semi literate on computer programming design and many other topics. This video is a Masterclass! Thank you Sir!
This is awesome! I'm leading a young team into Unreal with no experience in Unreal myself and the question of blueprint vs c++ is something I've been struggling with. Thanks for the video it helped validate my decisions for our team. Like you said there's a lot to consider.
You should really do more videos with topics like this. One of the best CZcams channels for learning Unreal here. Really appreciated!
This is probably the most useful video on Unreal that I've seen since I first started learning a year ago.
I am probably years away from needing to get this granular in my project. But my god, this is such a thorough and detailed explanation of the cost/benefit comparison it should be in Epic's documentation. Thank you!
This was beautifully illustrated. Thanks!
This might be the single most impactful video i've watched as an introduction to Unreal. At least for experienced C++ developers. Great presentation style, easy to follow, maybe a bit technical for absolute beginners but for my level this is exactly what i've needed.
Honestly this is one of the most informative and best videos I have ever seen about Unreal Engine.
Jesus, that's a good tutorial. Fleshed out detailed examples, concise, good structure, clean style.
I'm half way in and I already wish I could like this twice. I wish I had a teacher like you years sooner. I'm a software developer dipping my toe into games and your explanations of low level code execution and architecture are just perfect - and the animations seal the deal. Impressive stuff!
I must say that's a very professionally made video. Well structured, well narrated, cool motion graphics. And it's very useful for me.
Incredible video! Well played!
Quick, clear and awesome video
The ABSOLUTE best video ive ever seen that ACTUALLY explains how things work, pros, cons, the works. You even going down to the machine code level to explain things was flat out the best thing ive ever seen. PLEASE keep making videos. This video could straight up be something youd see in some Udemy course.
subbing to keep your videos as a future reference but i honestly believe you could easily make it big on here if you continue.
Thank you, amazing breakdown. Had me glued for every second of the video!
Wow. Just wow. Stunningly high quality content, from the UE breakdown to the software engineering fundamentals. This was a masterclass in educational presentation just as much as it was a masterclass in UE. THANK YOU!
Incredible content! Very clear & concise - keep it up!
this.. is.. everything. THANK YOU SO MUCH for the time and work you put into this video. Everyone has their own approach to doing things but this tutorial/exploration dictates EXQUISITELY the interactivity of code and scripting, the usefulness of c++ AND the blueprint system, and more than anything, CONTEXT in how to properly utilize the engine. I really needed this explanation. Thank you!!
One of the best coding explanation video ive seen in a long time, good job!
Absolutely fantastic video, clear concise and well relayed information. Thank you and keep it up!
Your videos have been extremely helpful to me. Thank you for spending the time to create such high quality content!
Good video that allows you to understand different perspectives on when to use Blueprints and when to use C++ (or both)
Excellent video. Honestly, the best educational content that I have ever seen for Unreal Engine 4; bar none.
crazy good production quality and extremely informative
Amazing explanation, excellent editing, thanks so much for making this available for free.
If 5% of youtube would be structured like this, gaming industry would be so much better, specially for indie dev teams.👍
As everyone else has said: phenomenal work. You’ve done an outstanding job explaining a variety of topics. Thank you very much for your work!
ive been looking for something like this SO long. ask people that do those "ue4 tutorials" about best practice and they just give you questionmarks as a respond. now i know what an event dispatcher is used for and that my blue print approach isn't as bad as i thought it would be :) thanks alot for sharing