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
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
Wow, thanks, I’m glad to know you think it’s cool 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 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 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!
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
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…
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…
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
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
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.
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.