Custom Bluprint nodes with C++ function code in-editor :-o

After venturing into write my very first C++ code test in UE4 and realizing that the big monster is really not so scary I wake up today with this dream:


Imagine that people like me, working solo, from designer side with a little programming skills could create custom Blueprint nodes and write directly in-editor simple function C++ code; without leading with Visual Studio (just one time installation) and complex C++ header declarations and function declaration, all managed by the blueprint editor.
Wait, I made my research first, I know we currently can create custom nodes and classes and is actually very handy (for C++ programmers). Also I know there is an experimental Code Editor plugin. This facts just prove me that what I’m suggesting is theoretically possible. Just need to know if more people and Epic staff thinks this will be useful for all.

Currently the easiest way I found to create a simple math function or loop in C++ and expose the node for blueprint was making an awesome Blueprint Function Library (was super-cool).
But I spent big time figuring out how to correctly declare the functions and parameters in the header file.

Imaging all this declaration part and source files generation could occur under the hood.

  • You declare a Blueprint function using the editor as commonly you do; creating inputs and outputs parameters.
  • You set that this function will be implemented with C++ code instead of nodes. Automatically UEditor will create all necessary declaration for you as a Blueprint Function Library or similar source files but you don’t have to deal with it. You stay in the editor all time.
  • Now you have a node with a Text field that you can edit the body of the C++ function.
  • When you click compile this node, UE send the updates to C++ compiler in some obscure place you don’t care about.
  • And ready, your node is working with all the advantages of speed and optimization of native code.

What do you think?

Well, sorry if you think this is non-sense, I’m not C++ programmer, just a designer with some Object Pascal background and loving UE4 too much :slight_smile:


Its an awesome idea but i don’t think it’s worth it because of the compilation time?

This is a cool idea, and it’s part of a larger set of opportunities to expose C++ programming more directly within the Unreal Editor. We like this thinking, and hope to move in this direction in the future once some new foundational pieces are in place. One thing that’s required is a pervasively-available C++ compiler for all UE4 users, so that all code can be automatically compiled behind-the-scenes by all users regardless of platform and programming expertise.

Object Pascal was a great language, as was its spiritual predecessor Turbo Pascal. There are still things I miss from it!

Thanks!, I think it could worth for the benefits of optimization you can do with these “native” nodes. I knew many years ago about how C++ was slow compiling, so it is still that slow?
In other languages like my dear Delphi (7,XE3) I was not familiar with “compilation time”, there I just hit compile and run in seconds :smiley:

@Tim Sweeney,
Wow, thanks, I’m glad to know you think it’s cool :slight_smile: When I tried the Code Editor plugin I guessed that UE was already heading this direction, and I wanted to explicitly ask for this C++ blueprint node, since I think will be the best way for people like me to interact with C++ code without getting too involved in deeper complications.

In one stream one Epic Developer once said they are even working on converting blueprints directly to c++ so not have the VM between it, would make blueprint a lot faster :slight_smile: They won’t have it finished soon, but they are working on it. I also really like the idea of c++ code integrated like this to blueprint. With such a node we could really easily call functions which are not exposed to blueprint without having to create a blueprint node for this. And I don’t want to make my project a c++ project so I have to open visual studio each time I work on my game just for being able to use a few functions I can’t access from blueprint :rolleyes:

I would really love something like this. For a programmer like me, blueprints feel clunky compared to code for some tasks. I would like a lightweight scripting language rather than C++, in order to keep code here simpler. Something like Javascript or Lua would be perfect.

Seems like a good idea!

I love this Idea! Hope to See this in near Future.

I know very little about Pascal, but it sounds like a language where it forces you to really program ‘properly’, there are no shortcuts or ‘bad’ ways of doing things like there are in C++. In C++ the code is only as good as the programmer, and while the same is probably true in Pascal it sounds as if Pascal really forces you to do stuff ‘proper’.

I think that’s why I feel good programming with blueprints, there are some similarities to Delphi XE# (Object Pascal) in the way you do things like Events, Interfaces, Strong typed, Dynamic Arrays, Strings and of course what you say of forcing you doing things “properly”. Also the compiling time of Delphi is lightning fast, bad thing is Embarcadero keep making it far of the reach of Indies and Game developers with exuberant prices and focusing on Data Bases and that. Still there are some guyskeeping it alive and we also have Free-pascal comipiler. There is a known story of the people behind Delphi that moved to Microsoft and made C# so nice with many features borrowed from Delphi.

Back to the main subject, there is a good debate on Facebook groups about this thread and many people thinks this will be good feature to have in UE4. Great! :slight_smile:


I still develop mainly in Delphi. Object Pascal is definitiely awesome. Im programming in Delphi since 1995, so just 20 years now.
Wow, time has passed :slight_smile:
Actually I did something like this for one of my own projects. i thought about adding a scripting language and then went to adding Delphi itself.
I used the freePascal compiler to have the “scripts” compiled either in advance, or dynamically before each execution. This also allowed for self modifying code with all its possibilities.

One step further:
If a blueprint node just contains some logic that generates a data output based on data inputs; and there is an option to have them available as self contained, compiled, code fragments (DLLs), then basically any language could be used to create blueprint nodes.
All it would need is to define the calling convention for the exported functions and parameters of the DLLs.

If there is then a field in the details panel that lets me specify the command line compiler call, then anyting that can compile into a DLL is good for UE4 coding… :slight_smile:

…Just my two cents on this


Yes, it is a very “strictly typed” language. You are forced to do type conversions explicitly. The most differences to C++ are:

  • All code for a class in in a single “unit” file. The declaration and the implementation… No .h and .cpp separation.
  • No garbage collection. You allocate it, you dispose it.
  • “String” is a native data type. Ok, internally its a pointer, but the compiler hides that syntactically.
  • Execution does not fall through “cases”. So no extra break is required for each block.
  • A function does not end once the result is assigned. The “result” is treated like a local variable and can be assigned over and over.
  • Delphi offers RTTI (RunTime Type Information) for its objects. So you can evaluate all kind of class and instance information.
  • There is no preprocessor in any form. (The only thing that I miss). Delphi does not know the concept of macros, unless you count inline-functions as “macros”
  • Delphi uses more keywords than single literals. Example: “begin” and “end” instead of “{” and “}”

There is probably more, but those are the main things that come to my mind…

Rather than C++, it would probably make sense to use something like UnrealScript since the syntax is remarkably similar and it can be compiled into the blueprint bytecode quite happily instead of creating some kind of autogenerated C++ monster that causes people headaches and comes with additional compile time…

I would like to see a comback for unrealscript but then again im getting used to the c++ … or I keep telling myself that :confused:

Other language scripting will be nice for us, every one has is preference (as i like pascal, and almost hated C++ once… ), but the value of this “C++ nodes” relay on performance gain and low level access to the engine in the easiest way. I don’t think Epic will spend resources implementing more scripting options when they are already putted big effort in offering a powerful visual scripting language: Blueprints.

This suggestion can be implemented more easy than integrating a new scripting language. With the same bases of Blueprint Libraries Just making some interface additions, linking some stuff and done! (lol, says me)
While to implement another scripting language you need to make a interpreter or compiler to BP byte-code. I try to keep myself realistic even sometimes seems the contrary :wink:

maybe its possible to create utility that can convert bp in c++(nodes to c++ code symbols), for example i create my actor in bp with some logic and then click button and unreal generate “.cpp" and ".h” files with the same functional, bu default it can be done not ideal and if user wont? — it can do optimization by hands

here is example from epic Unity to unreal tutorial

We can see that c++ code the same like nodes in bp so need just conversion!!

I think its upto us to make things like that. It doesn’t serve epic well to debug all the issues that come with scripting languages and let’s face it they slow down the engine after all the work they put in to make it c++ based without uscript. I think the community will add languages in time. Money on LUA being first.

Yep, Lua is first :smiley:

I really support the idea of compiling blueprint graphs into C++ code.Also the idea of in-editor coding is really nice.
I dont really see the point for large scripting language support on the part of Epic.
If users want/need that, they should implement and support that themselves on a plugin basis.

UE always had C++ coding, but accessible only to licensed developers. What replaced uscript is blueprint