spaghetti, what can we do about it? messy blueprints


forgive me if the answer is obvious, im only now starting to properly play with ue4 and may not have found everything yet.

blueprints, although they are pretty good in some ways, they tend to become huge very quickly. i will of course be using c++ for most things once i get the hang of the api, but for now im stuck using blueprints for most of my experiments.
what could be done in a handful of lines of code can easily stretch to 30 or 40 nodes or so, you end up zooming in and out scrolling over a huge acid spider spaghetti fest.

can you place a bunch of blueprint nodes inside a container?
to keep it organized and tidy,
Native Instruments Reaktor springs to mind, it uses a visual scripting system where you can put nodes inside a container, then either have in/out connections or use send/receive nodes so you can wire up several containers ect.
is there something like this?


Yeah, you can select the nodes you want to group > right click > Collapse Nodes. If that group is something you may use repeatedly you can also turn it into a function.

Collapse Nodes if you don’t need to reuse a large set of nodes and just want to get it out of the way.
When it comes to reusable blocks I use macros for smaller things (usually those that don’t need execution pins) and functions for everything else. You can convert a selected set of nodes by right-clicking, just as you would to collapse them.

As for the general structure, use the Sequence node! That way you don’t have to keep going to the right forever and can stack stuff on top of each other.

Bonus feature for functions (and only them): You can use local variables. Those avoid long connecting lines because you can just drop a Getter when you need it. They also won’t pollute the actual blueprint with temporary variables because they’re hidden away in the function.

thanks Jacky

Use reroute nodes to give your connections a nice flow also expose long range connections to variables

Sorry, but what is reroute nodes?

Edit: Ok, found it here. I used UE4 for a month now, & only know this feature now.

Hi Tegleg

There’s an old name I recognise from the UDK days :slight_smile:

In regards to Blueprints, you’re best to put all the logic into functions/macro’s. Then just use the event graph to just fire off the functions so you end up with very little on the event graph itself. The youtube blueprint tutorials don’t really explain this very well they just gumph everything into the event graph and like you’re finding they quickly become an absolute mess.

Even go as far to put functions within functions if need be just like normal programming, I find that if a piece of logic is becoming to large even within a function I’ll create a new function or macro to cut down on the amount of space it takes up on the screen.

I’d highly recommend NOT using the collapse nodes function, only because when you’re watching the blueprint whilst the game is running, normally you can see the flow of logic, problem with collapsed nodes is the flow stops at these collapsed nodes and it doesn’t visually look like its flowing through the node which is very confusing as you think something has broken. Unless of course that’s considered a bug and is fixed in 4.5. Either way it’s only doing the same thing as a function or macro would do anyway so you might aswell put it into a function/macro then you can always use this function/macro elsewhere in your blueprint if need be.

EDIT: collapse to function as mentioned by Zeustiak is fine and doesn’t suffer from the same problems as the ‘collapse nodes’ and I’d recommend using this aswell.

Also function and macro libraries are good when you want some general logic that could go in various blueprints.

Might be worth looking at this link below:

I put up a quick tutorial regarding casting to help someone on the forum and I explain and show an example of cutting down the mess in the event graph.

Here’s a simple example:

So here’s a function called ‘Find Enemy’. It basically fires a sphere cast and returns the actor hit. Not overly complicated but if you added this to the event graph even once straight away the event graph is becoming cluttered.


So now it’s in a function you just add 1 single node to the event graph instead and it keeps everything alot neater. Obviously ignore the fact I’ve then added two extra nodes to print a string, I wouldn’t normally put that in there it was just for debug purposes :slight_smile:

event graph.png

So basically, event graph, don’t clutter it, put the logic in functions/macro’s. Your event graph should be as simple and readable as possible and really should be an overview of the whole logic.

Give me a shout if you need any further help, any particular bits of logic that you want to run by me and I’ll try advise how best to split it up to be more readable.

I leeched enough knowledge off your good self back in the UDK days :wink:

EDIT: just had another thought…local variables. You can use these in functions to cut down on pins that have multiple wires coming off it going all over the place, just set the local variable once then you can use the ‘get’ on the local variable instead of sending an output pin to multiple input pins spread out all over the place.

Basically think of it like real programming, which I know you’re adept at Tegleg :slight_smile: most of the methods to keep your written code clean and readable apply to blueprints.

Macros, Functions, and Pure Functions are key, and “Select>RightClick>Collapse to Function” is one of the greatest things ever. :slight_smile: Custom events are nice too.

Even with those solutions you will likely run into issues where you have to have delays and loops on a graph for some reason, or maybe you just want to keep certain elements visible for visualization purposes. Reroute nodes, variables, etc are all going to be essential to creating neat looking graphs.

Personally, I have so many functions in one blueprint that I am desperately waiting for them to add folders just so I can organize that little window. :stuck_out_tongue:

Do you mean the left hand window pane that shows the list of functions/variables/events? If so you can create custom groups. If you look at my screenshot on the previous post you can see there’s two separate groups there, ‘trace functions’ and ‘test variables’. Those groups are collapsable (think i might have made a word up there) so you can keep it easy to read.

What I’d really love is the Nuke style of node-graph.

Mainly, straight lines, unified snapping pivots (none of this slightly offset nonsense in UE), and the ability to place pins mid connection to tidy things up.

Obviously they’re totally different worlds, but I find it a lot easier to see whats happening in this:

Yeah, I have 24 folders of variables. At least 200 variables, though it might be up to 300 by now.

It is functions that I need folders for. Just counted 164 functions in my blueprint.

very interesting, thanks everyone, and thanks for the tutorial savagebeasty :slight_smile:

1 more thing while im here, with the intent of back engineering and basically copy/pasting code to learn from, where do the blueprint nodes live in the source?
ive only found a few and searching the source by the blueprint name you see in the editor comes up with nothing.


i agree the visual style of blueprints is not the best for creating easy to follow networks, an option to get rid of all the ‘vista’ style stuff would be great, and probably much more efficient for the engine.

i kinda prefer Reaktor style nodes
(wow my old site needs updating lol)

Put the 164 functions into different groups then, surely it’s the same thing as a folder :slight_smile:

It would be nice to a folder hierarchy though thinking about it, groups within groups. I can see that if your 164 functions wern’t related in some way you could end up with 164 groups in that list so yeah I see your point :slight_smile:

That is pretty funny(but perhaps more sad :stuck_out_tongue: ). I am pretty sure using the category on functions didn’t work when I tried it months ago, but it looks like it was since patched and I didn’t notice.

You can’t drag them like the variables, but it is certainly better than nothing, thanks. :slight_smile:

Yeah the more I think about it the more I’m thinking your right and it’s a rubbish system currently :slight_smile:

no way to reorganise stuff easily and defo need some form of a tree view like windows explorer.

I’ll let you stick a thread a the feedback for Epic section, it’s lunch time and I need my afternoon nap in my car :slight_smile:

Yeah I created that thread ages ago. I bump it every couple months, but the devs have already said they want to improve that area so I am just patiently waiting.