x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Is it possible to make a game with Blueprints and C++ together?

Hello! I'm completely new to UE4. I've discovered how powerful is the Blueprints Visual Scripting, but I have the feeling that when the control became really strict to the developer, it's hard to achieve that with Blueprints, so I need the programming approach. One simple example: let's suppose I want to make a simple running ball game with procedural content generation. With blueprint I can manage events like collision, but what about the procedural content generation? I can easily create an custom algorithm on my own, but to do the same in Blueprints setting all nodes will be hard. So my question is: is it possible to use both in a project? Is it a good idea to use Blueprints wheter it's easy and using c++ algorithms for example AI part of the project?

Product Version: UE 4.14
Tags:
more ▼

asked Feb 28 '17 at 01:39 PM in Blueprint Scripting

avatar image

Goddener
62 10 15 24

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

Yes it is possible. I've done it already. Here are things that you have to keep in mind, tho :

  1. They cannot always communicate directly, as BP is not C++ until you compile them. BP can communicate with C++, but the other way around is more complicated.

  2. Get ready for a shitstorm of casts and UFUNCTION(), get ready to have a millions functions if you are doing your own pawn with replication capability.

  3. I strongly advise you use C++ to make your base classes, especially abstract classes, and then right click and your class > make BP from class to create a BP in which you will easily put a mesh, etc, using the viewport. This is way easier than guessing the position of every component with C++ functions.

All in all, everything that is abstract is better done in C++, at least because you don't need 15m² of space just to make a simple formula. The rest can be done in BP. To communicate, the best way IMO is to have a C++ class for every BP so you can simply cast your BP to it and use every functions in the C++ class.

EDIT : Let me give you an example of what I had to do. So I had a building (HQ_BP) that the player could build. The base C++ class was abstract (HQ), and was derivated into a HQ_BP class so that I could move my components using the viewport. Every functions I needed were in the C++, so that the BP was purely cosmetic. When I had to deal with the HQ in my C++ were all my logic was, I could simply cast the HQ_BP to the HQ and use every functions I needed. To create an instance of my HQ_BP from C++, I used a ConstrutorHelper to find my BP file (I don't think this is the best way, but that works). Now, If you were to try it the otherway around, that is, doing a BP with a lot of functions and try to call them from a C++ file, I think you'll gonna have a bad time. This is what I mean by "uncompiled C++". Maybe things have change since, but I'm not sure about that.

more ▼

answered Feb 28 '17 at 02:05 PM

avatar image

Gnougnou
141 17 16 28

avatar image Drunkenvalley Feb 28 '17 at 02:09 PM

What do you mean BP to C++ is more complicated? I honestly haven't noticed a difference between BP to C++ function and BP to BP function.

avatar image Gnougnou Feb 28 '17 at 02:21 PM

Yeah mistake, it's C++ to BP which is more complicated, because BP is uncompiled C++, so you have to use ConstructionHelper or use some parameters for your variable (like BlueprintEditable or I don't remember which).

But isn't there like a bake BP function ? Maybe it's easier if we can do that. Honestly, I'm clueless on that. I just remember that doing C++ was very cumbersome when having to deal with BP. I followed some advice and did what I told him to do : Make a C++ class with all the functions you need + components and then make a child BP of that class to arange your components. From there is it possible to use every C++ functions.

avatar image Drunkenvalley Feb 28 '17 at 02:24 PM

Honestly not sure I follow your sequence of actions, but I'll take your word for it. I've only played around with using C++ functions in Blueprints, implementing C++ functions in Blueprints and that kinda stuff. Never the other way.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Enabling С++ do not prevent you from using blueprint at all. All blueprint features will still working in cpp project

more ▼

answered Feb 28 '17 at 01:42 PM

avatar image

c4tnt
1k 13 8 31

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Yes, you can use Blueprints and C++ together. In C++ you'll use UFUNCTION() to define whether or not blueprints can access it, what it can do with it and what it requires to operate. I don't think it's bad to use blueprints - when packaging most of this should be optimized to C++ and then compiled anyway, and C++ is also a very powerful tool to have available.

You can definitely do a lot of AI related shenanigans from C++, we're doing that atm with a bachelor thesis.Part of our project involves exposing the work we're doing to blueprints as well to create a user-friendly experience. :)

more ▼

answered Feb 28 '17 at 01:44 PM

avatar image

Drunkenvalley
371 14 21 46

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question