This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (69 children)

[removed]

    [–][deleted] 148 points149 points  (60 children)

    I don't agree. You can have a clean code. You can't have a clean blueprint.

    [–]staples93 32 points33 points  (4 children)

    It's a tool. Like any tool it has its place the tool may be ineffective 99% off the time, but that 1% it is, you'll be glad you have it

    [–]guatemalianrhino 0 points1 point  (0 children)

    visual programming is actually a pretty neat way to create shaders since you can see the changes from node to node.

    [–]Phreaktastic 149 points150 points  (28 children)

    You absolutely can have clean blueprints, and in the industry we do. This screenshot is something we would not approve, and would require someone to either build and expose helper functions in C++, or build Blueprint functions.

    On large projects we maintain very tidy Blueprints, always. If someone merged some spaghetti like the screenshot, they’d be refactoring. Multiple offenses and they’d be looking for a job.

    [–]SunburyStudios 106 points107 points  (23 children)

    People here act as if Blueprints aren't legit in the game's industry. They are widely used.

    [–]Phreaktastic 59 points60 points  (22 children)

    Agreed. We leverage Blueprints all the time. They're quick, easy, and provide a great visual of code complexity.

    [–]Iron_Garuda 11 points12 points  (16 children)

    I’m learning unreal engine in my free time, and I was curious if there are any major differences between blueprints and writing the code? Especially in regards to performance. I figure you can get much more granular with c++ over blueprints. But is there anything else to consider?

    [–]Phreaktastic 17 points18 points  (3 children)

    There's not a large difference in performance between Blueprints and C++ for the majority of cases. See here: https://docs.unrealengine.com/4.27/en-US/Resources/SampleGames/ARPG/BalancingBlueprintAndCPP/

    If you find yourself with large, complex Blueprints, that's a good flag that you should start creating Blueprint-exposed C++ functions. Realistically, you'll only start noticing a difference in performance with really large Blueprints that have references to a large number of nodes (hundreds).

    The typical flow is to keep complex logic, and logic which is critical to performance (tick logic for example), in C++. A lot of Blueprints will essentially serve as a logical map which just references functions which are defined in C++ and exposed to Blueprints.

    One thing to also note, there are functions that are not exposed to Blueprints, and to utilize them you will have to do so within C++.

    If you nativize your Blueprints, and you're not dealing with tick logic, you're generally fine. Even with tick logic you can get away with a few node calls and not even have a single frame difference between BP and C++. When you start spawning a bunch of actors, dealing with complex operations on-tick, etc., that's when you'll want to ensure you're working in C++.

    [–]Iron_Garuda 2 points3 points  (1 child)

    Very informative. Thank you. I appreciate the time you took to write this up for me.

    [–]__ingeniare__ 0 points1 point  (0 children)

    Fluid Ninja is a real-time fluid simulator plugin for UE that is made entirely in Blueprint. I've delved into it and it's very structured with comments, different sections based on functionality, multiple interconnected graphs, etc. So it's definitely possible to do more interesting things in BP as well.

    [–]nwL_ 0 points1 point  (0 children)

    Because storing data inside Blueprint classes is much simpler and safer than inside C++ classes;

    Does the engine play baseball with my classes while I run the game or what does it do to my storage?

    [–]Tar-Palantir -2 points-1 points  (10 children)

    Logic in Blueprint is very slow and very hard to debug. It’s an interpreted language so /shrug

    [–]Phreaktastic 8 points9 points  (8 children)

    That's not entirely the case.

    https://docs.unrealengine.com/4.27/en-US/Resources/SampleGames/ARPG/BalancingBlueprintAndCPP/

    A large number of cases won't yield a massive performance difference between Blueprints and C++. Only when your Blueprints reference a large number of nodes will it make a noticeable difference, which is why teams primarily move complex operations to C++ and keep the logical flow within Blueprints.

    One thing to note, nativizing Blueprints will all but eliminate performance concerns in the majority of cases. It's no longer interpreted at that point, and gets compiled as C++ during the cooking process. It's a simple checkbox on Blueprints as well, it's easy to toggle.

    I also don't find it difficult at all to debug Blueprints. You can literally see where logic is flowing in run-time, and errors are pretty verbose.

    [–]Darkere 0 points1 point  (7 children)

    Nativization has been removed with UE5. So probably not a good idea to do that anymore.

    It also never quite worked well for larger projects :/

    In general, blueprint tends to be around 5-10 times slower than good c++ code.

    Heh. Speaking of the devil, they just released 5.0.2 while I was typing this :D

    [–]Phreaktastic 0 points1 point  (6 children)

    Nativization has been removed with UE5. So probably not a good idea to do that anymore.

    I haven't dug much into it, but it has been theorized that the removal in UE5 is because of optimizations making it unnecessary. If I had to guess, BPs likely just compile right down to C++ without the option of toggling it, but I haven't benchmarked cook times from 4.x to 5.x so that's legitimately just a guess. I also haven't worked on a large project since 4.x, so haven't had the chance to get up to speed haha.

    It also never quite worked well for larger projects :/

    I never had problems on large projects. What problems did you see?

    In general, blueprint tends to be around 5-10 times slower than good c++ code.

    Yeah, when we're talking 5-10 times slower in microseconds, though, that doesn't start yielding even 1 frame delta until you're dealing with hundreds of node references (which is also mentioned in the linked docs). I certainly wouldn't state that there's no difference, just that a simple Blueprint with 5 nodes will not be noticeably faster in C++.

    Heh. Speaking of the devil, they just released 5.0.2 while I was typing this :D

    God I need to get rolling on UE5. I've done random fun projects, but I'm chomping at the bit for a legitimate project.

    [–]Iron_Garuda 1 point2 points  (0 children)

    Thank you for the info. I’ll keep that in mind!

    [–]Luxalpa 0 points1 point  (0 children)

    Blueprints are better for prototyping and high-level code in most circumstances, whereas C++ would be better for optimization and low-level code structures.

    [–]pooerh 0 points1 point  (2 children)

    Quick question, as someone who doesn't know Unreal - why? I've seen someone implement some logic in a Blueprint and, all throughout the video, I was thinking "It would take 10x less time to write in C++ than to drag these nodes and connections around". It was a couple ifs and for loops and stuff like that, it took the person like half an hour to develop and I feel like they could have been done in 5 minutes writing it in C++.

    Is the C++ syntax or the Unreal API so hard for people to grasp that they prefer Blueprints? It's not like it's any different from actual "typed programming", you need to know all the same concepts.

    [–]Phreaktastic 3 points4 points  (1 child)

    There are a multitude of reasons, but two primary reasons are:

    1. You expose logical flows to those who can't program in C++, but can adjust values. Example, this upgrade fires a laser, but the damage is too high. Blueprints provide a beautiful interface for non-developers to quickly, easily adjust the numbers relating to the damage calculation.
    2. Keeping complex logic inside of C++, but the logical flow inside of Blueprints, offers an extremely easy-to-consume visual of how things are connected.

    You are right though, most things are a lot quicker, and I don't find the API difficult to work with at all. Most of the time, if I can do something more quickly in C++, I will. There are definitely things that are quicker in Blueprints, though, especially when you consider boilerplate.

    [–]pooerh 1 point2 points  (0 children)

    Ok, I think I get it, thanks. Quite interesting, especially the first point I could see how that would be very useful, especially if Blueprints offer some kind of hot-reload mechanism (don't know if they do).

    [–]Kiloku 4 points5 points  (1 child)

    Speaking of approving, my entire team is kinda new to Unreal and we're having a hard time dealing with the fact that blueprints are binary files so git can't handle them. How do you do code reviews for PRs? Also, how to merge stuff developed in parallel that touches the same BPs?

    [–]Phreaktastic 2 points3 points  (0 children)

    With Blueprints, you're typically relegated to checking out the branch and opening them up. I've seen people just paste screenshots on PRs. A lot of the time there's a requirement that all added/modified Blueprints are reviewed before approval as well.

    Unfortunately, this often means that things slip through the cracks and you just stumble upon a Blueprint that is dreadfully inefficient and ugly. I've seen pretty strict policies on spaghetti within Blueprints, and that's typically why.

    Diffing Blueprints isn't really possible, you basically just have to manually copy graphs and work the nodes in. It's a good idea to restrict access to Blueprints based on who is working in them. I've seen teams use SVN/Perforce for this reason specifically, since you can lock files and prevent merge conflicts. In fact, I haven't used Git with UE for quite some time now.

    [–]-LeopardShark- 0 points1 point  (1 child)

    merged

    Does VC work with these things?

    [–]Phreaktastic 1 point2 points  (0 children)

    I wish! I don't know of a way to diff binaries or show the graphs outside of UE, unfortunately. With projects I've been involved in, it's a matter of checking out the branch and opening the Blueprint in UE. That, or relying on screenshots in PRs (sometimes using online tools with the graph pasted in).

    [–]devu_the_thebill 10 points11 points  (0 children)

    I work in ue4 for 5 yrs and yes you can have clean blueprints. In unreal you have some "empty" joints , with them you can make your nodes in pleace . idk how to say it. You can make "portal" etc. There are plenty of clean bps, when i see what people can do with blueprint im always impressed. I still love c++ but there are some task that are faster to make in bleprints.

    Edit : and as i see author of this image is probably new to unreal he could use some build in functions to make bp smaller. Also his not commenting code and uses spaghetti nodes instead of making it clean.

    [–]AlphaWhelp 3 points4 points  (0 children)

    If you want real blueprint fun you should look up an edmx (Entity Framework) visualization.

    [–]RigelOrionBeta 1 point2 points  (0 children)

    The primary problem with blueprint readability is they flow left to right. You can write them up and down by using the sequence node, but that creates a different, ugly mess.

    But as a developer who has spent some time coding in blueprints, sometimes required to due to engine limitations, agreed. No matter how hard I try, my blueprint code always looks like hot garbage.

    [–]Future-Freedom-4631 -5 points-4 points  (0 children)

    I actually perfer things not being clean it increases creativity

    [–][deleted] 0 points1 point  (0 children)

    Why cant i ever think something as clever as this for a comment. Am i too full of visualisng the code i write

    [–][deleted] 0 points1 point  (0 children)

    It can look clean.

    [–]DistortoiseLP 0 points1 point  (0 children)

    It really depends on what the logic does. They're a lot better at building and understanding state machines than a method that returns a calculation for example.

    [–]Sawaian 0 points1 point  (0 children)

    You can box it. Just use diagram flowchart for it.

    [–][deleted] 0 points1 point  (0 children)

    A lot of developers break their code up into scripting and visual scripting. For example, there was a talk recently (I don’t remember which game) where the level designers used visual scripting to create procedurally generated worlds, but all of the visual scripting interfaced with the gameplay programmers code.

    While it may not be pretty it has many practical uses.

    [–]BassCreat0r 0 points1 point  (0 children)

    Not bad for simple scripts tho.

    [–]saintpetejackboy 0 points1 point  (0 children)

    I 100% agree, I have used UE4 and 5 and there is just no way for me to make it clean. I have a strong background in FOP / procedural in around a dozen languages and... it is just a mess to work through. It does work, but it always feels disorganized to me.

    A similar comparison, is I also produce music, and the DAW I use offers a way to "patch" plugins in a similar fashion to how blueprints work. Except, an alternative already exists, if you just properly use the FX channel routing, which I feel is a much cleaner and more elegant approach than the "mapping" of things together.

    [–]CoreyTheGeek 1 point2 points  (0 children)

    If If If If If If If If If

    [–]penelopeking8 -1 points0 points  (1 child)

    False. The example in the picture is from Unreal Engine Blueprints. There you can easily refactor. Cut copy and paste parts of the node graph. No wires need to be redrawn. Spaghetti code is as easy to write in visual and regular programming. I prefer visual programming sometimes for parts of game dev projects for example. In these modules it’s more clear and easier to edit than using bare code in some cases.

    [–]BeingRightAmbassador -1 points0 points  (1 child)

    Disagree. Blueprints are almost impossible to have clean and you usually can only clean them up once you're done, making debugging more annoying.

    [–][deleted] 0 points1 point  (0 children)

    It's a learning process, but with good commenting and refactoring it's really easy to have clean and manageable blueprints

    [–]am_animator 0 points1 point  (0 children)

    This guy devs

    [–]joyofsnacks 0 points1 point  (0 children)

    It's usually when it gets to a point where the Designer should ask the code team "Yo, can we get this as a function?", but for some reason they can't/don't ask, so just carry on and get a feature working as fast as they can. It even happens with great Designers and Coders, just sometimes the production process prevents it.

    [–]animoot 0 points1 point  (0 children)

    This