Code or Blueprints? When to Use What?

So, I’ve seen many, many tutorial series which use Blueprints pretty much exclusively for their entire duration. I’ve seen maybe a small handful that use code. When should Blueprints be used? When should C++ be used? How would they work together in a realistic situation?

For example, lets say I want to make a game that features the following:

Inventory, item/weapon weight limits, item effects, AI, picking up weapons/items, switching between them, weapon accuracy and damage, AI reacting to and interacting with environment and other AI or stimulus, clothing system, randomizing NPC meshes, dismemberment, morality system, quests, etc, blah blah blah. Basically, friggin’ everything imaginable.

How would this go about being accomplished using Blueprints and C++? And how and when would the two work together? When would BP come into play? When would C++ come into play? What’s the most efficient way to reconcile the two? Would a C++ coder lay down the foundation of all of this and the BP scripters work off of that? Or are things more complex?

The general consensus is that you can do 99% of anything that you would want to achieve in a game with blueprints but C++ is faster.

Some people prefer C++ because it is what they know and it is easier to implement things for them but that would mean that you need to learn the Unreal API.

Same with blueprints some people swear by it because of its ease of use factor that you dont need to really touch and hard code.

Anything linking to an inventory or quests etc would be completely fine being done in blueprints because for things like this performance does not really matter all that much and also an inventory would be much easier to create in blueprints in my opinion.

You can use both of them anywhere it just comes down to preference, the C++ coder could potentially lay down foundation variables etc that can then be edited and used by a BP scripter using things like (EditAnywhere, BlueprintReadWrite)

Also with the new build 4.15 that is well on its way to an official release you can now convert BP into C++, some more information on that can be found here and how to use it: Blueprint Nativization (C++ converter) - Blueprint Visual Scripting - Unreal Engine Forums

I hope this gives you some insight :slight_smile:

Hi there Half-Rats,

Stuubo’s answer is excellent and I agree with him.

I strongly support Blueprints rather than C++ unless you have an experienced C++ programmer who can quickly learn the Unreal API.

Blueprints can save an enormous amount of time and even non-programmers can assist with development which can be great if you are on a limited budget.

However, Blueprints can have some serious bugs, especially depending on the version. Also, be very careful updating your version if you’ve started Level Blueprints, as nodes can/will be changed to the new version and may cause errors or serious issues.

Best,

You can use both in tandem although slightly more complex, if youre working with a programmer it might be worthwhile to push things from BP to C++ as a projects complexity grows giving you some extra speed from BP by not having lots of nodes weighing it down.

Theres no hard and fast rules, generally if you want to do something computationally expensive then its best to go with C++ and save BP for the more asset based functionality as you have direct access to references in the editor unlike in C++. With laying down foundations in C++ if someone doesnt have the ability to understand it then it needs to be documented, I find that BP is generally easier to figure out without more extensive documentation but it does depend on the complexity of the system.

Overall its something I dont think anyone has perfected on UE4 yet and the engine does aim to provide the flexibility to use whatever suits your project best.

How would you approach it from the opposite direction, where you have C++ experience but are new to Unreal. Which path to take, since both will have its learning curve, learn the API, or learn to use the visual scripting (VS).

I have run in to this with 3d fx programs like RealFlow when it added its take on VS where it was just python scripts before. VS is handy but inevitably implementing easy concepts like loops or logic gets difficult using nodes and wires. Code has its own overhead, complexity, etc…